Enumerations

This page documents the enumerations provided by the C++ framework headers. Enumerations defined in your model files (enums.json) are generated into datalayer.h and — when ENABLE_FMT is set — get fmt::formatter<> specializations in formatter.h.

Framework Enumerations

RangeCheck

Returned by DataLayer::Detail::checkValue() and propagated through DataLayer::DataPoint::set(), DataLayer::GroupDataPointMapping::setDatapoint(), and DataLayer::Dispatcher::setDatapoint() to report the outcome of a range validation.

enum class DataLayer::Detail::RangeCheck : std::uint8_t

Values:

enumerator underflow
enumerator overflow
enumerator ok
enumerator notChecked

PersistenceType

Specifies how an entire group is persisted. Set in groups.json via the "persistence" key and embedded as a constexpr field in DataLayer::GroupInfo.

enum class DataLayer::PersistenceType : uint8_t

Values:

enumerator None
enumerator Cyclic
enumerator OnWrite

SerializationError

Returned inside SerializationStatus by Deserialization::read() to describe which version mismatch (if any) was detected during deserialization.

enum class SerializationError : uint8_t

Values:

enumerator None
enumerator GroupVersion
enumerator DatapointVersion
enumerator GroupAndDatapointVersion
enumerator NotAllBytesRead

Model-Defined Enumerations

Enumerations defined in your enums.json model file are generated into datalayer.h. Two styles are supported:

Auto-ID — values are assigned sequentially starting at 0:

{
  "name": "Status",
  "type": "uint32_t",
  "values": ["Booting", "Starting", "Finished"],
  "autoId": true
}

Explicit values — each entry is a { "name": value } object:

{
  "name": "ErrorStates",
  "type": "uint32_t",
  "values": [
    { "None": 0 }, { "Info": 1 }, { "Warn": 4 },
    { "Error": 5 }, { "Critical": 9 }, { "Fatal": 10 }
  ],
  "autoId": false
}

When ENABLE_FMT is set the generator outputs a fmt::formatter<ErrorStates> specialization in formatter.h so that enum values can be printed directly with fmt::print.

See Model File Reference for the full model file reference.