#include <PackBuf.h>
Public Methods | |
| PackBuffer (int size_=1024) | |
| Constructor, which allows the default buffer size to be set. | |
| ~PackBuffer () | |
| Desctructor. | |
| const char * | buf () |
| Returns a pointer to the internal buffer that has been packed. | |
| int | len () |
| The number of bytes of packed data. | |
| void | reset () |
| Resets the buffer index in order to reuse the internal buffer. | |
| void | pack (const int *data, const int num=1) |
| Pack one or more int's. | |
| void | pack (const unsigned_int *data, const int num=1) |
| Pack one or more unsigned int's. | |
| void | pack (const long *data, const int num=1) |
| Pack one or more long's. | |
| void | pack (const unsigned_long *data, const int num=1) |
| Pack one or more unsigned long's. | |
| void | pack (const short *data, const int num=1) |
| Pack one or more short's. | |
| void | pack (const unsigned_short *data, const int num=1) |
| Pack one or more unsigned short's. | |
| void | pack (const char *data, const int num=1) |
| Pack one or more char's. | |
| void | pack (const unsigned_char *data, const int num=1) |
| Pack one or more unsigned char's. | |
| void | pack (const double *data, const int num=1) |
| Pack one or more double's. | |
| void | pack (const float *data, const int num=1) |
| Pack one or more float's. | |
| void | pack (const bool *data, const int num=1) |
| Pack one or more bool's. | |
| void | pack (const int data) |
| Pack a int. | |
| void | pack (const unsigned_int data) |
| Pack a unsigned int. | |
| void | pack (const long data) |
| Pack a long. | |
| void | pack (const unsigned_long data) |
| Pack a unsigned long. | |
| void | pack (const short data) |
| Pack a short. | |
| void | pack (const unsigned_short data) |
| Pack a unsigned short. | |
| void | pack (const char data) |
| Pack a char. | |
| void | pack (const unsigned_char data) |
| Pack a unsigned char. | |
| void | pack (const double data) |
| Pack a double. | |
| void | pack (const float data) |
| Pack a float. | |
| void | pack (const bool data) |
| Pack a bool. | |
Protected Methods | |
| void | resize (const int newsize) |
| Resizes the internal buffer. | |
Protected Attributes | |
| char * | buffer |
| The internal buffer for packing. | |
| int | index |
| The index into the current buffer. | |
| int | size |
| The total size that has been allocated for the buffer. | |
The PackBuffer class dynamically resizes the internal buffer to contain enough memory to pack the entire object. When deleted, the PackBuffer object deletes this internal buffer.