seven bits

bit::FieldBuffer Class Reference
["Data Buffers"]

#include <bit/fieldbuffer.h>

List of all members.


Detailed Description

Combines the concept of a field with a means of extracting field data from a buffer.

Author:
Rick L. Vinyard, Jr. <rvinyard@cs.nmsu.edu>

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>
FieldBufferoperator= (const T &t)
FieldBase::pointer field ()
RecordBufferbuffer ()
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

RecordBufferm_buffer
FieldBase::pointer m_field

Constructor & Destructor Documentation

bit::FieldBuffer::FieldBuffer (  ) 

Referenced by field().

bit::FieldBuffer::FieldBuffer ( RecordBuffer b,
FieldBase::pointer  f 
)

bit::FieldBuffer::~FieldBuffer (  )  [virtual]


Member Function Documentation

void bit::FieldBuffer::set_record_field ( RecordBuffer b,
FieldBase::pointer  f 
)

References m_buffer, and m_field.

void bit::FieldBuffer::set_record_field ( RecordBuffer b = NULL,
FieldBase::pointer  f = FieldBase::pointer() 
)

References m_buffer, and m_field.

std::string bit::FieldBuffer::xml ( const std::string &  padding = std::string()  ) 

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().

template<typename T>
bit::FieldBuffer::operator T (  )  [inline]

References m_buffer, m_field, and unpack().

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 
)

template<typename T>
bool bit::FieldBuffer::unpack ( T &  val  )  [inline]

bool bit::FieldBuffer::pack ( const void *  mem,
size_t  mem_octets 
)

bool bit::FieldBuffer::pack ( const void *  mem,
size_t  mem_octets,
size_t  n 
)

template<typename T>
bool bit::FieldBuffer::pack ( const T &  val  )  [inline]

template<typename T>
FieldBuffer & bit::FieldBuffer::operator= ( const T &  t  )  [inline]

References m_buffer, m_field, and pack().

FieldBase::pointer bit::FieldBuffer::field (  ) 

References m_field.

Referenced by operator[]().

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]

bool bit::FieldBuffer::unpack_float ( float &  f  )  [protected]

bool bit::FieldBuffer::unpack_double ( double &  d  )  [protected]

bool bit::FieldBuffer::unpack_string ( std::string &  s  )  [protected]

References m_buffer, m_field, bit::OCTETS, and unpack().

Referenced by unpack().

bool bit::FieldBuffer::pack_uint64 ( uint64_t  data  )  [protected]

bool bit::FieldBuffer::pack_float ( float  f  )  [protected]

bool bit::FieldBuffer::pack_double ( double  d  )  [protected]

template<>
bool bit::FieldBuffer::unpack ( std::string &  val  )  [inline]

template<>
bool bit::FieldBuffer::pack ( const std::string &  val  )  [inline]


Member Data Documentation


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

Generated on Mon Nov 3 10:50:01 2008 for bit by doxygen 1.5.6