DataTpl< T, DataModel > Class Template Reference

#include <source/ariba/utility/serialization/Data.hpp>

Inheritance diagram for DataTpl< T, DataModel >:

Inheritance graph
[legend]
Collaboration diagram for DataTpl< T, DataModel >:

Collaboration graph
[legend]

List of all members.

Public Member Functions

finline DataTpl ()
finline DataTpl (const DataTpl< T, DataModel > &copy)
finline DataTpl (const DataModel &_model)
finline DataTpl (const T *buffer, size_t length)
finline DataTpl (T *buffer, size_t length)
finline DataTpl (size_t length)
finline T * getBuffer () const
finline size_t getLength () const
void setLength (size_t new_length)
finline void ensureLength (size_t neededLength)
finline DataManipulator operator[] (size_t index)
finline const DataManipulator operator[] (size_t index) const
_Data sub (size_t index, size_t length=~0)
_Data clone (size_t index, size_t length) const
_Data clone () const
finline bool isEmpty () const
finline bool isUnspecified () const
finline void release ()
template<typename X>
_Dataoperator= (const DataTpl< X > &source)
template<typename X>
finline bool operator== (DataTpl< X > &data)
finline _Dataoperator &= (_Data &data)
finline _Dataoperator|= (_Data &data)
finline _Dataoperator^= (_Data &data)
finline _Data operator & (_Data &data)
finline _Data operator| (_Data &data)
finline _Data operator^ (_Data &data)

Static Public Attributes

static const size_t word_width = sizeof(T) * 8
static const Data UNSPECIFIED

Protected Types

typedef DataTpl< T, DataModel > _Data

Protected Attributes

DataModel model

Classes

class  DataManipulator


Detailed Description

template<typename T, typename DataModel>
class DataTpl< T, DataModel >

This class implements a wrapper for binary data. And this time, when the word binary is used -- it really means binary! Length and manipulation are specified and operate in bit precision. Most of the operations are highly effective using inline functions and compiler optimizations.

Two versions of binaries are supported: static, non-resizeable binaries and dynamic, resizeable ones. Please note, this class does not manage memory, reference counting etc. you have to take care about memory management yourself! However you can use the release() to delete the underlaying array.

Author:
Sebastian Mies

Definition at line 75 of file Data.hpp.


Member Typedef Documentation

template<typename T, typename DataModel>
typedef DataTpl<T,DataModel> DataTpl< T, DataModel >::_Data [protected]

Definition at line 77 of file Data.hpp.


Constructor & Destructor Documentation

template<typename T, typename DataModel>
finline DataTpl< T, DataModel >::DataTpl (  )  [inline]

Constructs a dynamic bit-data object of variable size.

Definition at line 135 of file Data.hpp.

template<typename T, typename DataModel>
finline DataTpl< T, DataModel >::DataTpl ( const DataTpl< T, DataModel > &  copy  )  [inline]

Contructs a copy of an existing data buffer

Definition at line 141 of file Data.hpp.

template<typename T, typename DataModel>
finline DataTpl< T, DataModel >::DataTpl ( const DataModel &  _model  )  [inline]

Definition at line 145 of file Data.hpp.

template<typename T, typename DataModel>
finline DataTpl< T, DataModel >::DataTpl ( const T *  buffer,
size_t  length 
) [inline]

Constructs a static bit-data object with the given buffer.

Definition at line 151 of file Data.hpp.

template<typename T, typename DataModel>
finline DataTpl< T, DataModel >::DataTpl ( T *  buffer,
size_t  length 
) [inline]

Constructs a dynamic bit-data object with the given buffer.

Definition at line 159 of file Data.hpp.

template<typename T, typename DataModel>
finline DataTpl< T, DataModel >::DataTpl ( size_t  length  )  [inline]

Constructs a dynamic bit-data object of variable size with the given initial size.

Definition at line 168 of file Data.hpp.


Member Function Documentation

template<typename T, typename DataModel>
finline T* DataTpl< T, DataModel >::getBuffer (  )  const [inline]

template<typename T, typename DataModel>
finline size_t DataTpl< T, DataModel >::getLength (  )  const [inline]

Returns the length of the data in bits

Definition at line 183 of file Data.hpp.

Referenced by DataStreamTpl< __mode, __variant, T >::getRemainingLength(), and ariba::communication::AribaOmnetModule::sendMessage().

template<typename T, typename DataModel>
void DataTpl< T, DataModel >::setLength ( size_t  new_length  )  [inline]

Sets the length of the data in bits

Definition at line 189 of file Data.hpp.

Referenced by DataStreamTpl< __mode, __variant, T >::getData().

template<typename T, typename DataModel>
finline void DataTpl< T, DataModel >::ensureLength ( size_t  neededLength  )  [inline]

Ensures that the buffer pointer has the given number of bits of memory reserved.

Parameters:
neededLength The minimum data length required.

