SOFA API  e453628a
Open source framework for multi-physics simuation
sofa::type::vector< T, MemoryManager > Class Template Reference

#include <vector_T.h>

Inheritance diagram for sofa::type::vector< T, MemoryManager >:

Detailed Description

template<class T, class MemoryManager = CPUMemoryManager<T>>
class sofa::type::vector< T, MemoryManager >

Regular vector Using CPUMemoryManager, it has the same behavior as std::vector with extra conveniences:

  • string serialization (making it usable in Data)
  • operator[] is checking if the index is within the bounds in debug

Classes

struct  rebind
 

Public Member Functions

 vector ()
 Basic constructor. More...
 
 vector (Size n, const T &value)
 Constructor. More...
 
 vector (Size n)
 Constructor. More...
 
 vector (const std::vector< T, Alloc > &x)
 Constructor. More...
 
 vector (const std::initializer_list< T > &t)
 Brace initalizer constructor. More...
 
 vector (std::vector< T, Alloc > &&v)
 Move constructor. More...
 
vectoroperator= (const std::vector< T, Alloc > &x)
 Copy operator. More...
 
vectoroperator= (std::vector< T, Alloc > &&v)
 Move assignment operator. More...
 
 vector (typename vector< T >::const_iterator first, typename vector< T >::const_iterator last)
 Constructor. More...
 
reference operator[] (Size n)
 Read/write random access. More...
 
const_reference operator[] (Size n) const
 Read-only random access. More...
 
std::ostream & write (std::ostream &os) const
 
std::istream & read (std::istream &in)
 
void fill (const T &value)
 Sets every element to 'value'. More...
 
void fastResize (Size n)
 
template<>
SOFA_TYPE_API std::istream & read (std::istream &in)
 
template<>
SOFA_TYPE_API std::istream & read (std::istream &in)
 
template<>
SOFA_TYPE_API std::ostream & write (std::ostream &os) const
 
template<>
SOFA_TYPE_API std::istream & read (std::istream &in)
 
template<>
SOFA_TYPE_API std::istream & read (std::istream &in)
 Specialization for reading vectors of int and unsigned int using "A-B" notation for all integers between A and B. More...
 
template<>
SOFA_TYPE_API std::istream & read (std::istream &in)
 
template<>
SOFA_TYPE_API std::ostream & write (std::ostream &os) const
 Specialization for writing vectors of unsigned char. More...
 
template<>
SOFA_TYPE_API std::istream & read (std::istream &in)
 
template<>
SOFA_TYPE_API std::ostream & write (std::ostream &os) const
 
template<>
SOFA_TYPE_API std::ostream & write (std::ostream &os) const
 

Friends

std::ostream & operator<< (std::ostream &os, const vector &vec)
 Output stream. More...
 
std::istream & operator>> (std::istream &in, vector &vec)
 Input stream. More...
 

Constructor details

template<class T, class MemoryManager = CPUMemoryManager<T>>
sofa::type::vector< T, MemoryManager >::vector ( )
inline

Basic constructor.

template<class T, class MemoryManager = CPUMemoryManager<T>>
sofa::type::vector< T, MemoryManager >::vector ( Size  n,
const T &  value 
)
inline

Constructor.

template<class T, class MemoryManager = CPUMemoryManager<T>>
sofa::type::vector< T, MemoryManager >::vector ( Size  n)
inlineexplicit

Constructor.

template<class T, class MemoryManager = CPUMemoryManager<T>>
sofa::type::vector< T, MemoryManager >::vector ( const std::vector< T, Alloc > &  x)
inline

Constructor.

template<class T, class MemoryManager = CPUMemoryManager<T>>
sofa::type::vector< T, MemoryManager >::vector ( const std::initializer_list< T > &  t)
inline

Brace initalizer constructor.

template<class T, class MemoryManager = CPUMemoryManager<T>>
sofa::type::vector< T, MemoryManager >::vector ( std::vector< T, Alloc > &&  v)
inline

Move constructor.

