YARP  2.3.70.1
Yet Another Robot Platform
yarp::sig::VectorOf< T > Class Template Reference

Provides: More...

#include <yarp/sig/Vector.h>

+ Inheritance diagram for yarp::sig::VectorOf< T >:

Public Member Functions

 VectorOf ()
 
 VectorOf (size_t size)
 
 VectorOf (const VectorOf &r)
 
const VectorOf< T > & operator= (const VectorOf< T > &r)
 
virtual int getElementSize () const YARP_OVERRIDE
 
virtual int getBottleTag () const YARP_OVERRIDE
 
virtual size_t getListSize () const YARP_OVERRIDE
 
virtual const char * getMemoryBlock () const YARP_OVERRIDE
 
const T * getFirst () const
 
T * getFirst ()
 
virtual void resize (size_t size) YARP_OVERRIDE
 
void resize (size_t size, const T &def)
 
void push_back (const T &elem)
 
void pop_back (void)
 
T & operator[] (size_t i)
 Single element access, no range check. More...
 
const T & operator[] (size_t i) const
 Single element access, no range check, const version. More...
 
T & operator() (size_t i)
 Single element access, no range check. More...
 
const T & operator() (size_t i) const
 Single element access, no range check, const version. More...
 
size_t size () const
 
void clear ()
 
- Public Member Functions inherited from yarp::sig::VectorBase
virtual bool read (yarp::os::ConnectionReader &connection) YARP_OVERRIDE
 Read this object from a network connection. More...
 
virtual bool write (yarp::os::ConnectionWriter &connection) YARP_OVERRIDE
 Write vector to a connection. More...
 
- Public Member Functions inherited from yarp::os::Portable
virtual Type getType ()
 
- Public Member Functions inherited from yarp::os::PortReader
virtual ~PortReader ()
 Destructor. More...
 
virtual Type getReadType ()
 
- Public Member Functions inherited from yarp::os::PortWriter
virtual ~PortWriter ()
 Destructor. More...
 
virtual void onCompletion ()
 This is called when the port has finished all writing operations. More...
 
virtual void onCommencement ()
 This is called when the port is about to begin writing operations. More...
 
virtual Type getWriteType ()
 

Private Member Functions

void _updatePointers ()
 

Private Attributes

yarp::os::ManagedBytes bytes
 
T * first
 
size_t len
 

Additional Inherited Members

- Static Public Member Functions inherited from yarp::os::Portable
static bool copyPortable (PortWriter &writer, PortReader &reader)
 Copy one portable to another, via writing and reading. More...
 

Detailed Description

template<class T>
class yarp::sig::VectorOf< T >

Provides:

  • push_back(), pop_back() to add/remove an element at the end of the vector
  • resize(), to create an array of elements
  • clear(), to clean the array (remove all elements)
  • use [] to access single elements without range checking
  • use size() to get the current size of the Vector
  • use operator= to copy Vectors
  • read/write network methods Warning: the class is designed to work with simple types (i.e. types that do not allocate internal memory). Template instantiation needs to be checked to avoid unresolved externals. Network communication assumes same data representation (endianess) between machines.

Definition at line 28 of file Vector.h.

Constructor & Destructor Documentation

◆ VectorOf() [1/3]

template<class T>
yarp::sig::VectorOf< T >::VectorOf ( )
inline

Definition at line 119 of file Vector.h.

◆ VectorOf() [2/3]

template<class T>
yarp::sig::VectorOf< T >::VectorOf ( size_t  size)
inline

Definition at line 126 of file Vector.h.

◆ VectorOf() [3/3]

template<class T>
yarp::sig::VectorOf< T >::VectorOf ( const VectorOf< T > &  r)
inline

Definition at line 131 of file Vector.h.

Member Function Documentation

◆ _updatePointers()

template<class T>
void yarp::sig::VectorOf< T >::_updatePointers ( )
inlineprivate

Definition at line 109 of file Vector.h.

◆ clear()

template<class T>
void yarp::sig::VectorOf< T >::clear ( )
inline