Definition at line 199 of file Data.hpp.

Referenced by DataStreamTpl< __mode, __variant, T >::ensureLength().

template<typename T, typename DataModel>
finline DataManipulator DataTpl< T, DataModel >::operator[] ( size_t  index  )  [inline]

Returns a manipulator object for a certain bit position.

Parameters:
index The index in bits quantitites.
Returns:
A data manipulation object

Definition at line 209 of file Data.hpp.

template<typename T, typename DataModel>
finline const DataManipulator DataTpl< T, DataModel >::operator[] ( size_t  index  )  const [inline]

Returns a constant manipulator object for a certain bit position.

Parameters:
index The index in bits quantitites.
Returns:
A constant data manipulation object

Definition at line 219 of file Data.hpp.

template<typename T, typename DataModel>
_Data DataTpl< T, DataModel >::sub ( size_t  index,
size_t  length = ~0 
) [inline]

Definition at line 223 of file Data.hpp.

template<typename T, typename DataModel>
_Data DataTpl< T, DataModel >::clone ( size_t  index,
size_t  length 
) const [inline]

Returns a copy of the specified bit range.

Parameters:
index The first bit to copy
length The length of the bit range
Returns:
The cloned data object

Definition at line 235 of file Data.hpp.

Referenced by Message::Message().

template<typename T, typename DataModel>
_Data DataTpl< T, DataModel >::clone (  )  const [inline]

Returns a copy of the data.

Returns:
A cloned data object

Definition at line 245 of file Data.hpp.

Referenced by DataTpl< T >::operator &(), DataTpl< T >::operator^(), and DataTpl< T >::operator|().

template<typename T, typename DataModel>
finline bool DataTpl< T, DataModel >::isEmpty (  )  const [inline]

Returns true, if the data is empty (zero length)

Returns:
True, if the data is empty (zero length)

Definition at line 255 of file Data.hpp.

template<typename T, typename DataModel>
finline bool DataTpl< T, DataModel >::isUnspecified (  )  const [inline]

Returns true, if the data buffer is unspecified. In this case no memory is associated with this data object.

Returns:
True, if the data buffer is unspecified.

Definition at line 265 of file Data.hpp.

Referenced by Message::decapsulate(), Message::encapsulate(), and Message::PayloadSerializer::sznMethodBegin().

template<typename T, typename DataModel>
finline void DataTpl< T, DataModel >::release (  )  [inline]

This method frees the memory associated with this data object and sets this object into an unspecified state.

Definition at line 274 of file Data.hpp.

Referenced by DataStreamTpl< __mode, __variant, T >::add(), Message::dropPayload(), and ariba::communication::AribaOmnetModule::sendMessage().

template<typename T, typename DataModel>
template<typename X>
_Data& DataTpl< T, DataModel >::operator= ( const DataTpl< X > &  source  )  [inline]

Assigns another buffer

Definition at line 284 of file Data.hpp.

template<typename T, typename DataModel>
template<typename X>
finline bool DataTpl< T, DataModel >::operator== ( DataTpl< X > &  data  )  [inline]

Returns true, if the datas buffer's pointer and length are the same.

Definition at line 294 of file Data.hpp.

template<typename T, typename DataModel>
finline _Data& DataTpl< T, DataModel >::operator &= ( _Data data  )  [inline]

Definition at line 299 of file Data.hpp.

template<typename T, typename DataModel>
finline _Data& DataTpl< T, DataModel >::operator|= ( _Data data  )  [inline]

Definition at line 303 of file Data.hpp.

template<typename T, typename DataModel>
finline _Data& DataTpl< T, DataModel >::operator^= ( _Data data  )  [inline]

Definition at line 307 of file Data.hpp.

template<typename T, typename DataModel>
finline _Data DataTpl< T, DataModel >::operator & ( _Data data  )  [inline]

Definition at line 313 of file Data.hpp.

template<typename T, typename DataModel>
finline _Data DataTpl< T, DataModel >::operator| ( _Data data  )  [inline]

Definition at line 317 of file Data.hpp.

template<typename T, typename DataModel>
finline _Data DataTpl< T, DataModel >::operator^ ( _Data data  )  [inline]

Definition at line 321 of file Data.hpp.


Member Data Documentation

template<typename T, typename DataModel>
DataModel DataTpl< T, DataModel >::model [protected]

template<typename T, typename DataModel>
const size_t DataTpl< T, DataModel >::word_width = sizeof(T) * 8 [static]

Definition at line 81 of file Data.hpp.

Referenced by DataStreamTpl< __mode, __variant, T >::getRemainingData().

template<typename T, typename DataModel>
const Data DataTpl< T, DataModel >::UNSPECIFIED [inline, static]

Definition at line 130 of file Data.hpp.

Referenced by data_length().


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

Generated on Wed May 27 18:23:42 2009 for Ariba by  doxygen 1.5.6