DUECA/DUSIME
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dueca::AmorphReStore Class Reference

Class to unpack objects packed by an AmorphStore. More...

#include <AmorphStore.hxx>

Public Member Functions

 AmorphReStore ()
 constructor for a store without memory, this store must be given a buffer (with acceptBuffer) before it can be used.
 
 AmorphReStore (const char *store, unsigned capacity)
 constructor for a restore object with an initial restore area, with memory borrowed somewhere else.
 
 AmorphReStore (const std::string &store, unsigned size)
 Constructor using a string; compatibility with changes in Snapshot.
 
 ~AmorphReStore ()
 Destructor.
 
const chardata ()
 Get to the actual data; not to be mis-used!
 
void acceptBuffer (const char *store, unsigned capacity)
 This (re-) initialises a store with borrowed memory.
 
const unsigned getSize () const
 Query how much data (in bytes) is left in the store.
 
const unsigned getFillLevel () const
 Query the current total size of the store.
 
const unsigned getFree () const
 Query the additional capacity still available.
 
void reUse (unsigned size)
 Tell the AmorphReStore that the data has been refreshed.
 
void extend (unsigned size)
 Tell the AmorphReStore that data has been added to the end of the buffer.
 
const unsigned getIndex () const
 Get the index (where we are reading).
 
void setIndex (unsigned p_index)
 Set the index, use with extreme caution.
 
bool isExhausted () const
 See if the data has all been taken out.
 
void setExhausted ()
 Pretend that the data has all been taken out.
 
unsigned gobble ()
 Read a mark, and eat away the size of the mark.
 
unsigned gobbleBig ()
 Read a big mark, and eat away the size of the mark.
 
unsigned gobbleBigMark ()
 Eat away the big mark itself.
 
unsigned peekBigMark ()
 Have a peek at the big mark, without actually updating the index.
 
uint16_t peekMark ()
 Have a peek at the normal mark, without updating the index.
 
 AmorphReStore (const AmorphReStore &s)
 Copy constructor. Should not be used.
 
void unPackData (float &f)
 Unpack a float.
 
void unPackData (double &d)
 Unpack a double.
 
 operator double ()
 Create a double from this AmorphReStore.
 
 operator float ()
 Create a float from this AmorphReStore.
 
void unPackData (char &i)
 Unpack a char.
 
void unPackData (int8_t &i)
 Unpack an int8_t.
 
void unPackData (int16_t &i)
 Unpack an int16_t.
 
void unPackData (int32_t &i)
 Unpack an int32_t.
 
void unPackData (int64_t &i)
 Unpack an int64_t.
 
 operator char ()
 Create a char from this AmorphReStore.
 
 operator int8_t ()
 Create an int8_t from this AmorphReStore.
 
 operator int16_t ()
 Create an int16_t from this AmorphReStore.
 
 operator int32_t ()
 Create an int32_t from this AmorphReStore.
 
 operator int64_t ()
 Create a int64_t from this AmorphReStore.
 
void unPackData (uint8_t &i)
 Unpack a uint8_t.
 
void unPackData (uint16_t &i)
 Unpack a uint16_t.
 
void unPackData (uint32_t &i)
 Unpack a uint32_t.
 
void unPackData (uint64_t &i)
 Unpack a uint64_t.
 
 operator uint8_t ()
 Create a uint8_t from this AmorphReStore.
 
 operator uint16_t ()
 Create a uint16_t from this AmorphReStore.
 
 operator uint32_t ()
 Create a uint32_t from this AmorphReStore.
 
 operator uint64_t ()
 Create a uint64_t from this AmorphReStore.
 
void unPackData (bool &b)
 Unpack a bool.
 
void unPackData (vstring &i)
 Unpack a variable length string.
 
 operator bool ()
 Create a bool from this AmorphReStore.
 
 operator vstring ()
 Create a variable length string from this AmorphReStore.
 
void unPackData (char *c, const unsigned length)
 Unpack a c-string, you supply the length.
 
void unPackData (char *&c)
 Unpack a 0-terminated c string.
 
void unPackData (timeval &tv)
 Unpack a timeval.
 
 operator timeval ()
 Create a timeval from an amorph store.
 
ostreamprint (ostream &o) const
 Print to stream, for debugging purposes.
 

Detailed Description

Class to unpack objects packed by an AmorphStore.

This data was usually packed for transport over a network. This is commonly used within DUECA. One application-level use is common, in combination with Snapshot handling.

Constructor & Destructor Documentation

◆ AmorphReStore() [1/2]

dueca::AmorphReStore::AmorphReStore ( const char * store,
unsigned capacity )

constructor for a restore object with an initial restore area, with memory borrowed somewhere else.

Parameters
storeStorage area with data to unpack.
capacityAmount of data, in bytes, in this area. The store array must be >= capacity.

◆ AmorphReStore() [2/2]

dueca::AmorphReStore::AmorphReStore ( const std::string & store,
unsigned size )

Constructor using a string; compatibility with changes in Snapshot.

Parameters
storeStorage area
sizeAmount of data available.

Member Function Documentation

◆ acceptBuffer()

void dueca::AmorphReStore::acceptBuffer ( const char * store,
unsigned capacity )

This (re-) initialises a store with borrowed memory.

Parameters
storeStorage area with data to unpack.
capacityAmount of data, in bytes, in this area. The store array must be >= capacity.

◆ reUse()

void dueca::AmorphReStore::reUse ( unsigned size)
inline

Tell the AmorphReStore that the data has been refreshed.

Parameters
sizeAmount of data now available.

◆ extend()

void dueca::AmorphReStore::extend ( unsigned size)
inline

Tell the AmorphReStore that data has been added to the end of the buffer.

Parameters
sizeAmount of data added.

◆ gobble()

unsigned dueca::AmorphReStore::gobble ( )

Read a mark, and eat away the size of the mark.

Usually done for data that is not meant for this node.

◆ gobbleBig()

unsigned dueca::AmorphReStore::gobbleBig ( )

Read a big mark, and eat away the size of the mark.

Usually done for data that is not meant for this node.


The documentation for this class was generated from the following file: