#include <bit/fieldbuffer.h>
Public Member Functions | |
FieldBuffer () | |
FieldBuffer (RecordBuffer &b, FieldBase::pointer f) | |
virtual | ~FieldBuffer () |
void | set_record_field (RecordBuffer &b, FieldBase::pointer f) |
void | set_record_field (RecordBuffer *b=NULL, FieldBase::pointer f=FieldBase::pointer()) |
std::string | xml (const std::string &padding=std::string()) |
std::string | value () |
FieldBuffer | field (size_t index) throw (exception::invalid_index) |
FieldBuffer | field (const std::string &index) throw (exception::invalid_index) |
FieldBuffer | operator[] (size_t index) throw (exception::invalid_index) |
FieldBuffer | operator[] (const std::string &index) throw (exception::invalid_index) |
FieldBuffer | operator[] (const char *index) throw (exception::invalid_index) |
template<typename T> | |
operator T () | |
Data | data () |
Returns a copy of the underlying data buffer allocated. | |
bool | unpack (void *mem, size_t mem_octets) |
template<typename T> | |
bool | unpack (T &val) |
bool | pack (const void *mem, size_t mem_octets) |
bool | pack (const void *mem, size_t mem_octets, size_t n) |
template<typename T> | |
bool | pack (const T &val) |
template<typename T> | |
FieldBuffer & | operator= (const T &t) |
FieldBase::pointer | field () |
RecordBuffer * | buffer () |
template<> | |
bool | unpack (std::string &val) |
template<> | |
bool | pack (const std::string &val) |
Protected Member Functions | |
bool | unpack_uint64 (uint64_t &ui64) |
Unpacks the field according to the field's byte order and returns the field as a 64-bit value in the host order. | |
bool | unpack_int64 (int64_t &i64) |
bool | unpack_float (float &f) |
bool | unpack_double (double &d) |
bool | unpack_string (std::string &s) |
bool | pack_uint64 (uint64_t data) |
Packs host ordered 64-bit value according to the field's byte order specification. | |
bool | pack_float (float f) |
bool | pack_double (double d) |
Protected Attributes | |
RecordBuffer * | m_buffer |
FieldBase::pointer | m_field |
bit::FieldBuffer::FieldBuffer | ( | ) |
Referenced by field().
bit::FieldBuffer::FieldBuffer | ( | RecordBuffer & | b, | |
FieldBase::pointer | f | |||
) |
bit::FieldBuffer::~FieldBuffer | ( | ) | [virtual] |
void bit::FieldBuffer::set_record_field | ( | RecordBuffer & | b, | |
FieldBase::pointer | f | |||
) |
void bit::FieldBuffer::set_record_field | ( | RecordBuffer * | b = NULL , |
|
FieldBase::pointer | f = FieldBase::pointer() | |||
) |
std::string bit::FieldBuffer::xml | ( | const std::string & | padding = std::string() |
) |
References data(), bit::Data::encoded(), bit::FIELD_ELEMENT, and m_field.
std::string bit::FieldBuffer::value | ( | ) |
References unpack().
FieldBuffer bit::FieldBuffer::field | ( | size_t | index | ) | throw (exception::invalid_index) |
References FieldBuffer(), m_buffer, and m_field.
FieldBuffer bit::FieldBuffer::field | ( | const std::string & | index | ) | throw (exception::invalid_index) |
References FieldBuffer(), m_buffer, and m_field.
FieldBuffer bit::FieldBuffer::operator[] | ( | size_t | index | ) | throw (exception::invalid_index) |
References field().
FieldBuffer bit::FieldBuffer::operator[] | ( | const std::string & | index | ) | throw (exception::invalid_index) |
References field().
FieldBuffer bit::FieldBuffer::operator[] | ( | const char * | index | ) | throw (exception::invalid_index) |
References field().
bit::FieldBuffer::operator T | ( | ) | [inline] |
Data bit::FieldBuffer::data | ( | ) |
Returns a copy of the underlying data buffer allocated.
References bit::Data::data(), m_field, bit::OCTETS, and unpack().
Referenced by xml().
bool bit::FieldBuffer::unpack | ( | void * | mem, | |
size_t | mem_octets | |||
) |
References bit::BITS, bit::END, m_buffer, m_field, and bit::Buffer::unpack().
Referenced by data(), operator T(), unpack(), unpack_double(), unpack_float(), unpack_string(), and value().
bool bit::FieldBuffer::unpack | ( | T & | val | ) | [inline] |
References bit::BITS, m_buffer, m_field, bit::SIGN_BIT, bit::SIGN_ONES_COMPLEMENT, bit::SIGN_TWOS_COMPLEMENT, bit::SIGN_UNSIGNED, bit::TYPE_ASCII, bit::TYPE_BCD, bit::TYPE_FLOATING, bit::TYPE_INTEGER, bit::TYPE_NONE, bit::TYPE_UTF8, unpack(), unpack_double(), unpack_float(), unpack_int64(), and unpack_uint64().
bool bit::FieldBuffer::pack | ( | const void * | mem, | |
size_t | mem_octets | |||
) |
References bit::BITS, bit::END, m_buffer, m_field, bit::RecordBuffer::on_field_changed(), and bit::Buffer::pack().
Referenced by operator=(), pack(), pack_double(), and pack_float().
bool bit::FieldBuffer::pack | ( | const void * | mem, | |
size_t | mem_octets, | |||
size_t | n | |||
) |
References bit::BITS, bit::END, m_buffer, m_field, bit::RecordBuffer::on_field_changed(), and bit::Buffer::pack().
bool bit::FieldBuffer::pack | ( | const T & | val | ) | [inline] |
References bit::BITS, m_buffer, m_field, pack(), pack_double(), pack_float(), pack_uint64(), bit::TYPE_ASCII, bit::TYPE_BCD, bit::TYPE_FLOATING, bit::TYPE_INTEGER, bit::TYPE_NONE, and bit::TYPE_UTF8.
FieldBuffer & bit::FieldBuffer::operator= | ( | const T & | t | ) | [inline] |
FieldBase::pointer bit::FieldBuffer::field | ( | ) |
RecordBuffer * bit::FieldBuffer::buffer | ( | ) |
References m_buffer.
bool bit::FieldBuffer::unpack_uint64 | ( | uint64_t & | ui64 | ) | [protected] |
Unpacks the field according to the field's byte order and returns the field as a 64-bit value in the host order.
References bit::be_to_host(), bit::BITS, bit::BYTEORDER_BIG_ENDIAN, bit::BYTEORDER_LITTLE_ENDIAN, bit::BYTEORDER_NETWORK, bit::END, bit::le_to_host(), m_buffer, m_field, bit::net_to_host(), bit::START, and bit::Buffer::unpack().
Referenced by unpack(), and unpack_int64().
bool bit::FieldBuffer::unpack_int64 | ( | int64_t & | i64 | ) | [protected] |
References bit::BITS, m_buffer, m_field, bit::SIGN_BIT, bit::SIGN_ONES_COMPLEMENT, bit::SIGN_TWOS_COMPLEMENT, bit::SIGN_UNSIGNED, and unpack_uint64().
Referenced by unpack().
bool bit::FieldBuffer::unpack_float | ( | float & | f | ) | [protected] |
References bit::be_to_host(), bit::BYTEORDER_BIG_ENDIAN, bit::BYTEORDER_HOST, bit::BYTEORDER_LITTLE_ENDIAN, bit::BYTEORDER_NETWORK, bit::le_to_host(), m_buffer, m_field, bit::net_to_host(), and unpack().
Referenced by unpack().
bool bit::FieldBuffer::unpack_double | ( | double & | d | ) | [protected] |
References bit::be_to_host(), bit::BYTEORDER_BIG_ENDIAN, bit::BYTEORDER_HOST, bit::BYTEORDER_LITTLE_ENDIAN, bit::BYTEORDER_NETWORK, bit::le_to_host(), m_buffer, m_field, bit::net_to_host(), and unpack().
Referenced by unpack().
bool bit::FieldBuffer::unpack_string | ( | std::string & | s | ) | [protected] |
bool bit::FieldBuffer::pack_uint64 | ( | uint64_t | data | ) | [protected] |
Packs host ordered 64-bit value according to the field's byte order specification.
References bit::BITS, bit::BYTEORDER_BIG_ENDIAN, bit::BYTEORDER_LITTLE_ENDIAN, bit::BYTEORDER_NETWORK, bit::END, bit::host_to_be(), bit::host_to_le(), bit::host_to_net(), m_buffer, m_field, bit::RecordBuffer::on_field_changed(), bit::Buffer::pack(), and bit::START.
Referenced by pack().
bool bit::FieldBuffer::pack_float | ( | float | f | ) | [protected] |
References bit::BITS, bit::BYTEORDER_BIG_ENDIAN, bit::BYTEORDER_HOST, bit::BYTEORDER_LITTLE_ENDIAN, bit::BYTEORDER_NETWORK, bit::host_to_be(), bit::host_to_le(), bit::host_to_net(), m_buffer, m_field, and pack().
Referenced by pack().
bool bit::FieldBuffer::pack_double | ( | double | d | ) | [protected] |
References bit::BITS, bit::BYTEORDER_BIG_ENDIAN, bit::BYTEORDER_HOST, bit::BYTEORDER_LITTLE_ENDIAN, bit::BYTEORDER_NETWORK, bit::host_to_be(), bit::host_to_le(), bit::host_to_net(), m_buffer, m_field, and pack().
Referenced by pack().
bool bit::FieldBuffer::unpack | ( | std::string & | val | ) | [inline] |
bool bit::FieldBuffer::pack | ( | const std::string & | val | ) | [inline] |
References bit::BITS, m_buffer, m_field, pack_double(), pack_float(), pack_uint64(), bit::TYPE_FLOATING, and bit::TYPE_INTEGER.
RecordBuffer* bit::FieldBuffer::m_buffer [protected] |
Referenced by buffer(), field(), operator T(), operator=(), pack(), pack_double(), pack_float(), pack_uint64(), set_record_field(), unpack(), unpack_double(), unpack_float(), unpack_int64(), unpack_string(), and unpack_uint64().
FieldBase::pointer bit::FieldBuffer::m_field [protected] |
Referenced by data(), field(), operator T(), operator=(), pack(), pack_double(), pack_float(), pack_uint64(), set_record_field(), unpack(), unpack_double(), unpack_float(), unpack_int64(), unpack_string(), unpack_uint64(), and xml().