template<class T, class MemoryManager = CPUMemoryManager<T>>
sofa::type::vector< T, MemoryManager >::vector ( typename vector< T >::const_iterator  first,
typename vector< T >::const_iterator  last 
)
inline

Constructor.

Function details

template<class T, class MemoryManager = CPUMemoryManager<T>>
void sofa::type::vector< T, MemoryManager >::fastResize ( Size  n)
inline

this function is usefull for vector_device because it resize the vector without device operation (if device is not valid). Therefore the function is used in asynchronous code to safly resize a vector which is either cuda of type::vector

template<class T, class MemoryManager = CPUMemoryManager<T>>
void sofa::type::vector< T, MemoryManager >::fill ( const T &  value)
inline

Sets every element to 'value'.

template<class T, class MemoryManager = CPUMemoryManager<T>>
vector& sofa::type::vector< T, MemoryManager >::operator= ( const std::vector< T, Alloc > &  x)
inline

Copy operator.

template<class T, class MemoryManager = CPUMemoryManager<T>>
vector& sofa::type::vector< T, MemoryManager >::operator= ( std::vector< T, Alloc > &&  v)
inline

Move assignment operator.

template<class T, class MemoryManager = CPUMemoryManager<T>>
reference sofa::type::vector< T, MemoryManager >::operator[] ( Size  n)
inline

Read/write random access.

template<class T, class MemoryManager = CPUMemoryManager<T>>
const_reference sofa::type::vector< T, MemoryManager >::operator[] ( Size  n) const
inline

Read-only random access.

template<>
SOFA_TYPE_API std::istream & sofa::type::vector< int >::read ( std::istream &  in)

Specialization for reading vectors of int and unsigned int using "A-B" notation for all integers between A and B.

template<>
SOFA_TYPE_API std::istream & sofa::type::vector< unsigned int >::read ( std::istream &  in)
template<>
SOFA_TYPE_API std::istream & sofa::type::vector< unsigned char >::read ( std::istream &  in)
template<>
SOFA_TYPE_API std::istream & sofa::type::vector< int >::read ( std::istream &  in)

Input stream Specialization for reading vectors of int and unsigned int using "A-B" notation for all integers between A and B, optionnally specifying a step using "A-B-step" notation.

template<class T, class MemoryManager = CPUMemoryManager<T>>
std::istream& sofa::type::vector< T, MemoryManager >::read ( std::istream &  in)
inline
template<>
SOFA_TYPE_API std::istream & sofa::type::vector< unsigned int >::read ( std::istream &  in)

Input stream Specialization for reading vectors of int and unsigned int using "A-B" notation for all integers between A and B

template<>
SOFA_TYPE_API std::istream & sofa::type::vector< unsigned char >::read ( std::istream &  in)

Input stream Specialization for reading vectors of unsigned char

template<>
SOFA_TYPE_API std::ostream & sofa::type::vector< std::string >::write ( std::ostream &  os) const
template<>
SOFA_TYPE_API std::ostream & sofa::type::vector< unsigned char >::write ( std::ostream &  os) const

Specialization for writing vectors of unsigned char.

template<>
SOFA_TYPE_API std::ostream & sofa::type::vector< std::string >::write ( std::ostream &  os) const

Output stream Specialization for writing vectors of unsigned char

template<class T, class MemoryManager = CPUMemoryManager<T>>
std::ostream& sofa::type::vector< T, MemoryManager >::write ( std::ostream &  os) const
inline
template<>
SOFA_TYPE_API std::ostream & sofa::type::vector< unsigned char >::write ( std::ostream &  os) const

Output stream Specialization for writing vectors of unsigned char

Related details

template<class T, class MemoryManager = CPUMemoryManager<T>>
std::ostream& operator<< ( std::ostream &  os,
const vector< T, MemoryManager > &  vec 
)
friend

Output stream.

template<class T, class MemoryManager = CPUMemoryManager<T>>
std::istream& operator>> ( std::istream &  in,
vector< T, MemoryManager > &  vec 
)
friend

Input stream.