ContRap-Libraries
Public Member Functions | Protected Attributes

crp::Vector Class Reference

Class Vector is a template vector type. More...

#include <vector.h>

Public Member Functions

 Vector (MetaInfo *meta_info)
 Creates a new template object from type info.
 ~Vector ()
 Releases the memory.
void resize (size_t size)
 Resizes the vector to the given size.
DPtr get_element (size_t index)
 Returns the pointer to the array elements.
void set_element (size_t index, const DPtr &value)
 Sets the value of the element at the given position.

Protected Attributes

MetaInfo * meta_info
 Template parameter.
char * data
 Data of the vector.
size_t size
 Size of the vector.
size_t max_size
 Maxium size.

Detailed Description

Class Vector is a template vector type.

The vector behaves on the one hand like an STL container. On the other hand it has a constant time representation as a C-array of container elements.

In contrast to an ordinary STL vector, the template parameter of this class is set at runtime.


Constructor & Destructor Documentation

crp::Vector::Vector ( MetaInfo *  meta_info)

Creates a new template object from type info.

Parameters:
meta_infoType information of the objects template parameter.
crp::Vector::~Vector ( )

Releases the memory.


Member Function Documentation

DPtr crp::Vector::get_element ( size_t  index)

Returns the pointer to the array elements.

Parameters:
indexIndex of the element
Returns:
Pointer to the element
void crp::Vector::resize ( size_t  size)

Resizes the vector to the given size.

Parameters:
sizeNew vector size.
void crp::Vector::set_element ( size_t  index,
const DPtr &  value 
)

Sets the value of the element at the given position.

Be sure that the new value can be casted to the type of the vector. An error is raised if not.

Parameters:
indexIndex of the element
valueNew value of the element

Field Documentation

char* crp::Vector::data [protected]

Data of the vector.

size_t crp::Vector::max_size [protected]

Maxium size.

MetaInfo* crp::Vector::meta_info [protected]

Template parameter.

size_t crp::Vector::size [protected]

Size of the vector.


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