DataTpl< T, DataModel > Class Template Reference

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

Inherits Serializeable.

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

List of all members.

Classes

class  DataManipulator

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

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 76 of file Data.hpp.


Member Typedef Documentation

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

Definition at line 78 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 137 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 143 of file Data.hpp.

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

Definition at line 147 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 153 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 161 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 170 of file Data.hpp.


Member Function Documentation

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 247 of file Data.hpp.

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

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 237 of file Data.hpp.

Referenced by ariba::overlay::DHTMessage::DHTMessage(), Message::Message(), ariba::overlay::DHT::put(), and ariba::overlay::ValueEntry::set_value().

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 201 of file Data.hpp.

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

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]
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 257 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 267 of file Data.hpp.

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

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

Definition at line 315 of file Data.hpp.

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

Definition at line 301 of file Data.hpp.

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

Assigns another buffer

Definition at line 286 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 296 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 221 of file Data.hpp.

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 211 of file Data.hpp.

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

Definition at line 323 of file Data.hpp.

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

Definition at line 309 of file Data.hpp.

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

Definition at line 319 of file Data.hpp.

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

Definition at line 305 of file Data.hpp.

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 276 of file Data.hpp.

Referenced by DataStreamTpl< __mode, __variant, T >::add(), Message::dropPayload(), ariba::communication::BaseCommunication::send(), ariba::overlay::ValueEntry::set_value(), ariba::overlay::DHTMessage::~DHTMessage(), and ariba::overlay::ValueEntry::~ValueEntry().

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 191 of file Data.hpp.

Referenced by ariba::overlay::DHTMessage::DHTMessage(), DataStreamTpl< __mode, __variant, T >::getData(), and sznBeginDefault().

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

Definition at line 225 of file Data.hpp.


Member Data Documentation

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

Definition at line 132 of file Data.hpp.

Referenced by data_length().

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

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

Generated on Fri Dec 10 11:09:23 2010 for Ariba by  doxygen 1.6.1