ESA JPIP server  0.1
data::vint_vector Class Reference

This class has been implemented with the same philosophy that the class STL vector, but specifically designed to store integers with a length in bytes that can be not multiple from 2 (e.g. More...

#include <vint_vector.h>

Collaboration diagram for data::vint_vector:

Public Member Functions

 vint_vector ()
 Initializes the vector to store 64-bit integers. More...
 
 vint_vector (int num_bytes)
 Initializes the vector to store integers with the number of bytes given as parameter. More...
 
 vint_vector (const vint_vector &v)
 Copy constructor. More...
 
const vint_vectoroperator= (const vint_vector &v)
 Copy assignment. More...
 
void set_num_bytes (int num_bytes)
 Changes the number of bytes of the integer values. More...
 
int num_bytes () const
 Returns the number of bytes used. More...
 
int data_bytes () const
 Returns the current number of bytes stored. More...
 
uint64_t operator[] (int index) const
 Operator overloading for indexing the integer values. More...
 
void push_back (uint64_t value)
 Adds a new item to the end of the vector. More...
 
void clear ()
 Clears the content. More...
 
int size () const
 Returns the size of the vector, in number of items. More...
 
uint64_t & back ()
 Return the reference of the last item of the vector. More...
 
virtual ~vint_vector ()
 

Private Attributes

uint64_t mask
 Mask used for accessing the data. More...
 
int8_t num_bytes_
 Number of bytes used for the integers. More...
 
vector< uint8_t > data
 

Detailed Description

This class has been implemented with the same philosophy that the class STL vector, but specifically designed to store integers with a length in bytes that can be not multiple from 2 (e.g.

integers of 3 bytes). This class internally handles a vector of 1-byte integers.

See also
vector

Constructor & Destructor Documentation

data::vint_vector::vint_vector ( )
inline

Initializes the vector to store 64-bit integers.

data::vint_vector::vint_vector ( int  num_bytes)
inline

Initializes the vector to store integers with the number of bytes given as parameter.

Parameters
num_bytesNumber of bytes of each integer.
data::vint_vector::vint_vector ( const vint_vector v)
inline

Copy constructor.

virtual data::vint_vector::~vint_vector ( )
inlinevirtual

Member Function Documentation

uint64_t& data::vint_vector::back ( )
inline

Return the reference of the last item of the vector.

Here is the caller graph for this function:

void data::vint_vector::clear ( )
inline

Clears the content.

Here is the caller graph for this function:

int data::vint_vector::data_bytes ( ) const
inline

Returns the current number of bytes stored.

int data::vint_vector::num_bytes ( ) const
inline

Returns the number of bytes used.

const vint_vector& data::vint_vector::operator= ( const vint_vector v)
inline

Copy assignment.

uint64_t data::vint_vector::operator[] ( int  index) const
inline

Operator overloading for indexing the integer values.

Parameters
indexIndex of the item to return.
Returns
Value of the item, always as a uint64_t.
void data::vint_vector::push_back ( uint64_t  value)
inline

Adds a new item to the end of the vector.

Parameters
valueValue to add to the vector.

Here is the caller graph for this function:

void data::vint_vector::set_num_bytes ( int  num_bytes)
inline

Changes the number of bytes of the integer values.

All the current content is removed.

Parameters
num_bytesNew number of bytes to use.

Here is the caller graph for this function:

int data::vint_vector::size ( ) const
inline

Returns the size of the vector, in number of items.

Here is the caller graph for this function:

Member Data Documentation

vector<uint8_t> data::vint_vector::data
private
uint64_t data::vint_vector::mask
private

Mask used for accessing the data.

int8_t data::vint_vector::num_bytes_
private

Number of bytes used for the integers.


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