g4tools  5.4.0
Public Types | Public Member Functions | Protected Attributes | List of all members
tools::sg::xy2plot< T > Class Template Reference
Inheritance diagram for tools::sg::xy2plot< T >:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::xy2plot< T >:
Collaboration graph
[legend]

Public Types

typedef std::vector< T > data_t
 

Public Member Functions

virtual plottablecopy () const
 
virtual bool is_valid () const
 
virtual const std::string & name () const
 
virtual void set_name (const std::string &a_s)
 
virtual const std::string & title () const
 
virtual const std::string & legend () const
 
virtual void set_legend (const std::string &a_s)
 
virtual void infos (const std::string &a_opts, std::string &a_sinfos) const
 
virtual float x_axis_min () const
 
virtual float x_axis_max () const
 
virtual float y_axis_min () const
 
virtual float y_axis_max () const
 
virtual unsigned int points () const
 
virtual bool ith_point (unsigned int a_index, float &a_x, float &a_y) const
 
 xy2plot (const data_t &a_x, const data_t &a_y)
 
virtual ~xy2plot ()
 
 xy2plot (const xy2plot &a_from)
 
xy2plotoperator= (const xy2plot &a_from)
 
- Public Member Functions inherited from tools::sg::points2D
virtual void * cast (const std::string &a_class) const
 
virtual ~points2D ()
 
- Public Member Functions inherited from tools::sg::plottable
virtual ~plottable ()
 

Protected Attributes

const data_tm_x
 
const data_tm_y
 
std::string m_name
 
std::string m_legend
 
m_x_min
 
m_x_max
 
m_y_min
 
m_y_max
 

Detailed Description

template<class T>
class tools::sg::xy2plot< T >

Definition at line 23 of file xy2plot.

Member Typedef Documentation

◆ data_t

template<class T >
typedef std::vector<T> tools::sg::xy2plot< T >::data_t

Definition at line 73 of file xy2plot.

Constructor & Destructor Documentation

◆ xy2plot() [1/2]

template<class T >
tools::sg::xy2plot< T >::xy2plot ( const data_t a_x,
const data_t a_y 
)
inline

Definition at line 75 of file xy2plot.

76  :m_x(a_x)
77  ,m_y(a_y)
78  {
79 #ifdef TOOLS_MEM
80  mem::increment(s_class().c_str());
81 #endif
82  minimum<T>(a_x,m_x_min);
83  maximum<T>(a_x,m_x_max);
84 
85  minimum<T>(a_y,m_y_min);
86  maximum<T>(a_y,m_y_max);
87  }

◆ ~xy2plot()

template<class T >
virtual tools::sg::xy2plot< T >::~xy2plot ( )
inlinevirtual

Definition at line 88 of file xy2plot.

88  {
89 #ifdef TOOLS_MEM
90  mem::decrement(s_class().c_str());
91 #endif
92  }

◆ xy2plot() [2/2]

template<class T >
tools::sg::xy2plot< T >::xy2plot ( const xy2plot< T > &  a_from)
inline

Definition at line 94 of file xy2plot.

95  :plottable(a_from),points2D(a_from)
96  ,m_x(a_from.m_x)
97  ,m_y(a_from.m_y)
98  ,m_name(a_from.m_name)
99  ,m_legend(a_from.m_legend)
100  ,m_x_min(a_from.m_x_min)
101  ,m_x_max(a_from.m_x_max)
102  ,m_y_min(a_from.m_y_min)
103  ,m_y_max(a_from.m_y_max)
104  {
105 #ifdef TOOLS_MEM
106  mem::increment(s_class().c_str());
107 #endif
108  }

Member Function Documentation

◆ copy()

template<class T >
virtual plottable* tools::sg::xy2plot< T >::copy ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 29 of file xy2plot.

29 {return new xy2plot(*this);}

◆ infos()

template<class T >
virtual void tools::sg::xy2plot< T >::infos ( const std::string &  a_opts,
std::string &  a_sinfos 
) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 37 of file xy2plot.

37  {
38  a_sinfos.clear();
39  std::string f_lf("\n");
40  std::vector<std::string> ws;
41  words(a_opts," ",false,ws);
42  tools_vforcit(std::string,ws,it) {
43  if(((*it)=="name") && m_name.size()) {
44  if(a_sinfos.size()) a_sinfos += f_lf;
45  a_sinfos += "Name\n";
46  a_sinfos += m_name;
47 
48  } else if((*it)=="entries") {
49  if(a_sinfos.size()) a_sinfos += f_lf;
50  a_sinfos += "Entries\n";
51  if(!numas<unsigned int>(mn<unsigned int>(m_x.size(),m_y.size()),a_sinfos)){}
52 
53  }
54  }
55  }

◆ is_valid()

template<class T >
virtual bool tools::sg::xy2plot< T >::is_valid ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 30 of file xy2plot.

30 {return true;}

◆ ith_point()

template<class T >
virtual bool tools::sg::xy2plot< T >::ith_point ( unsigned int  a_index,
float &  a_x,
float &  a_y 
) const
inlinevirtual

Implements tools::sg::points2D.

Definition at line 65 of file xy2plot.

