#include <source/ariba/utility/serialization/Data.hpp>
Inherits Serializeable.
Classes | |
class | DataManipulator |
Public Member Functions | |
finline | DataTpl () |
finline | DataTpl (const DataTpl< T, DataModel > ©) |
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 > | |
_Data & | operator= (const DataTpl< X > &source) |
template<typename X > | |
finline bool | operator== (DataTpl< X > &data) |
finline _Data & | operator&= (_Data &data) |
finline _Data & | operator|= (_Data &data) |
finline _Data & | operator^= (_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 |
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.
Definition at line 76 of file Data.hpp.
Returns a copy of the data.
Definition at line 247 of file Data.hpp.
Referenced by DataTpl< T >::operator&(), DataTpl< T >::operator^(), and DataTpl< T >::operator|().
_Data DataTpl< T, DataModel >::clone | ( | size_t | index, | |
size_t | length | |||
) | const [inline] |
Returns a copy of the specified bit range.
index | The first bit to copy | |
length | The length of the bit range |
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().
finline void DataTpl< T, DataModel >::ensureLength | ( | size_t | neededLength | ) | [inline] |
Ensures that the buffer pointer has the given number of bits of memory reserved.
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().
finline T* DataTpl< T, DataModel >::getBuffer | ( | ) | const [inline] |
Returns the internal buffer of the data.
Definition at line 178 of file Data.hpp.
Referenced by DataStreamTpl< __mode, __variant, T >::add(), DataStreamTpl< __mode, __variant, T >::bytes(), ariba::overlay::BaseOverlay::dhtGet(), ariba::overlay::DHTMessage::DHTMessage(), ariba::overlay::BaseOverlay::dhtPut(), ariba::overlay::BaseOverlay::dhtRemove(), ariba::application::dhttest::DHTTest::dtos(), ariba::overlay::DHT::equals(), DataStreamTpl< __mode, __variant, T >::getRemainingData(), DataStreamTpl< __mode, __variant, T >::remove(), ariba::communication::BaseCommunication::send(), and ariba::utility::PeriodicBroadcast::udp_server::sendservice().
finline size_t DataTpl< T, DataModel >::getLength | ( | ) | const [inline] |
Returns the length of the data in bits
Definition at line 185 of file Data.hpp.
Referenced by ariba::overlay::BaseOverlay::dhtGet(), ariba::overlay::DHTMessage::DHTMessage(), ariba::overlay::BaseOverlay::dhtPut(), ariba::overlay::BaseOverlay::dhtRemove(), ariba::application::dhttest::DHTTest::dtos(), ariba::overlay::DHT::equals(), DataStreamTpl< __mode, __variant, T >::getRemainingLength(), ariba::communication::BaseCommunication::send(), ariba::utility::PeriodicBroadcast::udp_server::sendservice(), and sznBeginDefault().
finline bool DataTpl< T, DataModel >::isEmpty | ( | ) | const [inline] |
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.
Definition at line 267 of file Data.hpp.
Referenced by Message::decapsulate(), Message::encapsulate(), sznBeginDefault(), and Message::PayloadSerializer::sznMethodBegin().
finline const DataManipulator DataTpl< T, DataModel >::operator[] | ( | size_t | index | ) | const [inline] |
finline DataManipulator DataTpl< T, DataModel >::operator[] | ( | size_t | index | ) | [inline] |
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().
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().
Definition at line 79 of file Data.hpp.
Referenced by DataTpl< T >::clone(), DataTpl< T >::DataTpl(), DataTpl< T >::ensureLength(), DataTpl< T >::getBuffer(), DataTpl< T >::getLength(), DataTpl< T >::isEmpty(), DataTpl< T >::isUnspecified(), DataTpl< T >::operator=(), DataTpl< T >::operator==(), DataTpl< T >::operator[](), DataTpl< T >::release(), DataTpl< T >::setLength(), and DataTpl< T >::sub().
const Data DataTpl< T, DataModel >::UNSPECIFIED [inline, static] |
Definition at line 132 of file Data.hpp.
Referenced by data_length().
const size_t DataTpl< T, DataModel >::word_width = sizeof(T) * 8 [static] |
Definition at line 82 of file Data.hpp.
Referenced by DataStreamTpl< __mode, __variant, T >::bytes(), and DataStreamTpl< __mode, __variant, T >::getRemainingData().