#include <bit/data.h>
Inheritance diagram for bit::Data:
Public Types | |
typedef BitPointer< Data > | pointer |
Smart pointer typedef. | |
typedef BitPointer< const Data > | const_pointer |
Smart pointer typedef. | |
typedef BitPointer< Data > | pointer |
Smart pointer typedef. | |
typedef BitPointer< const Data > | const_pointer |
Smart pointer typedef. | |
Public Member Functions | |
Data (size_t s=0) throw (std::bad_alloc) | |
Constructor initializes buffer to a specific size. | |
Data (const void *d, size_t s, DataMode mode=COPY) throw (std::bad_alloc) | |
Constructor initializes buffer with a copy of specific data. | |
Data (const Data &other) | |
Copy constructor. | |
~Data () | |
Destructor. | |
uint8_t * | data () |
Pointer to the actual data. | |
const uint8_t * | data () const |
Constant pointer to the actual data. | |
bool | set_data (const void *newdata, size_t newsize, DataMode mode=COPY) throw (std::bad_alloc) |
Sets the buffer to specific data. | |
size_t | size () const |
Current buffer size. | |
bool | resize (size_t s) throw (std::bad_alloc) |
Resize buffer to size s. | |
Data | clone () const |
Performs a deep copy of this data object. | |
operator bool () | |
operator bool () const | |
operator uint8_t * () | |
Cast to a 1-octet pointer. | |
operator const uint8_t * () const | |
Cast to a 1-octet const pointer. | |
std::string | hex_string (std::string separator=std::string()) const |
Returns a hex string representation of the data. | |
void | clear () |
Releases any allocated memory and resets size to 0. | |
bool | operator< (const Data &other) const |
bool | operator<= (const Data &other) const |
bool | operator== (const Data &other) const |
bool | operator!= (const Data &other) const |
bool | operator>= (const Data &other) const |
bool | operator> (const Data &other) const |
int | compare (const Data &other) const |
Similar to memcmp. | |
virtual | ~Data () |
Destructor. | |
Octet * | data () |
Pointer to the actual data. | |
const Octet * | data () const |
Constant pointer to the actual data. | |
virtual void | set_data (const void *newdata, size_t newsize, DataMode mode=COPY) throw (std::bad_alloc) |
Sets the buffer to specific data. | |
virtual size_t | size () const |
Current buffer size. | |
virtual bool | resize (size_t s) throw (std::bad_alloc) |
Resize buffer to size s. | |
Data::pointer | clone () const |
Performs a deep copy of this data object. | |
operator Octet * () | |
Cast to a 1-octet pointer. | |
operator const Octet * () const | |
Cast to a 1-octet const pointer. | |
operator void * () | |
Cast to a void pointer. | |
operator const void * () const | |
Cast to a const void pointer. | |
std::string | hex_string (std::string separator=std::string()) const |
Returns a hex string representation of the data. | |
virtual void | clear () |
Releases any allocated memory and resets size to 0. | |
sigc::signal< void, size_t > | signal_size_changed () |
Signal emitted when the buffer size is changed. | |
sigc::signal< void, Octet * > | signal_data_buffer_changed () |
Signal emitted when the buffer pointer is changed. | |
virtual | ~Data () |
Destructor. | |
Octet * | data () |
Pointer to the actual data. | |
const Octet * | data () const |
Constant pointer to the actual data. | |
virtual void | set_data (const void *newdata, size_t newsize, DataMode mode=COPY) throw (std::bad_alloc) |
Sets the buffer to specific data. | |
virtual size_t | size () const |
Current buffer size. | |
virtual bool | resize (size_t s) throw (std::bad_alloc) |
Resize buffer to size s. | |
Data::pointer | clone () const |
Performs a deep copy of this data object. | |
operator Octet * () | |
Cast to a 1-octet pointer. | |
operator const Octet * () const | |
Cast to a 1-octet const pointer. | |
operator void * () | |
Cast to a void pointer. | |
operator const void * () const | |
Cast to a const void pointer. | |
std::string | hex_string (std::string separator=std::string()) const |
Returns a hex string representation of the data. | |
virtual void | clear () |
Releases any allocated memory and resets size to 0. | |
sigc::signal< void, size_t > | signal_size_changed () |
Signal emitted when the buffer size is changed. | |
sigc::signal< void, Octet * > | signal_data_buffer_changed () |
Signal emitted when the buffer pointer is changed. | |
Static Public Member Functions | |
static pointer | create (size_t s=0) throw (std::bad_alloc) |
Create a smart pointer instance initialized to a specific size. | |
static pointer | create (const void *d, size_t s, DataMode mode=COPY) throw (std::bad_alloc) |
Create a smart pointer instance initialized to a copy of specific data. | |
static pointer | create (size_t s=0) throw (std::bad_alloc) |
Create a smart pointer instance initialized to a specific size. | |
static pointer | create (const void *d, size_t s, DataMode mode=COPY) throw (std::bad_alloc) |
Create a smart pointer instance initialized to a copy of specific data. | |
Protected Member Functions | |
Data (size_t s=0) throw (std::bad_alloc) | |
Constructor initializes buffer to a specific size. | |
Data (const void *d, size_t s, DataMode mode=COPY) throw (std::bad_alloc) | |
Constructor initializes buffer with a copy of specific data. | |
Data (size_t s=0) throw (std::bad_alloc) | |
Constructor initializes buffer to a specific size. | |
Data (const void *d, size_t s, DataMode mode=COPY) throw (std::bad_alloc) | |
Constructor initializes buffer with a copy of specific data. | |
Protected Attributes | |
Storage::pointer | m_storage |
sigc::signal< void, size_t > | m_signal_size_changed |
sigc::signal< void, Octet * > | m_signal_data_buffer_changed |
sigc::signal< void, size_t > | m_signal_size_changed |
sigc::signal< void, Octet * > | m_signal_data_buffer_changed |
bool bit::Data::set_data | ( | const void * | newdata, | |
size_t | newsize, | |||
DataMode | mode = COPY | |||
) | throw (std::bad_alloc) |
Sets the buffer to specific data.
newdata + newsize must not be within the current storage region if a copy is performed
bool bit::Data::resize | ( | size_t | s | ) | throw (std::bad_alloc) |
Resize buffer to size s.
Data bit::Data::clone | ( | ) | const |
Performs a deep copy of this data object.
This method allocates a new memory chunk, copies the existing data into that data chunk, and returns an object containing a smart pointer to the underlying data.
int bit::Data::compare | ( | const Data & | other | ) | const |
Similar to memcmp.
Compares the memory areas of two data items. If the two data items are of different sizes (s1 and s2) only the first n bytes will be compared, where n is the lesser of s1 and s2.
Unlike memcmp, 0 will be returned only if the memory areas are identical and s1 is equal to s2.
If memcmp would return 0 for the first n bytes and s1 != s2, the an integer less than 0 is returned if s1 < s2 and an integer greater than 0 is returned if s1 > s2.
virtual bool bit::Data::resize | ( | size_t | s | ) | throw (std::bad_alloc) [virtual] |
Resize buffer to size s.
Data::pointer bit::Data::clone | ( | ) | const |
Performs a deep copy of this data object.
This method allocates a new memory chunk, copies the existing data into that data chunk, and returns an object containing a smart pointer to the underlying data.
virtual bool bit::Data::resize | ( | size_t | s | ) | throw (std::bad_alloc) [virtual] |
Resize buffer to size s.
Data::pointer bit::Data::clone | ( | ) | const |
Performs a deep copy of this data object.
This method allocates a new memory chunk, copies the existing data into that data chunk, and returns an object containing a smart pointer to the underlying data.