Struct types define the fields (names and value types, as well as optional default values) of Structs with a name matching that of the Struct type. More...
Struct types define the fields (names and value types, as well as optional default values) of Structs with a name matching that of the Struct type.
A Struct type contains a String-type name, a list of field names (list of Strings), a list of field types (list of Type objects), and an optional list of Default values (list of Base objects). The Struct types should be added to the Type manager to be used for Struct validation on creation. Alternatively, if a Struct is created with no matching Struct type in the manager, a default Struct type is created based on the field names and types of the Created struct. Said Struct type is then added to the manager.
The field types are a list of Type objects. These determine the types of values that should be used to fill in the corresponding field value. The Type objects at the moment available in openDAQ are Simple types and Struct types. When adding any field other than a Struct type, the Simple type corresponding to the Core type of the value should be created. When adding Struct fields, a Struct type should be added to the field types.
A Struct can only have fields of Core type: ctBool
, ctInt
, ctFloat
, ctString
, ctList
, ctDict
, ctRatio
, ctComplexNumber
, ctStruct
, ctEnumeration
, or ctUndefined
. Additionally, all Container types (ctList
, ctDict
) should only have values of the aforementioned types.
Public Member Functions | |
ListPtr< IString > | getFieldNames () const |
Gets the list of field names. More... | |
ListPtr< IBaseObject > | getFieldDefaultValues () const |
Gets the list of field default values. More... | |
ListPtr< IType > | getFieldTypes () const |
Gets the list of field types. More... | |
![]() | |
StringPtr | getName () const |
Gets the name of the Type. More... | |
|
inline |
Gets the list of field default values.
Gets the list of field names.