|
| DataPieceEnum (const string &label) |
|
| DataPieceEnum (const string &label, EnumType defaultValue) |
|
EnumType | get () const |
|
bool | get (EnumType &e) const |
|
bool | set (const EnumType e) |
|
EnumType | getDefault () const |
|
bool | getDefault (EnumType &outDefault) const |
|
void | setDefault (const EnumType defaultValue) |
|
| DataPieceValue (const string &label) |
|
| DataPieceValue (const string &label, StorageType defaultValue) |
|
| DataPieceValue (const MakerBundle &bundle) |
|
const string & | getElementTypeName () const override |
|
size_t | getVariableSize () const override |
|
size_t | collectVariableData (int8_t *, size_t) override |
|
StorageType | get () const |
|
bool | get (StorageType &outValue) const |
|
bool | set (const StorageType &value) |
|
StorageType | getDefault () const |
|
bool | getDefault (StorageType &outDefault) const |
|
void | setDefault (const StorageType &defaultValue) |
|
bool | getProperty (const string &propertyName, StorageType &outValue) const |
|
void | setProperty (const string &propertyName, StorageType value) |
|
bool | getMin (StorageType &outMin) const |
|
bool | getMax (StorageType &outMax) const |
|
bool | getMinIncrement (StorageType &outMinIncrement) const |
|
bool | getMaxIncrement (StorageType &outMaxIncrement) const |
|
void | setMin (StorageType min) |
|
void | setMax (StorageType max) |
|
void | setRange (StorageType min, StorageType max) |
|
void | setMinIncrement (StorageType minIncrement) |
|
void | setMaxIncrement (StorageType maxIncrement) |
|
void | setIncrement (StorageType minIncrement, StorageType maxIncrement) |
|
bool | isAvailable () const override |
|
void | print (ostream &out, const string &indent) const override |
|
void | printCompact (ostream &out, const string &indent) const override |
|
bool | isSame (const DataPiece *rhs) const override |
|
void | serialize (JsonWrapper &jsonWrapper, const JsonFormatProfileSpec &profile) override |
|
unique_ptr< DataPiece > | clone () const override |
|
const DataLayout & | getDataLayout () const |
|
const string & | getLabel () const |
|
DataPieceType | getPieceType () const |
|
string | getTypeName () const |
|
size_t | getOffset () const |
|
bool | hasFixedSize () const |
|
size_t | getFixedSize () const |
|
bool | getTag (const string &tagName, string &outTag) const |
|
void | setTag (const string &tagName, const string &tag) |
|
bool | getUnit (string &outUnit) const |
|
void | setUnit (const string &unit) |
|
bool | getDescription (string &outDescription) const |
|
void | setDescription (const string &description) |
|
void | setRequired (bool required=true) |
|
bool | isRequired () const |
|
virtual bool | stageCurrentValue () |
|
|
bool | stageFrom (const DataPiece *) override |
| Stage value from another piece known to be of the same type.
|
|
| DataPiece (const string &label, DataPieceType type, size_t size) |
|
bool | isMatch (const DataPiece &rhs) const |
| Match signature only.
|
|
void | setOffset (size_t offset) |
|
const string | label_ |
|
const DataPieceType | pieceType_ |
|
const size_t | fixedSize_ |
|
size_t | offset_ |
|
DataLayout & | layout_ |
|
map< string, string > | tags_ |
|
bool | required_ |
|
static const string | kUnit = "unit" |
| Special tag name to specify a unit of the DataPiece.
|
|
static const string | kDescription = "description" |
| Special tag name to specify a human readable description the DataPiece.
|
|
static const string | kMinValue = "min" |
| Special property name for the minimum value of the DataPiece.
|
|
static const string | kMaxValue = "max" |
| Special property name for the maximum value of the DataPiece.
|
|
static const string | kMinIncrement = "min_increment" |
| Special property name for the minimum increment of the DataPiece.
|
|
static const string | kMaxIncrement = "max_increment" |
| Special property name for the maximum increment of the DataPiece.
|
|
template<typename EnumType, typename StorageType>
class vrs::DataPieceEnum< EnumType, StorageType >
DataPieceValue specialization class to store enums more conveniently and safely.
This DataPiece type is very light layer on top of DataPieceValue. DataPieceEnum provides automatic casting between an enum type and an explicit POD type. DataPieceEnum is safer to use, because it gives explicit control over the numeric type used to store the enum in the file format.
ATTENTION! STORING ENUM VALUES IS RISKY!
- It's very easy to change an enum definition and break compatibility with existing files. Be certain the enum's numeric values aren't changed, or shifted when the enum is modified, maybe by adding static asserts verifying enum numeric values are never changed. In particular, avoid storing enums which definition is maintained by other teams.
- The underlying type is DataPieceValue<StorageType>, therefore labels must not collide.