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

Public Member Functions

virtual void * cast (const std::string &a_class) const
 
virtual const std::string & s_cls () const
 
virtual bool write (io::iwbuf &a_buffer)
 
virtual bool read (io::irbuf &a_buffer)
 
virtual bool dump (std::ostream &a_out)
 
virtual bool s_value (std::string &a_s) const
 
virtual bool s2value (const std::string &)
 
 mf_enum ()
 
 mf_enum (const T &a_v)
 
 mf_enum (const std::vector< T > &a_v)
 
virtual ~mf_enum ()
 
 mf_enum (const mf_enum &a_from)
 
mf_enumoperator= (const mf_enum &a_from)
 
- Public Member Functions inherited from tools::sg::bmf< T >
 bmf ()
 
 bmf (const T &a_value)
 
 bmf (const std::vector< T > &a_v)
 
virtual ~bmf ()
 
 bmf (const bmf &a_from)
 
bmfoperator= (const bmf &a_from)
 
bmfoperator= (const std::vector< T > &a_from)
 
bool operator== (const bmf &a_from) const
 
bool operator!= (const bmf &a_from) const
 
const T & operator[] (size_t a_index) const
 
T & operator[] (size_t a_index)
 
size_t size () const
 
bool empty () const
 
const std::vector< T > & values () const
 
std::vector< T > & values ()
 
void add (const T &a_value)
 
void add (const std::vector< T > &a_vals)
 
void add_allocated (size_t &a_pos, const T &a_1, const T &a_2, const T &a_3)
 
void insert (const it_t &a_it, const T &a_value)
 
bool set_value (size_t a_index, const T &a_value)
 
bool get_value (size_t a_index, T &a_value)
 
void clear ()
 
void set_values (const std::vector< T > &a_values)
 
void set_value (const T &a_value)
 
bool setValues (size_t a_index, size_t a_num, const T *a_vs)
 
bool set1Value (size_t a_index, const T &a_value)
 
bool setValue (const T &a_value)
 
bmfoperator= (const T &a_v)
 
size_t getNum () const
 
T * getValues (size_t a_start)
 
- Public Member Functions inherited from tools::sg::field
virtual ~field ()
 
void touch ()
 
bool touched () const
 
void reset_touched ()
 

Static Public Member Functions

static const std::string & s_class ()
 
- Static Public Member Functions inherited from tools::sg::bmf< T >
static const std::string & s_class ()
 

Additional Inherited Members

- Public Types inherited from tools::sg::bmf< T >
typedef std::vector< T >::iterator it_t
 
- Protected Member Functions inherited from tools::sg::field
 field ()
 
 field (const field &)
 
fieldoperator= (const field &)
 
- Protected Attributes inherited from tools::sg::bmf< T >
std::vector< T > m_values
 
- Protected Attributes inherited from tools::sg::field
bool m_touched
 

Detailed Description

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

Definition at line 122 of file mf.

Constructor & Destructor Documentation

◆ mf_enum() [1/4]

template<class T >
tools::sg::mf_enum< T >::mf_enum ( )
inline

Definition at line 163 of file mf.

163 :parent(){}

◆ mf_enum() [2/4]

template<class T >
tools::sg::mf_enum< T >::mf_enum ( const T &  a_v)
inline

Definition at line 164 of file mf.

164 :parent(a_v){}

◆ mf_enum() [3/4]

template<class T >
tools::sg::mf_enum< T >::mf_enum ( const std::vector< T > &  a_v)
inline

Definition at line 165 of file mf.

165 :parent(a_v){}

◆ ~mf_enum()

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

Definition at line 166 of file mf.

166 {}

◆ mf_enum() [4/4]

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

Definition at line 168 of file mf.

168 :parent(a_from){}

Member Function Documentation

◆ cast()

template<class T >
virtual void* tools::sg::mf_enum< T >::cast ( const std::string &  a_class) const
inlinevirtual

Reimplemented from tools::sg::bmf< T >.

Definition at line 129 of file mf.

129  {
130  if(void* p = cmp_cast< mf_enum<T> >(this,a_class)) {return p;}
131  return parent::cast(a_class);
132  }

◆ dump()

template<class T >
virtual bool tools::sg::mf_enum< T >::dump ( std::ostream &  a_out)
inlinevirtual

Implements tools::sg::field.

Definition at line 151 of file mf.

151  {
152  const std::vector<T>& vec = parent::m_values;
153  a_out << "size : " << vec.size() << std::endl;
154  typedef typename std::vector<T>::const_iterator cit_t;
155  for(cit_t it=vec.begin();it!=vec.end();++it) {
156  a_out << " " << (*it) << std::endl;
157  }
158  return true;
159  }

◆ operator=()

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

Definition at line 169 of file mf.

169  {
170  parent::operator=(a_from);
171  return *this;
172  }

◆ read()

template<class T >
virtual bool tools::sg::mf_enum< T >::read ( io::irbuf a_buffer)
inlinevirtual

Implements tools::sg::field.

Definition at line 142 of file mf.

142  {
143  std::vector<int16> v; //an enum can be negative.
144  if(!a_buffer.read_std_vec(v)) return false;
145  std::vector<T>& vec = parent::m_values;
146  vec.clear();
147  std::vector<int16>::const_iterator it;
148  for(it=v.begin();it!=v.end();++it) vec.push_back((T)(*it));
149  return true;
150  }

◆ s2value()

template<class T >
virtual bool tools::sg::mf_enum< T >::s2value ( const std::string &  )
inlinevirtual

Implements tools::sg::field.

Definition at line 161 of file mf.

161 {return false;}

◆ s_class()

template<class T >
static const std::string& tools::sg::mf_enum< T >::s_class ( )
inlinestatic

Definition at line 125 of file mf.

125  {
126  static const std::string s_v("tools::sg::mf_enum");
127  return s_v;
128  }

◆ s_cls()

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

Reimplemented from tools::sg::bmf< T >.

Definition at line 133 of file mf.

133 {return s_class();}

◆ s_value()

template<class T >
virtual bool tools::sg::mf_enum< T >::s_value ( std::string &  a_s) const
inlinevirtual

Implements tools::sg::field.

Definition at line 160 of file mf.

160 {a_s.clear();return false;}

◆ write()

template<class T >
virtual bool tools::sg::mf_enum< T >::write ( io::iwbuf a_buffer)
inlinevirtual

Implements tools::sg::field.

Definition at line 135 of file mf.

135  {
136  const std::vector<T>& vec = parent::m_values;
137  std::vector<int16> v; //an enum can be negative.
138  typedef typename std::vector<T>::const_iterator cit_t;
139  for(cit_t it=vec.begin();it!=vec.end();++it) v.push_back(*it);
140  return a_buffer.write_vec((uint32)v.size(),vec_data(v));
141  }

The documentation for this class was generated from the following file:
tools::vec_data
const T * vec_data(const std::vector< T > &a_vec)
Definition: vdata:18
tools::sg::mf_enum::s_class
static const std::string & s_class()
Definition: mf:125
tools::sg::bmf::operator=
bmf & operator=(const bmf &a_from)
Definition: bmf:42
tools::cmp_cast
void * cmp_cast(const TO *a_this, const std::string &a_class)
Definition: scast:15
tools::sg::bmf::m_values
std::vector< T > m_values
Definition: bmf:163
tools::sg::bmf::cast
virtual void * cast(const std::string &a_class) const
Definition: bmf:30
tools::uint32
unsigned int uint32
Definition: typedefs:71