#include <bit/data.h>
Additional it provides several typedefs that may be used to ensure type consistency both within the conexus library, and with applications using the conexus library.
Public Types | |
| typedef uint8_t | Octet |
| Typedefs the concept of an octet as an unsigned 8 bit integer. | |
| typedef boost::shared_array< Octet > | Octets |
| Provides a convenience typedef of a smart pointer to data. | |
Public Member Functions | |
| Data () | |
| Default constructor initializes data size to zero and relies on smart pointer constructor to initialize pointer to NULL. | |
| Data (const void *d, size_t s) | |
| Constructor which accepts a pointer to data and size and creates a duplicate. | |
| Data (Octets d, size_t s) | |
| Constructor which accepts a smart pointer to data and data size in octets. | |
| Data (size_t s) | |
| Constructor which creates a data object of a given size in octets. | |
| Data | clone () |
| Performs a deep copy of this data object. | |
| operator Octet * () | |
| Overloaded dereference operator provides direct access to actual data. | |
| std::string | hex_string (bool uppercase=true, std::string separator="", std::string prefix="0x", std::string postfix="") |
| Returns a hex string representation of the data. | |
| std::string | binary_string (std::string separator="", size_t separator_digits=8, std::string prefix="", std::string postfix="") |
| void | clear () |
| Frees any allocated memory and resets size to 0. | |
Public Attributes | |
| Octets | data |
| Smart pointer to the underlying data. | |
| size_t | size |
| Size of the data in bytes. | |
|
|
Provides a convenience typedef of a smart pointer to data. Hint: access externally as Data::Octets |
|
|
Performs a deep copy of this data object. Assignment results in a shallow copy of this data object, which is in accordance with the semantics of the smart pointers used. However, at times a deep copy may be necessary. 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. |
|
|
Overloaded dereference operator provides direct access to actual data. If you want access to the smart pointer, use the data member instead. |
1.4.6