C++ Based OPC UA Client/Server SDK  1.5.5.355
UaStructureField Class Reference

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...
 
UaStructureFieldoperator= (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)
 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 setArrayType (ArrayType arrayType)
 Sets the array type. More...
 
ArrayType arrayType () const
 Returns the array type. 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...
 

Static Public Member Functions

static OpcUa_BuiltInType builtInTypeFromDataTypeId (const UaNodeId &dataTypeId, UaDataTypeDictionary *pDataTypeDictionary=NULL)
 Returns the ValueType that is specified by a DataType. More...
 

Detailed Description

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

  • Built-in data types without ExtensionObject (see structure)
    There are 24 so called built-in types like Boolean, Float, UInt32 or String. For these data types, the numeric part of the DataType NodeId matches the built-in type number. Such a built-in type can be set with setValueType(). The member DataTypeId is set automatically. If setDataTypeId() is used, the ValueType is set automtically.
  • Structure data types
    A structure data type can be set with setStructureDefinition(). The ValueType (built-in type = ExtensionObject) and the DataTypeId members are set automatically
  • Enumeration data type
    An enumeration data type can be set with setEnumDefinition(). The ValueType (built-in type = Int32) and the DataTypeId members are set automatically
  • Data type derived from built-in types
    An example is UtcTime with is derived from built-in data type DateTime. In this case the DataTypeId (UtcTime) must be set with setDataTypeId() and the built-in type (DateTime) must be set with setValueType()

Additional setting for a field have default values. These additional settings are

Constructor & Destructor Documentation

UaStructureField::~UaStructureField ( )
virtual

Destruction.

Member Function Documentation

UaStructureField::ArrayType UaStructureField::arrayType ( ) const

Returns the array type.

OpcUa_BuiltInType UaStructureField::builtInTypeFromDataTypeId ( const UaNodeId dataTypeId,
UaDataTypeDictionary pDataTypeDictionary = NULL 
)
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.

Parameters
dataTypeIdNodeId of the requested data type
pDataTypeDictionaryIf 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.

UaString UaStructureField::name ( ) const

Returns the name of the structure field.

UaStructureField & UaStructureField::operator= ( const UaStructureField other)

Assignment.

void UaStructureField::setArrayType ( UaStructureField::ArrayType  arrayType)

Sets the array type.

void UaStructureField::setDataTypeId ( const UaNodeId dataTypeId)

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.

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.

Parameters
bOptionalThe field is set to optional if 'true'
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.

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_BuiltInType UaStructureField::valueType ( ) const

Returns the ValueType.


The documentation for this class was generated from the following files: