C++ UA Server SDK
1.5.2.336
|
A class that serializes and deserializes data that is described by an UaStructureDefinition. More...
#include <uagenericstructurevalue.h>
Inherits UaAbstractGenericStructureValue.
Public Member Functions | |
UaGenericStructureValue () | |
Creates an empty UaGenericValue. More... | |
UaGenericStructureValue (const UaStructureDefinition &structureDefinition) | |
Creates a UaGenericValue with default values for each field. More... | |
UaGenericStructureValue (const UaGenericStructureValue &other) | |
Copy constructor. More... | |
UaGenericStructureValue (const UaByteString &bsData, Encoding valueEncoding, const UaStructureDefinition &structureDefinition) | |
Creates a UaGenericValue. More... | |
UaGenericStructureValue (const UaExtensionObject &extensionObject, const UaStructureDefinition &structureDefinition) | |
Parses a the binary data of an ExtenionObject and stores the data to a new UaGenericStructureValue. More... | |
virtual | ~UaGenericStructureValue () |
Desctruction. | |
virtual void | clear () |
Clears the UaGenericValue. More... | |
bool | operator== (const UaGenericStructureValue &other) const |
Compares the content of two UaGenericValues. | |
bool | operator!= (const UaGenericStructureValue &other) const |
Checks if two UaGenericValues are unequal. More... | |
UaGenericStructureValue & | operator= (const UaGenericStructureValue &other) |
Assignment operator. More... | |
OpcUa_StatusCode | setGenericValue (const UaByteString &bsData, Encoding valueEncoding, const UaStructureDefinition &structureDefinition) |
Sets a UaGenericValue. More... | |
OpcUa_StatusCode | setGenericValue (const UaExtensionObject &extensionObject, const UaStructureDefinition &structureDefinition) |
Parses a the binary data of an ExtenionObject and stores the data to a new UaGenericStructureValue. More... | |
OpcUa_StatusCode | setField (const UaString &sFieldName, UaVariant &value, OpcUa_Boolean bDetach) |
Sets the value for a structure field based on the field name. More... | |
OpcUa_StatusCode | setField (int iIndex, UaVariant &value, OpcUa_Boolean bDetach) |
Sets the value for a structure field based on the field index. More... | |
OpcUa_StatusCode | setField (const UaString &sFieldName, const UaGenericStructureValue &value) |
Sets the value for a structure field based on the field name. More... | |
OpcUa_StatusCode | setField (int iIndex, const UaGenericStructureValue &value) |
Sets the value for a structure field based on the field index. More... | |
OpcUa_StatusCode | setField (const UaString &sFieldName, const UaGenericStructureArray &values) |
Sets the value for a structure field based on the field name. More... | |
OpcUa_StatusCode | setField (int iIndex, const UaGenericStructureArray &values) |
Sets the value for a structure field based on the field index. More... | |
OpcUa_StatusCode | setField (const UaString &sFieldName, const UaGenericUnionValue &value) |
Sets the value for a structure field based on the field name. More... | |
OpcUa_StatusCode | setField (int iIndex, const UaGenericUnionValue &value) |
Sets the value for a structure field based on the field index. More... | |
OpcUa_StatusCode | setField (const UaString &sFieldName, const UaGenericUnionArray &values) |
Sets the value for a structure field based on the field name. More... | |
OpcUa_StatusCode | setField (int iIndex, const UaGenericUnionArray &values) |
Sets the value for a structure field based on the field index. More... | |
UaStructureFieldDataType | valueType (int iIndex, OpcUa_StatusCode *status=0) const |
Returns the type of the structure field value. | |
UaVariant | value (const UaString &sFieldName, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field name. More... | |
UaVariant | value (int iIndex, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field index. More... | |
UaGenericStructureValue | genericStructure (const UaString &sFieldName, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field name. More... | |
UaGenericStructureValue | genericStructure (int iIndex, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field index. More... | |
UaGenericStructureArray | genericStructureArray (const UaString &sFieldName, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field name. More... | |
UaGenericStructureArray | genericStructureArray (int iIndex, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field index. More... | |
UaGenericUnionValue | genericUnion (const UaString &sFieldName, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field name. More... | |
UaGenericUnionValue | genericUnion (int iIndex, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field index. More... | |
UaGenericUnionArray | genericUnionArray (const UaString &sFieldName, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field name. More... | |
UaGenericUnionArray | genericUnionArray (int iIndex, OpcUa_StatusCode *status=0) const |
Returns the value for a structure field based on the field index. More... | |
bool | isFieldSet (const UaString &sFieldName) const |
Checks if a structure field based on a field name is set. More... | |
bool | isFieldSet (int iIndex) const |
Checks if a structure field based on the field index is set. More... | |
OpcUa_StatusCode | unsetField (const UaString &sFieldName) |
Unsets an optional field based on a field name. More... | |
OpcUa_StatusCode | unsetField (int iIndex) |
Unsets an optional field based on a field index. More... | |
UaStructureDefinition | definition () const |
Returns the StructureDefinition of the UaGenericValue. More... | |
void | setDefinition (const UaStructureDefinition &definition, bool bCreateDefaultValues=false) |
Clears the UaGenericStructureValue and sets the structure definition. More... | |
UaString | toString () const |
Returns a string representation of the value. More... | |
void | decode (UaAbstractDecoder *pDecoder) |
Deserializing method that is used by the SDK internally. More... | |
void | encode (UaAbstractEncoder *pEncoder) const |
Serializing method that is used by the SDK internally. More... | |
Public Member Functions inherited from UaAbstractGenericValue | |
virtual void | toVariant (UaVariant &variant, Encoding valueEncoding=Encoding_Binary) const |
Serializes the UaGenericValue to the variant. More... | |
virtual void | toVariant (OpcUa_Variant &variant, Encoding valueEncoding=Encoding_Binary) const |
Serializes the UaGenericValue to the variant. More... | |
void | toDataValue (UaDataValue &dataValue, OpcUa_Boolean updateTimeStamps, Encoding valueEncoding=Encoding_Binary) const |
Serializes the UaGenericValue to the dataValue. More... | |
void | toDataValue (OpcUa_DataValue &dataValue, OpcUa_Boolean updateTimeStamps, Encoding valueEncoding=Encoding_Binary) const |
Serializes the UaGenericValue to the dataValue. More... | |
void | toExtensionObject (UaExtensionObject &extensionObject, Encoding valueEncoding=Encoding_Binary) const |
Serializes the UaGenericValue to the extensionObject. More... | |
void | toExtensionObject (OpcUa_ExtensionObject &extensionObject, Encoding valueEncoding=Encoding_Binary) const |
Serializes the UaGenericValue to the extensionObject. More... | |
Additional Inherited Members | |
Public Types inherited from UaAbstractGenericValue | |
enum | Encoding |
The possible encodings for a UaAbstractGenericValue. More... | |
Protected Member Functions inherited from UaAbstractGenericStructureValue | |
bool | checkValue (const UaStructureField &field, const UaVariant &value) const |
Checks whether value matches the DataType and ValueRank definition of field. More... | |
UaVariant | defaultValue (const UaStructureField &field) const |
Returns a value based on the DataType and the ValueRank of the field. More... | |
void | setVariantToFieldData (const UaStructureField &field, UaVariant &value, UaStructureFieldData &fieldData) const |
Detaches value. | |
Protected Member Functions inherited from UaAbstractGenericValue | |
UaStructureFieldData | readField (UaAbstractDecoder *pDecoder, const UaStructureField &field) const |
Deserializes a field. More... | |
void | writeField (UaAbstractEncoder *pEncoder, const UaStructureField &field, const UaStructureFieldData &value) const |
Serializes a field. More... | |
A class that serializes and deserializes data that is described by an UaStructureDefinition.
The serialized data can be accessed by index or by field name. The class can be used for DataTypes that are not registered to the stack.
UaGenericStructureValue::UaGenericStructureValue | ( | ) |
Creates an empty UaGenericValue.
UaGenericStructureValue::UaGenericStructureValue | ( | const UaStructureDefinition & | structureDefinition | ) |
Creates a UaGenericValue with default values for each field.
UaGenericStructureValue::UaGenericStructureValue | ( | const UaGenericStructureValue & | other | ) |
Copy constructor.
other | the UaGenericValue. |
UaGenericStructureValue::UaGenericStructureValue | ( | const UaByteString & | bsData, |
UaAbstractGenericValue::Encoding | valueEncoding, | ||
const UaStructureDefinition & | structureDefinition | ||
) |
Creates a UaGenericValue.
bsData | The content that will be serialized. |
valueEncoding | The encoding of bsData. |
structureDefinition | The definition that is used for deserializing. |
UaGenericStructureValue::UaGenericStructureValue | ( | const UaExtensionObject & | extensionObject, |
const UaStructureDefinition & | structureDefinition | ||
) |
Parses a the binary data of an ExtenionObject and stores the data to a new UaGenericStructureValue.
If the TypeId of the ExtenionObject does not match the structureDefinition, an empty UaGenericStructureValue will be created.
extensionObject | Contains the content that will be deserialized. |
structureDefinition | The definition that is used for deserializing. |
|
virtual |
Clears the UaGenericValue.
Clears all values and sets the StructureDefinition to an invalid definition.
Implements UaAbstractGenericValue.
|
virtual |
Deserializing method that is used by the SDK internally.
Implements UaAbstractGenericValue.
|
virtual |
Returns the StructureDefinition of the UaGenericValue.
Implements UaAbstractGenericStructureValue.
|
virtual |
Serializing method that is used by the SDK internally.
Implements UaAbstractGenericValue.
UaGenericStructureValue UaGenericStructureValue::genericStructure | ( | const UaString & | sFieldName, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field name.
sFieldName | Name of the structure field value to return. |
status | Is set to OpcUa_BadTypeMismatch if the DataType of the field is not a structured DataType or the array type of the field is not ArrayType_Scalar. Is set to OpcUa_BadInvalidArgument if the name is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
UaGenericStructureValue UaGenericStructureValue::genericStructure | ( | int | iIndex, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
status | Is set to OpcUa_BadTypeMismatch if the DataType of the field is not a structured DataType or the array type of the field is not ArrayType_Scalar. Is set to OpcUa_BadInvalidArgument if the index is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
UaGenericStructureArray UaGenericStructureValue::genericStructureArray | ( | const UaString & | sFieldName, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field name.
sFieldName | Name of the structure field value to return. |
status | Is set to OpcUa_BadTypeMismatch if the DataType of the field is not a structured DataType or the array type of the field is not ArrayType_Array. Is set to OpcUa_BadInvalidArgument if the name is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
UaGenericStructureArray UaGenericStructureValue::genericStructureArray | ( | int | iIndex, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
status | Is set to OpcUa_BadTypeMismatch if the DataType of the field is not a structured DataType or the array type of the field is not ArrayType_Array. Is set to OpcUa_BadInvalidArgument if the name is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
UaGenericUnionValue UaGenericStructureValue::genericUnion | ( | const UaString & | sFieldName, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field name.
sFieldName | Name of the structure field value to return. |
status | Is set to OpcUa_BadTypeMismatch if the DataType of the field is not a structured DataType or the array type of the field is not ArrayType_Scalar. Is set to OpcUa_BadInvalidArgument if the name is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
UaGenericUnionValue UaGenericStructureValue::genericUnion | ( | int | iIndex, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
status | Is set to OpcUa_BadTypeMismatch if the DataType of the field is not a structured DataType or the array type of the field is not ArrayType_Scalar. Is set to OpcUa_BadInvalidArgument if the index is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
UaGenericUnionArray UaGenericStructureValue::genericUnionArray | ( | const UaString & | sFieldName, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field name.
sFieldName | Name of the structure field value to return. |
status | Is set to OpcUa_BadTypeMismatch if the DataType of the field is not a structured DataType or the array type of the field is not ArrayType_Array. Is set to OpcUa_BadInvalidArgument if the name is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
UaGenericUnionArray UaGenericStructureValue::genericUnionArray | ( | int | iIndex, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
status | Is set to OpcUa_BadTypeMismatch if the DataType of the field is not the correct union DataType or the array type of the field is not ArrayType_Scalar. Is set to OpcUa_BadInvalidArgument if the name is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
bool UaGenericStructureValue::isFieldSet | ( | const UaString & | sFieldName | ) | const |
Checks if a structure field based on a field name is set.
sFieldName | Name of the structure field |
bool UaGenericStructureValue::isFieldSet | ( | int | iIndex | ) | const |
Checks if a structure field based on the field index is set.
iIndex | Index of the structure field |
bool UaGenericStructureValue::operator!= | ( | const UaGenericStructureValue & | other | ) | const |
Checks if two UaGenericValues are unequal.
UaGenericStructureValue & UaGenericStructureValue::operator= | ( | const UaGenericStructureValue & | other | ) |
Assignment operator.
void UaGenericStructureValue::setDefinition | ( | const UaStructureDefinition & | definition, |
bool | bCreateDefaultValues = false |
||
) |
Clears the UaGenericStructureValue and sets the structure definition.
definition | The new structure definition |
bCreateDefaultValues | If true, default values for the fields are created. If false, no fields are created. This argument shall only be set to true by decoders. If this argument is set to false, setField methods will fail. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | const UaString & | sFieldName, |
UaVariant & | value, | ||
OpcUa_Boolean | bDetach | ||
) |
Sets the value for a structure field based on the field name.
sFieldName | Name of the structure field to set. |
value | The new value for the field. |
bDetach | If true the specified field attaches value. If false value is copied to the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | int | iIndex, |
UaVariant & | value, | ||
OpcUa_Boolean | bDetach | ||
) |
Sets the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
value | The new value for the field. |
bDetach | If true the specified field attaches value. If false value is copied to the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | const UaString & | sFieldName, |
const UaGenericStructureValue & | value | ||
) |
Sets the value for a structure field based on the field name.
sFieldName | Name of the structure field to set. |
value | The new value for the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | int | iIndex, |
const UaGenericStructureValue & | value | ||
) |
Sets the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
value | The new value for the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | const UaString & | sFieldName, |
const UaGenericStructureArray & | values | ||
) |
Sets the value for a structure field based on the field name.
sFieldName | Name of the structure field to set. |
values | The new value for the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | int | iIndex, |
const UaGenericStructureArray & | values | ||
) |
Sets the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
values | The new values for the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | const UaString & | sFieldName, |
const UaGenericUnionValue & | value | ||
) |
Sets the value for a structure field based on the field name.
sFieldName | Name of the structure field to set. |
value | The new value for the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | int | iIndex, |
const UaGenericUnionValue & | value | ||
) |
Sets the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
value | The new value for the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | const UaString & | sFieldName, |
const UaGenericUnionArray & | values | ||
) |
Sets the value for a structure field based on the field name.
sFieldName | Name of the structure field to set. |
values | The new value for the field. |
OpcUa_StatusCode UaGenericStructureValue::setField | ( | int | iIndex, |
const UaGenericUnionArray & | values | ||
) |
Sets the value for a structure field based on the field index.
iIndex | Index of the structure field to set. |
values | The new values for the field. |
OpcUa_StatusCode UaGenericStructureValue::setGenericValue | ( | const UaByteString & | bsData, |
UaAbstractGenericValue::Encoding | valueEncoding, | ||
const UaStructureDefinition & | structureDefinition | ||
) |
Sets a UaGenericValue.
bsData | The content that will be serialized. |
valueEncoding | The encoding of bsData. |
structureDefinition | The definition that is used for deserializing. |
OpcUa_StatusCode UaGenericStructureValue::setGenericValue | ( | const UaExtensionObject & | extensionObject, |
const UaStructureDefinition & | structureDefinition | ||
) |
Parses a the binary data of an ExtenionObject and stores the data to a new UaGenericStructureValue.
If the TypeId of the ExtenionObject does not match the structureDefinition, the UaGenericStructureValue will not be changed.
extensionObject | Contains the content that will be deserialized. |
structureDefinition | The definition that is used for deserializing. |
UaString UaGenericStructureValue::toString | ( | ) | const |
Returns a string representation of the value.
This string can be used for showing in a GUI. There is no method fromString.
OpcUa_StatusCode UaGenericStructureValue::unsetField | ( | const UaString & | sFieldName | ) |
Unsets an optional field based on a field name.
sFieldName | Name of the structure field |
OpcUa_StatusCode UaGenericStructureValue::unsetField | ( | int | iIndex | ) |
Unsets an optional field based on a field index.
iIndex | Index of the structure field |
UaVariant UaGenericStructureValue::value | ( | const UaString & | sFieldName, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field name.
sFieldName | Name of the structure field value to return. |
status | Is set to OpcUa_BadInvalidArgument if the name is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |
UaVariant UaGenericStructureValue::value | ( | int | iIndex, |
OpcUa_StatusCode * | status = 0 |
||
) | const |
Returns the value for a structure field based on the field index.
iIndex | Index of the structure field value to return. |
status | Is set to OpcUa_BadInvalidArgument if the index is invalid. Is set to OpcUa_Good otherwise. This argument can be null. |