65  {
66  if(a_index>=m_x.size()) {a_x = T();a_y = T();return false;}
67  if(a_index>=m_y.size()) {a_x = T();a_y = T();return false;}
68  a_x = m_x[a_index];
69  a_y = m_y[a_index];
70  return true;
71  }

◆ legend()

template<class T >
virtual const std::string& tools::sg::xy2plot< T >::legend ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 34 of file xy2plot.

34 {return m_legend;}

◆ name()

template<class T >
virtual const std::string& tools::sg::xy2plot< T >::name ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 31 of file xy2plot.

31 {return m_name;}

◆ operator=()

template<class T >
xy2plot& tools::sg::xy2plot< T >::operator= ( const xy2plot< T > &  a_from)
inline

Definition at line 109 of file xy2plot.

109  {
110  m_name = a_from.m_name;
111  m_legend = a_from.m_legend;
112  m_x_min = a_from.m_x_min;
113  m_x_max = a_from.m_x_max;
114  m_y_min = a_from.m_y_min;
115  m_y_max = a_from.m_y_max;
116  return *this;
117  }

◆ points()

template<class T >
virtual unsigned int tools::sg::xy2plot< T >::points ( ) const
inlinevirtual

Implements tools::sg::points2D.

Definition at line 62 of file xy2plot.

62  {
63  return mn<unsigned int>(m_x.size(),m_y.size());
64  }

◆ set_legend()

template<class T >
virtual void tools::sg::xy2plot< T >::set_legend ( const std::string &  a_s)
inlinevirtual

Implements tools::sg::plottable.

Definition at line 35 of file xy2plot.

35 {m_legend = a_s;}

◆ set_name()

template<class T >
virtual void tools::sg::xy2plot< T >::set_name ( const std::string &  a_s)
inlinevirtual

Implements tools::sg::plottable.

Definition at line 32 of file xy2plot.

32 {m_name = a_s;}

◆ title()

template<class T >
virtual const std::string& tools::sg::xy2plot< T >::title ( ) const
inlinevirtual

Implements tools::sg::plottable.

Definition at line 33 of file xy2plot.

33 {return s_empty();}

◆ x_axis_max()

template<class T >
virtual float tools::sg::xy2plot< T >::x_axis_max ( ) const
inlinevirtual

Implements tools::sg::points2D.

Definition at line 58 of file xy2plot.

58 {return float(m_x_max);}

◆ x_axis_min()

template<class T >
virtual float tools::sg::xy2plot< T >::x_axis_min ( ) const
inlinevirtual

Implements tools::sg::points2D.

Definition at line 57 of file xy2plot.

57 {return float(m_x_min);}

◆ y_axis_max()

template<class T >
virtual float tools::sg::xy2plot< T >::y_axis_max ( ) const
inlinevirtual

Implements tools::sg::points2D.

Definition at line 60 of file xy2plot.

60 {return float(m_y_max);}

◆ y_axis_min()

template<class T >
virtual float tools::sg::xy2plot< T >::y_axis_min ( ) const
inlinevirtual

Implements tools::sg::points2D.

Definition at line 59 of file xy2plot.

59 {return float(m_y_min);}

Member Data Documentation

◆ m_legend

template<class T >
std::string tools::sg::xy2plot< T >::m_legend
protected

Definition at line 122 of file xy2plot.

◆ m_name

template<class T >
std::string tools::sg::xy2plot< T >::m_name
protected

Definition at line 121 of file xy2plot.

◆ m_x

template<class T >
const data_t& tools::sg::xy2plot< T >::m_x
protected

Definition at line 119 of file xy2plot.

◆ m_x_max

template<class T >
T tools::sg::xy2plot< T >::m_x_max
protected

Definition at line 124 of file xy2plot.

◆ m_x_min

template<class T >
T tools::sg::xy2plot< T >::m_x_min
protected

Definition at line 123 of file xy2plot.

◆ m_y

template<class T >
const data_t& tools::sg::xy2plot< T >::m_y
protected

Definition at line 120 of file xy2plot.

◆ m_y_max

template<class T >
T tools::sg::xy2plot< T >::m_y_max
protected

Definition at line 126 of file xy2plot.

◆ m_y_min

template<class T >
T tools::sg::xy2plot< T >::m_y_min
protected

Definition at line 125 of file xy2plot.


The documentation for this class was generated from the following file:
tools::sg::xy2plot::m_y_min
T m_y_min
Definition: xy2plot:125
tools::sg::xy2plot::m_x_min
T m_x_min
Definition: xy2plot:123
tools::sg::xy2plot::m_y
const data_t & m_y
Definition: xy2plot:120
tools::sg::xy2plot::m_legend
std::string m_legend
Definition: xy2plot:122
tools::sg::xy2plot::m_y_max
T m_y_max
Definition: xy2plot:126
tools::sg::xy2plot::m_x
const data_t & m_x
Definition: xy2plot:119
tools::sg::xy2plot::m_x_max
T m_x_max
Definition: xy2plot:124
tools::sg::xy2plot::xy2plot
xy2plot(const data_t &a_x, const data_t &a_y)
Definition: xy2plot:75
tools::words
void words(const std::string &a_string, const std::string &a_sep, bool a_take_empty, std::vector< std::string > &a_words, bool a_clear=true)
Definition: words:12
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::sg::xy2plot::m_name
std::string m_name
Definition: xy2plot:121