Open Lighting Architecture
0.9.4
|
A FieldDescriptor that consists of a group of FieldDescriptors. Groups can vary in size two ways. First, the group may contain a field which itself is of variable size (i.e. a string or another group). This type of message structure requires some other data in the message itself to indicate the field/group length and as such isn't supported.
An example of this type of group would be:
+-------------—+ | bool (1) | +-------------—+ | string (0, 32) | +-------------—+
This could hold data like: (true, "foo"), (false, "bar)
The second (and simpler) type is where the group size is fixed (i.e. contains only fixed length fields) and the number of times the group appears in the message varies. By knowing the length of the message we can work out the number of times a group occurs (see VariableFieldSizeCalculator.h which does this).
An example of this type of group would be:
+-------------—+ | bool (1) | +-------------—+ | uint16 (2) | +-------------—+
This could hold data like: (true, 1000), (false, 34)
DescriptorConsistencyChecker.h checks that a descriptor is the second type, that is contains at most one variable-sized field.
We refer to the datatypes within a group as fields, the actual instantiations of a group as blocks. In the examples above, bool, string and uint16 are the fields (represented by FieldDescriptorInterface objects) and (true, "foo") & (true, 1000) are the blocks.
Public Member Functions | |
FieldDescriptorGroup (const std::string &name, const std::vector< const FieldDescriptor * > &fields, uint16_t min_blocks, int16_t max_blocks) | |
bool | FixedSize () const |
bool | LimitedSize () const |
unsigned int | MaxSize () const |
unsigned int | FieldCount () const |
bool | FixedBlockSize () const |
unsigned int | BlockSize () const |
unsigned int | MaxBlockSize () const |
uint16_t | MinBlocks () const |
int16_t | MaxBlocks () const |
bool | FixedBlockCount () const |
class FieldDescriptor * | GetField (unsigned int index) const |
virtual void | Accept (FieldDescriptorVisitor *visitor) const |
Public Member Functions inherited from ola::messaging::FieldDescriptor | |
FieldDescriptor (const std::string &name) | |
const std::string & | Name () const |
Static Public Attributes | |
static const int16_t | UNLIMITED_BLOCKS = -1 |
Protected Attributes | |
std::vector< const class FieldDescriptor * > | m_fields |