C++ Based OPC UA Client/Server/PubSub SDK
1.7.9.586
|
This class describes a field of a structure data type represented by UaStructureDefinition. More...
#include <uastructurefield.h>
Public Member Functions | |
UaStructureField () | |
Constructor. | |
UaStructureField (const UaStructureField &other) | |
Copy constructor. | |
virtual | ~UaStructureField () |
Destruction. More... | |
UaStructureField & | operator= (const UaStructureField &other) |
Assignment. More... | |
bool | isNull () |
Returns true if the name is empty. More... | |
void | setName (const UaString &sName) |
Sets the name of the structure field. More... | |
UaString | name () const |
Returns the name of the structure field. More... | |
void | setDocumentation (const UaLocalizedText &sDocumentation) |
Sets the documentation of the structure field. More... | |
UaLocalizedText | documentation () const |
Returns the documentation of the structure field. More... | |
void | setDataTypeId (const UaNodeId &dataTypeId, UaDataTypeDictionary *pDataTypeDictionary=NULL) |
Sets the DataTypeId (NodeId of the data type). More... | |
UaNodeId | typeId () const |
Returns the DataTypeId. | |
void | setValueType (OpcUa_BuiltInType type) |
Sets the ValueType (built-in type). More... | |
OpcUa_BuiltInType | valueType () const |
Returns the ValueType. More... | |
void | setEnumDefinition (const UaEnumDefinition &newEnumDefinition) |
Sets the EnumDefinition, the DataTypeId, and the ValueType. More... | |
UaEnumDefinition | enumDefinition () const |
Returns the UaEnumDefinition of the field. More... | |
void | setStructureDefinition (const UaStructureDefinition &newStructureDefinition) |
Sets the StructureDefinition, the DataTypeId and the ValueType. More... | |
UaStructureDefinition | structureDefinition () const |
Returns the UaStructureDefinition of the field. More... | |
void | setOptionSetDefinition (const UaOptionSetDefinition &newOptionSetDefinition) |
Sets the UaOptionSetDefinition, the TypeId and the ValueType. More... | |
UaOptionSetDefinition | optionSetDefinition () const |
Returns the UaOptionSetDefinition of the field. More... | |
void | setArrayType (ArrayType arrayType) |
Sets the ArrayType and the ValueRank. More... | |
ArrayType | arrayType () const |
Returns the array type. More... | |
UaStatus | setValueRank (OpcUa_Int32 valueRank) |
Sets the ValueRank and ArrayType. More... | |
OpcUa_Int32 | valueRank () const |
Returns the ValueRank. More... | |
void | setArrayDimensions (const UaUInt32Array &arrayDimensions) |
Sets the ArrayDimensions. | |
UaUInt32Array | arrayDimensions () const |
Returns the ArrayDimensions. More... | |
void | setMaxStringLength (OpcUa_UInt32 maxStringLength) |
Sets the MaxStringLength. | |
OpcUa_UInt32 | maxStringLength () const |
Returns the MaxStringLength. More... | |
void | setSourceType (const UaStructureDefinition &parent) |
Sets the UaStructureDefinition which defines this field. More... | |
UaStructureDefinition | sourceType () const |
Returns the source type. More... | |
bool | isOptional () const |
Returns 'true' if the field is optional. | |
void | setOptional (bool bOptional) |
Specifies whether the field is optional. More... | |
bool | allowSubtypes () const |
Returns 'true' if values for this field can contain subtypes of the datatype defined for this field. | |
void | setAllowSubtypes (bool bAllowSubtypes) |
Specifies whether values for this field can be subtypes of the datatype defined for this field. More... | |
Static Public Member Functions | |
static OpcUa_BuiltInType | builtInTypeFromDataTypeId (const UaNodeId &dataTypeId, UaDataTypeDictionary *pDataTypeDictionary=NULL) |
Returns the ValueType that is specified by a DataType. More... | |
This class describes a field of a structure data type represented by UaStructureDefinition.
The minimum settings for a field in a structure are
OPC UA supports different kind of data types. The following options are available for setting the data type
Additional setting for a field have default values. These additional settings are
|
virtual |
Destruction.
UaUInt32Array UaStructureField::arrayDimensions | ( | ) | const |
Returns the ArrayDimensions.
UaStructureField::ArrayType UaStructureField::arrayType | ( | ) | const |
Returns the array type.
|
static |
Returns the ValueType that is specified by a DataType.
Returns valid values for DataTypes with NamespaceIndex = 0 and Indentifier < 26, and for Enumerations or Structures that are defined in the pDataTypeDictionary.
dataTypeId | NodeId of the requested data type |
pDataTypeDictionary | If NULL, only DataTypes with NamespaceIndex = 0 and Indetifier < 26 will return a valid ValueType. |
UaLocalizedText UaStructureField::documentation | ( | ) | const |
Returns the documentation of the structure field.
UaEnumDefinition UaStructureField::enumDefinition | ( | ) | const |
Returns the UaEnumDefinition of the field.
If the enum definintion has not been set, an empty UaEnumDefinition is returned.
bool UaStructureField::isNull | ( | ) |
Returns true if the name is empty.
OpcUa_UInt32 UaStructureField::maxStringLength | ( | ) | const |
Returns the MaxStringLength.
UaString UaStructureField::name | ( | ) | const |
Returns the name of the structure field.
UaStructureField & UaStructureField::operator= | ( | const UaStructureField & | other | ) |
Assignment.
UaOptionSetDefinition UaStructureField::optionSetDefinition | ( | ) | const |
Returns the UaOptionSetDefinition of the field.
If the OptionSet definintion has not been set, an empty UaOptionSetDefinition is returned.
void UaStructureField::setAllowSubtypes | ( | bool | bAllowSubtypes | ) |
Specifies whether values for this field can be subtypes of the datatype defined for this field.
Can only be set if the StructureType is StructureWithSubtypedValues or UnionWithSubtypedValues. Can not be combined with optional. Setting this flag will be encoded as optional.
bAllowSubtypes | The field is set to AllowSubtypes 'true' |
void UaStructureField::setArrayType | ( | UaStructureField::ArrayType | arrayType | ) |
Sets the ArrayType and the ValueRank.
For ArrayType Matrix, the ValueRank is set to 2. For another ValueRank, the ValueRank must be set instead. Setting the ValueRank sets also the ArrayType.
void UaStructureField::setDataTypeId | ( | const UaNodeId & | dataTypeId, |
UaDataTypeDictionary * | pDataTypeDictionary = NULL |
||
) |
Sets the DataTypeId (NodeId of the data type).
If this method is called with the NodeId of a built-in data type (NamespaceIndex = 0 and Identifier < 26), and the ValueType (built-in type) is not set (setValueType()), the ValueType is set automatically. For most cases, this requires the optional pDataTypeDictionary parameter. If the ValueType cannot be determined, it is set to OpcUaType_Null.
If the data type is a structure or enumeration, the methods setStructureDefinition() or setEnumDefinition() must be used. The DataType and ValueType (built-in type) are set automatically by these methods.
If the data type is a type derived from one of the built-in types like UtcTime derived from DateTime, the DataTypeId (UtcTime) must be set with setDataTypeId() and the built-in type (DateTime) must be set with setValueType()
void UaStructureField::setDocumentation | ( | const UaLocalizedText & | documentation | ) |
Sets the documentation of the structure field.
void UaStructureField::setEnumDefinition | ( | const UaEnumDefinition & | newEnumDefinition | ) |
Sets the EnumDefinition, the DataTypeId, and the ValueType.
The built-in type (Int32) and the DataTypeId members are set automatically with this method.
void UaStructureField::setName | ( | const UaString & | sName | ) |
Sets the name of the structure field.
void UaStructureField::setOptional | ( | bool | bOptional | ) |
Specifies whether the field is optional.
Fields that are children of unions must not be optional.
bOptional | The field is set to optional if 'true' |
void UaStructureField::setOptionSetDefinition | ( | const UaOptionSetDefinition & | newOptionSetDefinition | ) |
Sets the UaOptionSetDefinition, the TypeId and the ValueType.
The built-in type (ValueType) and the TypeId members are set automatically with this method.
void UaStructureField::setSourceType | ( | const UaStructureDefinition & | parent | ) |
Sets the UaStructureDefinition which defines this field.
If a structured DataType is derived from another structured DataType, the derived type inherits all fields of the base type. Using this method, a link to the base type which declares the field is created for an inherited field.
This method should only be called by UaStructureDefinition::createSubtype.
void UaStructureField::setStructureDefinition | ( | const UaStructureDefinition & | newStructureDefinition | ) |
Sets the StructureDefinition, the DataTypeId and the ValueType.
The built-in type (ExtensionObject) and the DataTypeId members are set automatically with this method.
UaStatus UaStructureField::setValueRank | ( | OpcUa_Int32 | valueRank | ) |
Sets the ValueRank and ArrayType.
Valid values are -1 for ArrayType Scalar, 1 for ArrayType Array and values > 1 for ArrayType Matrix. For other values the method returns an errro and the value is not changed.
void UaStructureField::setValueType | ( | OpcUa_BuiltInType | type | ) |
Sets the ValueType (built-in type).
If this method is called and the DataType NodeId (setDataTypeId()) is not set, the DataType NodeId is set automatically.
If the data type is a structure or enumeration, the methods setStructureDefinition() or setEnumDefinition() must be used. The DataType and ValueType (built-in type) are set automatically by these methods.
If the data type is a type derived from one of the built-in types like UtcTime derived from DateTime, the DataTypeId (UtcTime) must be set with setDataTypeId() and the built-in type (DateTime) must be set with setValueType()
UaStructureDefinition UaStructureField::sourceType | ( | ) | const |
Returns the source type.
The source type is the supertype of the UaStructureDefinition which originally declared the field.
UaStructureDefinition UaStructureField::structureDefinition | ( | ) | const |
Returns the UaStructureDefinition of the field.
If the structure definintion has not been set, an empty UaStructureDefinition is returned.
OpcUa_Int32 UaStructureField::valueRank | ( | ) | const |
Returns the ValueRank.
OpcUa_BuiltInType UaStructureField::valueType | ( | ) | const |
Returns the ValueType.