openDAQ
Open data acquisition platform
StructTypePtr Class Reference

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...

+ Inheritance diagram for StructTypePtr:
+ Collaboration diagram for StructTypePtr:

Detailed Description

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< IStringgetFieldNames () const
 Gets the list of field names. More...
 
ListPtr< IBaseObjectgetFieldDefaultValues () const
 Gets the list of field default values. More...
 
ListPtr< ITypegetFieldTypes () const
 Gets the list of field types. More...
 
- Public Member Functions inherited from GenericTypePtr< IStructType >
StringPtr getName () const
 Gets the name of the Type. More...
 

Member Function Documentation

◆ getFieldDefaultValues()

ListPtr<IBaseObject> getFieldDefaultValues ( ) const
inline

Gets the list of field default values.

Returns
The list of field default values (Base objects)

◆ getFieldNames()

ListPtr<IString> getFieldNames ( ) const
inline

Gets the list of field names.

Returns
The list of field names (String objects)

◆ getFieldTypes()

ListPtr<IType> getFieldTypes ( ) const
inline

Gets the list of field types.

Returns
The list of field types (Type objects)