GemaCoreLib
The GeMA Core library
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
GmStateDumpBaseDataItem Class Reference

Ensure that all dump items stored by GmStateDump have an id() and a logger. More...

#include <gmStateDumpItem.h>

Inheritance diagram for GmStateDumpBaseDataItem:
Inheritance graph
[legend]
Collaboration diagram for GmStateDumpBaseDataItem:
Collaboration graph
[legend]

Public Member Functions

 GmStateDumpBaseDataItem (int id, QString prefix, const GmLogCategory &logger)
 Constructor.
 
int id ()
 Returns the internal dump item id.
 
virtual int itemSize () const
 The item size needed for calculating sizes and offsets in bytes for partial updates. Includes the dimension.
 
virtual QString itemName () const
 Returns the default item name composed of the object prefix + '_' + the object id, optionally followed by '_' + the name suffix (if nameSuffix returns a string different from "")
 
- Public Member Functions inherited from GmMemoryDumpItem
virtual ~GmMemoryDumpItem ()
 Virtual destructor.
 
virtual int itemType () const =0
 Returns the item type.
 
virtual bool canCompress () const =0
 Should this item be compressed if the MemoryDump object is configured with compression?
 
virtual bool partialOp () const =0
 Does this item supports partial load / save operations?
 
virtual bool fixedSize () const =0
 Is this dump item a fixed size item that probably won't grow in the future? If so, extra space will NOT be reserved on file for growing even if growing is configured on the memory dump object.
 
virtual bool opStart (int op)
 Function called by GmMemoryDump::load(), GmMemoryDump::save(), GmMemoryDump::loadItem() and GmMemoryDump::saveItem() to indicate that a load (op == 1) or save (op == 0) operation on this item will begin. More...
 
virtual bool opEnd (int op)
 Function called by GmMemoryDump::load(), GmMemoryDump::save(), GmMemoryDump::loadItem() and GmMemoryDump::saveItem() to indicate that a load (op == 1) or save (op == 0) operation was completed succesfully (it won't be called if the operation failed). More...
 
virtual qint64 size () const =0
 Returns the current item size (in bytes)
 
virtual bool fillDataHeader (char *header)=0
 Function called together with getDataBuffer() to provide a "header information" with fixed size (equal to GM_MEMORY_DUMP_ITEM_DATA_SIZE) that is also saved for the dump item. This information is then made available when setDataBuffer() is called. More...
 
virtual void getDataBuffer (GmMemoryBufferList &bufferList, qint64 size=0, qint64 offset=0)=0
 Fills the provided bufferList object with the set of buffers that together define the dump item data. More...
 
virtual bool setDataBuffer (GmMemoryBufferList &bufferList, const char *header, qint64 size, qint64 offset=0)=0
 Fills the provided bufferList object with the set of buffers that should be used to update the dump item data. More...
 
virtual void bufferReleased (int op, bool ok)
 Function called once after a call to getDataBuffer() / setDataBuffer() to inform the item data that the returned buffer will not be used anymore by the memory dump object. More...
 

Protected Member Functions

virtual QString nameSuffix () const
 Virtual method returning the extra part of the item name, added to its standard prefix.
 

Protected Attributes

int _id
 The object id.
 
QString _prefix
 The object name prefix.
 
const GmLogCategory_logger
 Basic logger object for dump messages.
 

Detailed Description

Ensure that all dump items stored by GmStateDump have an id() and a logger.

The id should be unique for this state item within a group. By enforcing this rule and making sure that every item name includes the id at its begining, we can be sure that each item name will be unique inside its group, even if the complete name ends up being truncated due to name size limitations. For this to be true, it is necessary that the given prefix concatenated with the id to be smaller than the name size limit, which should not be a problem.


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