Encapsulates a raw block of memory and provides read and write access to it. More...
Public Types | |
|
typedef boost::shared_ptr < RawData > | SharedPtr |
Public Member Functions | |
| RawData (const uint8_bt *pMemoryBlock, uint64_bt numBytes, bool a_doCopy=false) | |
| Ctor. | |
| RawData (uint64_bt numBytes) | |
| Ctor. | |
| RawData (const std::string &a_fileName) | |
| Ctor. | |
| ~RawData () | |
| Dtor. | |
| bool | writeFile (const std::string &a_fileName) |
| Writes the given raw data to a file. | |
| bool | writeData (const unsigned char *a_in, uint64_bt numBytes) |
| Other Write Data Overrides. | |
| bool | writeData (unsigned char *a_in, uint64_bt numBytes) |
| bool | writeData (const std::string &a_in) |
| bool | writeData (const Poco::UUID &a_uuid) |
| bool | writeData (const Poco::Net::SocketAddress &a_address) |
| bool | writeData (const PeerID &a_peer) |
| bool | writeData (int64_bt a_value) |
| bool | writeData (uint64_bt a_value) |
| bool | writeData (uint32_bt a_value) |
| bool | writeData (int32_bt a_value) |
| bool | writeData (double a_value) |
| bool | reset () |
| reset | |
| bool | readData (unsigned char *a_in, uint64_bt numBytes) |
| Reads data into the given pointer upto numBytes. | |
| bool | readData (std::string &a_str) |
| Other readData Overrides. | |
| bool | readData (Poco::UUID &a_uuid) |
| bool | readData (Poco::Net::SocketAddress &a_address) |
| bool | readData (PeerID &a_peer) |
| bool | readData (int64_bt &a_value) |
| bool | readData (uint64_bt &a_value) |
| bool | readData (uint32_bt &a_value) |
| bool | readData (int32_bt &a_value) |
| bool | readData (double &a_value) |
| uint64_bt | getRemainingBytes () const |
| Returns the number of bytes left from the current read/write location. | |
| uint64_bt | getTotalBytes () const |
| Returns the total number of bytes in the memory block. | |
| unsigned char * | getRawData () const |
| Returns the pointer to the actual allocated memory block. | |
Static Public Member Functions | |
| static void | encode64 (std::string &output, unsigned char *ptr, size_t length) |
| Encodes a given char* block into a 64 encoded string. | |
| static void | decode64 (const std::string &input, std::string &output) |
| decodes a given char* block from a 64 encoded string | |
Encapsulates a raw block of memory and provides read and write access to it.
| Tonido::Data::RawData::RawData | ( | const uint8_bt * | pMemoryBlock, |
| uint64_bt | numBytes, | ||
| bool | a_doCopy = false |
||
| ) |
Ctor.
Constructs a RawData object out of an an already existing block of memory.
| Tonido::Data::RawData::RawData | ( | uint64_bt | numBytes | ) |
Ctor.
Constructs a RawData object by allocating memory
| Tonido::Data::RawData::RawData | ( | const std::string & | a_fileName | ) |
Ctor.
Constructs a RawData object by loading it from a file
| Tonido::Data::RawData::~RawData | ( | ) |
Dtor.
Details if needed
| unsigned char * Tonido::Data::RawData::getRawData | ( | ) | const |
Returns the pointer to the actual allocated memory block.
| uint64_bt Tonido::Data::RawData::getRemainingBytes | ( | ) | const |
Returns the number of bytes left from the current read/write location.
| uint64_bt Tonido::Data::RawData::getTotalBytes | ( | ) | const |
Returns the total number of bytes in the memory block.
| bool Tonido::Data::RawData::readData | ( | unsigned char * | a_in, |
| uint64_bt | numBytes | ||
| ) |
Reads data into the given pointer upto numBytes.
| [in] | a_in | pointer to data |
| [in] | numBytes | number of bytes to read |
| bool Tonido::Data::RawData::reset | ( | ) |
reset
Returns the current read/write location back to the beginning of the block
| bool Tonido::Data::RawData::writeFile | ( | const std::string & | a_fileName | ) |
Writes the given raw data to a file.