Definition at line 252 of file Vector.h.

◆ getBottleTag()

template<class T>
virtual int yarp::sig::VectorOf< T >::getBottleTag ( ) const
inlinevirtual

Implements yarp::sig::VectorBase.

Definition at line 146 of file Vector.h.

◆ getElementSize()

template<class T>
virtual int yarp::sig::VectorOf< T >::getElementSize ( ) const
inlinevirtual

Implements yarp::sig::VectorBase.

Definition at line 142 of file Vector.h.

◆ getFirst() [1/2]

template<class T>
const T* yarp::sig::VectorOf< T >::getFirst ( ) const
inline

Definition at line 160 of file Vector.h.

◆ getFirst() [2/2]

template<class T>
T* yarp::sig::VectorOf< T >::getFirst ( )
inline

Definition at line 165 of file Vector.h.

◆ getListSize()

template<class T>
virtual size_t yarp::sig::VectorOf< T >::getListSize ( ) const
inlinevirtual

Implements yarp::sig::VectorBase.

Definition at line 150 of file Vector.h.

◆ getMemoryBlock()

template<class T>
virtual const char* yarp::sig::VectorOf< T >::getMemoryBlock ( ) const
inlinevirtual

Implements yarp::sig::VectorBase.

Definition at line 155 of file Vector.h.

◆ operator()() [1/2]

template<class T>
T& yarp::sig::VectorOf< T >::operator() ( size_t  i)
inline

Single element access, no range check.

Parameters
ithe index of the element to access.
Returns
a reference to the requested element.

Definition at line 233 of file Vector.h.

◆ operator()() [2/2]

template<class T>
const T& yarp::sig::VectorOf< T >::operator() ( size_t  i) const
inline

Single element access, no range check, const version.

Parameters
ithe index of the element to access.
Returns
a reference to the requested element.

Definition at line 243 of file Vector.h.

◆ operator=()

template<class T>
const VectorOf<T>& yarp::sig::VectorOf< T >::operator= ( const VectorOf< T > &  r)
inline

Definition at line 136 of file Vector.h.

◆ operator[]() [1/2]

template<class T>
T& yarp::sig::VectorOf< T >::operator[] ( size_t  i)
inline

Single element access, no range check.

Parameters
ithe index of the element to access.
Returns
a reference to the requested element.

Definition at line 213 of file Vector.h.

◆ operator[]() [2/2]

template<class T>
const T& yarp::sig::VectorOf< T >::operator[] ( size_t  i) const
inline

Single element access, no range check, const version.

Parameters
ithe index of the element to access.
Returns
a reference to the requested element.

Definition at line 223 of file Vector.h.

◆ pop_back()

template<class T>
void yarp::sig::VectorOf< T >::pop_back ( void  )
inline

Definition at line 199 of file Vector.h.

◆ push_back()

template<class T>
void yarp::sig::VectorOf< T >::push_back ( const T &  elem)
inline

Definition at line 191 of file Vector.h.

◆ resize() [1/2]

template<class T>
virtual void yarp::sig::VectorOf< T >::resize ( size_t  size)
inlinevirtual

Implements yarp::sig::VectorBase.

Definition at line 170 of file Vector.h.

◆ resize() [2/2]

template<class T>
void yarp::sig::VectorOf< T >::resize ( size_t  size,
const T &  def 
)
inline

Definition at line 181 of file Vector.h.

◆ size()

template<class T>
size_t yarp::sig::VectorOf< T >::size ( ) const
inline

Definition at line 248 of file Vector.h.

Member Data Documentation

◆ bytes

template<class T>
yarp::os::ManagedBytes yarp::sig::VectorOf< T >::bytes
private

Definition at line 105 of file Vector.h.

◆ first

template<class T>
T* yarp::sig::VectorOf< T >::first
private

Definition at line 106 of file Vector.h.

◆ len

template<class T>
size_t yarp::sig::VectorOf< T >::len
private

Definition at line 107 of file Vector.h.


The documentation for this class was generated from the following file: