![]() |
GemaCoreLib
The GeMA Core library
|
A class used for storing and managing the order of the value sets inside a pack. More...
#include <gmPackedBuffer.h>

Public Member Functions | |
| GmPackedBufferInfo (int id) | |
| Basic constructor. Gets as parameter the pack id. | |
| int | id () const |
| Returns the pack id. | |
| void | addValueSet (GmValueSet *vs) |
| Adds a new value set to the pack. It will be effectivelly added on the next call to update(). | |
| void | update (QVector< int > *newSetIndices=NULL) |
| Updates the pack with the set of added value sets. If newsetIndices is different from NULL, it will be filled with the set of indices in the pack of the newly added value sets. The list order follows the add order. | |
| bool | ready () const |
| Returns true if there are no pending calls to update() | |
| void | removeValueSet (int index) |
| Imediately removes the given value set from the pack, identified by its current index in the pack. Returns false if not found. | |
| bool | removePendingValueSet (GmValueSet *vs) |
| Removes a value set from the pack BEFORE the call to update() that would effectively add it to it. If called with a vs not present on the layout waiting list, does nothing. | |
| int | numSets () const |
| Returns the number of value sets in the pack. | |
| int | vsIndex (QString id) const |
| Returns the value set index inside the pack or -1 if not found. | |
| GmValueSet * | vs (int index) const |
| Returns the value set object at the given index. | |
| int | offset (int index) const |
| Returns the data offset(in bytes) for the begining of the data from the value set at the given index. If called with index equal to numSets(), returns the sum of each value set size. | |
| int | size (int index) const |
| The size in bytes used by the value set at the given index (accounts for multiple states and multi-dimensional values) | |
| int | stride () const |
| Returns the buffer stride (sum of each value set size + padding) | |
| void | notifyLayoutUpdates () |
| Notifies every attached value set that the layout has changed. | |
| void | clearWaitingList () |
| Clears the set of added value sets after the object creation / last call to update() | |
Private Member Functions | |
| void | updateControlFromPos (int pos) |
| Helper function to update _map, _offset, _padding and _stride given already made changes in _sets starting at the given position (meaning that value sets before that position are exactly the same and at the same position as before) | |
| int | sizeofVsStorageType (const GmValueSet *vs) const |
| Returns the storage size for a value set taking into account funstion storage possibility. | |
Private Attributes | |
| int | _id |
| The pack buffer id. Used for consistency check of the added value sets. | |
| QMap< QString, int > | _map |
| A map from value set Id to its position inside _sets. | |
| QVector< GmValueSet * > | _sets |
| The ordered list of value sets for this pack. | |
| QVector< int > | _offset |
| The offset of each value set in the pack. Its size is equal to _sets.size() + 1. The last entry stores the sum of the set sizes. | |
| int | _padding |
| The padding to ensure proper alignment when working with heterogeneous data types. | |
| int | _stride |
| The sum of the set sizes + padding. | |
| QVector< GmValueSet * > | _waitingSets |
| The set of value sets that where not yet added to _map, _sets and _offset. | |
A class used for storing and managing the order of the value sets inside a pack.
The internal order of the value sets in the buffer follows the order in which value sets where added to the pack, unless we have value sets storing non double values. In that case, value sets are ordered by decreasing size of their data "sizeof" (keeping the add order inside each size) and padded at the end to guarantee proper alignment for the greatest size. If a value set has a fixed number of states, they are kept side by side at the buffer. Value sets with an unlimited number of states can not belong to a pack.
If a value set can store functions, its data type is ignored and the storage type assumed to be double. This is aligned with storing function values in a NAN box.
Example:
Layout: | Attr1 | Attr2.1 | Attr2.2 | Attr2.3 | Attr5.1 | Attr 5.2 | Attr3 | Attr4.1 | Attr 4.2 | Padding | offset: 0 8 16 24 32 48 64 76 77 78 80