g4tools  5.4.0
Public Member Functions | Static Public Member Functions | List of all members
tools::sg::mf_vec< T, TT > Class Template Reference
Inheritance diagram for tools::sg::mf_vec< T, TT >:
Inheritance graph
[legend]
Collaboration diagram for tools::sg::mf_vec< T, TT >:
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_vec ()
 
 mf_vec (const T &a_v)
 
 mf_vec (const std::vector< T > &a_v)
 
virtual ~mf_vec ()
 
 mf_vec (const mf_vec &a_from)
 
mf_vecoperator= (const mf_vec &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 TT>
class tools::sg::mf_vec< T, TT >

Definition at line 200 of file mf.

Constructor & Destructor Documentation

◆ mf_vec() [1/4]

template<class T , class TT >
tools::sg::mf_vec< T, TT >::mf_vec ( )
inline

Definition at line 259 of file mf.

259 :parent(){}

◆ mf_vec() [2/4]

template<class T , class TT >
tools::sg::mf_vec< T, TT >::mf_vec ( const T &  a_v)
inline

Definition at line 260 of file mf.

260 :parent(a_v){}

◆ mf_vec() [3/4]

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

Definition at line 261 of file mf.

261 :parent(a_v){}

◆ ~mf_vec()

template<class T , class TT >
virtual tools::sg::mf_vec< T, TT >::~mf_vec ( )
inlinevirtual

Definition at line 262 of file mf.

262 {}

◆ mf_vec() [4/4]

template<class T , class TT >
tools::sg::mf_vec< T, TT >::mf_vec ( const mf_vec< T, TT > &  a_from)
inline

Definition at line 264 of file mf.

264 :parent(a_from){}

Member Function Documentation

◆ cast()

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

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

Definition at line 207 of file mf.

207  {
208  if(void* p = cmp_cast< mf_vec<T,TT> >(this,a_class)) {return p;}
209  return parent::cast(a_class);
210  }

◆ dump()

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

Implements tools::sg::field.

Definition at line 247 of file mf.

247  {
248  const std::vector<T>& vec = parent::m_values;
249  a_out << "size : " << vec.size() << std::endl;
250  typedef typename std::vector<T>::const_iterator cit_t;
251  for(cit_t it=vec.begin();it!=vec.end();++it) {
252  a_out << " " << (*it) << std::endl;
253  }
254  return true;
255  }

◆ operator=()

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

Definition at line 265 of file mf.

265  {
266  parent::operator=(a_from);
267  return *this;
268  }

◆ read()

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

Implements tools::sg::field.

Definition at line 231 of file mf.

231  {
232  std::vector<T>& vec = parent::m_values;
233  vec.clear();
234  typedef typename std::vector<TT> vec_t;
235  std::vector<vec_t> vec_vec;
236  if(!a_buffer.read_std_vec_vec(vec_vec)) return false;
237  typedef typename std::vector<vec_t>::iterator _it_t;
238  for(_it_t it=vec_vec.begin();it!=vec_vec.end();++it) {
239  T x;
240  // x colorf, *it = std::vector<float>
241  // x vecs, *it = std::vector<std::string>
242  if(!set_from_vec(x,*it)) {vec.clear();return false;}
243  vec.push_back(x);
244  }
245  return true;
246  }

◆ s2value()

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

Implements tools::sg::field.

Definition at line 257 of file mf.

257 {return false;}

◆ s_class()

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

Definition at line 203 of file mf.

203  {
204  static const std::string s_v("tools::sg::mf_vec<"+stype(T())+","+stype(TT())+">");
205  return s_v;
206  }

◆ s_cls()

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

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

Definition at line 211 of file mf.

211 {return s_class();}

◆ s_value()

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

Implements tools::sg::field.

Definition at line 256 of file mf.

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

◆ write()

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

Implements tools::sg::field.

Definition at line 213 of file mf.

213  {
214  const std::vector<T>& vec = parent::m_values;
215  typedef typename std::vector<TT> vec_t;
216  std::vector<vec_t> vec_vec;
217  typedef typename std::vector<T>::const_iterator cit_t;
218  for(cit_t it=vec.begin();it!=vec.end();++it) {
219 
220  const T& v = (*it);
221  size_t num = v.size();
222  const TT* d = get_data(v);
223 
224  std::vector<TT> std_vec(num);
225  for(size_t i=0;i<num;i++) std_vec[i] = d[i];
226 
227  vec_vec.push_back(std_vec);
228  }
229  return a_buffer.write_std_vec_vec(vec_vec);
230  }

The documentation for this class was generated from the following file:
tools::sg::mf_vec::s_class
static const std::string & s_class()
Definition: mf:203
tools::sg::set_from_vec
bool set_from_vec(std::vector< std::string > &, const std::vector< std::string > &)
Definition: mf:186
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::get_data
const std::string * get_data(const std::vector< std::string > &a_v)
Definition: mf:191
tools::stype
const std::string & stype(const mat4f &)
Definition: mat4f:73
tools::sg::bmf::cast
virtual void * cast(const std::string &a_class) const
Definition: bmf:30