Public Member Functions | Public Attributes
icl_comm::ArrayBuilder Class Reference

#include <ByteOrderConversion.h>

List of all members.

Public Member Functions

template<typename T >
void appendWithoutConversion (const T &data)
 add data without any byte conversion
template<typename T >
void appendWithoutConversion (const std::vector< T > &data)
 add data in vectors without any byte conversion
 ArrayBuilder (size_t array_size=1)
template<typename T >
ArrayBuilderoperator<< (const T &data)
 Write any type into ArrayBuilder, convert to LittleEndian in process.
template<typename T >
ArrayBuilderoperator<< (const std::vector< T > &data)
 Write vectors into ArrayBuilder, each element is written seperately and convert to LittleEndian in process.
template<typename T >
ArrayBuilderoperator>> (T &data)
 Read a generic data type from the array builder, Endianess is converted to system architecture.
template<typename T >
ArrayBuilderoperator>> (std::vector< T > &data)
 Read a vectors from the array builder, Endianess is converted to system architecture.
template<typename T >
readBack ()
void reset (size_t array_size=1)
 Resets the Arraybuilder to initial state, all values will be deleted.

Public Attributes

std::vector< uint8_tarray
 array of template type TArray
size_t read_pos
 current read position in array
size_t write_pos
 current write position in array

Detailed Description

template class holding an array and the current index for write commands. Can be used to easily create an array for low level byte streams

The arraybuilder is intended to be used as a conversion queue for low level byte streams. Arbitrary data can be written into the arraybuider by calling the << operator. During this write operation the data will be convertet into a little endian representation regardles of the source architecture. This can be used when a Little Endian byte stream (i.e. for a serial device) is composed of several data types. Example: To send 1 int and to floats via bytestream in little endian ending: ArrayBuilder ab; ab << int << float1 << float2; send(ab.array); To read out values from the arraybuilder you can simply use the << operator. This will automatically convert the little endian representation to the byte order of the host system.

NOTE: As the arraybuilder converts the data during write and read operations the raw data that is read out from the stream has to be appended without any conversion (use appendWithoutConversion). (TODO: Is there a better Solution to this?)

Definition at line 130 of file ByteOrderConversion.h.


Constructor & Destructor Documentation

icl_comm::ArrayBuilder::ArrayBuilder ( size_t  array_size = 1) [inline]

Definition at line 133 of file ByteOrderConversion.h.


Member Function Documentation

template<typename T >
void icl_comm::ArrayBuilder::appendWithoutConversion ( const T &  data) [inline]

add data without any byte conversion

Definition at line 156 of file ByteOrderConversion.h.

template<typename T >
void icl_comm::ArrayBuilder::appendWithoutConversion ( const std::vector< T > &  data) [inline]

add data in vectors without any byte conversion

Definition at line 171 of file ByteOrderConversion.h.

template<typename T >
ArrayBuilder & icl_comm::ArrayBuilder::operator<< ( const T &  data)

Write any type into ArrayBuilder, convert to LittleEndian in process.

Definition at line 206 of file ByteOrderConversion.h.

template<typename T >
ArrayBuilder & icl_comm::ArrayBuilder::operator<< ( const std::vector< T > &  data)

Write vectors into ArrayBuilder, each element is written seperately and convert to LittleEndian in process.

Definition at line 220 of file ByteOrderConversion.h.

template<typename T >
ArrayBuilder & icl_comm::ArrayBuilder::operator>> ( T &  data)

Read a generic data type from the array builder, Endianess is converted to system architecture.

Read arbitrary types from the arraybuilder, endianess is converted during readout.

Definition at line 237 of file ByteOrderConversion.h.

template<typename T >
ArrayBuilder & icl_comm::ArrayBuilder::operator>> ( std::vector< T > &  data)

Read a vectors from the array builder, Endianess is converted to system architecture.

Read a vectors from the array builder, Endianess is converted to system architecture, vector has to be initualized.

Definition at line 245 of file ByteOrderConversion.h.

template<typename T >
T icl_comm::ArrayBuilder::readBack ( )

Read out the last data without removing it from the stream NOTE: This is only implemented for base types

Definition at line 259 of file ByteOrderConversion.h.

void icl_comm::ArrayBuilder::reset ( size_t  array_size = 1)

Resets the Arraybuilder to initial state, all values will be deleted.

Parameters:
array_sizesize the array is supposed to have after reset

Definition at line 72 of file ByteOrderConversion.cpp.


Member Data Documentation

array of template type TArray

Definition at line 146 of file ByteOrderConversion.h.

current read position in array

Definition at line 143 of file ByteOrderConversion.h.

current write position in array

Definition at line 140 of file ByteOrderConversion.h.


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


schunk_svh_driver
Author(s): Georg Heppner
autogenerated on Fri Aug 28 2015 12:59:20