gatb.core-API-0.0.0
Vector< T > Class Template Reference

Vector class allowing to define vectors as sub parts of referred vectors. More...

#include <Vector.hpp>

Inheritance diagram for Vector< T >:
Inheritance graph

Public Member Functions

 Vector ()
 
 Vector (size_t aSize)
 
Vectoroperator= (const Vector &vect)
 
 ~Vector ()
 
char * getBuffer () const
 
size_t size () const
 
T & operator[] (size_t idx)
 
void resize (size_t aSize)
 
void setSize (size_t size)
 
void setRef (Vector *ref, size_t offset, size_t length)
 
void setRef (T *buffer, size_t length)
 
void set (T *buffer, size_t length)
 
- Public Member Functions inherited from SmartPointer
void use ()
 
void forget ()
 
- Public Member Functions inherited from ISmartPointer
virtual ~ISmartPointer ()
 

Additional Inherited Members

- Protected Member Functions inherited from SmartPointer
 SmartPointer ()
 
virtual ~SmartPointer ()
 

Detailed Description

template<typename T>
class gatb::core::tools::misc::Vector< T >

Vector class allowing to define vectors as sub parts of referred vectors.

This vector implementation supports two kind of memory management:

  • dynamic allocation: the data buffer is allocated
  • reference : the data buffer is a reference to some existing buffer in memory

Constructor & Destructor Documentation

Vector ( )
inline

Default constructor.

Vector ( size_t  aSize)
inline

Constructor with initial size.

Parameters
aSize: initial size of the vector.
~Vector ( )
inline

Destructor.

Member Function Documentation

char* getBuffer ( ) const
inline
Returns
buffer holding the actual data.
Vector& operator= ( const Vector< T > &  vect)
inline

assign operator

T& operator[] ( size_t  idx)
inline

Data access

Parameters
[in]idx: index of the character to be retrieved
Returns
the retrieved character.
void resize ( size_t  aSize)
inline

Resize the current vector.

Parameters
[in]aSize: new size of the vector.
void set ( T *  buffer,
size_t  length 
)
inline

Set the current data. Copy is done.

Parameters
[in]buffer: data referred by the current instance.
[in]length: size of the data
void setRef ( Vector< T > *  ref,
size_t  offset,
size_t  length 
)
inline

Set the current data as a part of a referenced another data.

Parameters
[in]ref: data referred by the current instance.
[in]offset: the current data will begin 'offset' bytes from the beginning of the referred data.
[in]length: size of the data
void setRef ( T *  buffer,
size_t  length 
)
inline

Set the current data as a part of a referenced another data.

Parameters
[in]buffer: pointer to the buffer to be referred
[in]length: size of the data
void setSize ( size_t  size)
inline

Set the size of the vector.

Parameters
[in]size: new size of the vector.
size_t size ( ) const
inline
Returns
buffer size (in bytes).

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