Data packing class
![]() | CAVERNplus_datapack_c (char *buff, int sz) User must specify a pre-allocated data buffer and size of the buffer. |
![]() | getBuffer () Retrieve the data buffer. |
![]() | getBufferFilledSize () Retrieve the size of the data buffer that has been packed with data so far. |
![]() | getBufferMaxSize () Retrieve the original full size of the data buffer. |
![]() | pack (char *buf, int sz) Raw char* |
![]() | packChar (char val) Char |
![]() | packDouble (double val) Double |
![]() | packFloat (float val) Floats |
![]() | packInt (int val) Int |
![]() | packLong (long val) Long |
![]() | restart () Reset the packing position to the beginning of the buffer. |
![]() | setBuffer (char *buff, int sz) User can switch data buffers. But again you need to specify the size. |
![]() | unpack (char *buf, int sz) Char* |
![]() | unpackChar () Char |
![]() | unpackDouble () Double |
![]() | unpackFloat () Float |
![]() | unpackInt () Int |
![]() | unpackLong () Long |
Data packing class. It is basically a glorified memcpy(). The idea is that you create an object to help you pack data for transmission over networks.First you create a CAVERNplus_datapack_c object. Then assign it a pre-allocated memory buffer. Then using the various pack*() member functions, you can pack integers, characters, floats etc into the buffer. When done you can simply assign the buffer to whatever call needs the buffer.
Similarly if you receive a buffer of data from the network, you can unpack its constituent components using the unpack*() member functions. Note: this class does not save the format of your packing or unpacking it simply lays out your data in the buffer you provide it. You must pack things and unpack things in the same order in order for them to make sense.
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de