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

A class that serializes and deserializes unions that is described by an UaStructureDefinition. More...

#include <uagenericunionvalue.h>

Inherits UaAbstractGenericStructureValue.

Public Member Functions

 UaGenericUnionValue ()
 Creates an empty UaGenericUnionValue. More...
 
 UaGenericUnionValue (const UaStructureDefinition &structureDefinition)
 Creates an UaGenericUnionValue without a field set. More...
 
 UaGenericUnionValue (const UaGenericUnionValue &other)
 Copy constructor. More...
 
 UaGenericUnionValue (const UaByteString &bsData, Encoding valueEncoding, const UaStructureDefinition &structureDefinition)
 Parses a ByteString and stores the data to a new UaGenericUnionValue. More...
 
 UaGenericUnionValue (const UaExtensionObject &extensionObject, const UaStructureDefinition &structureDefinition)
 Parses a the binary data of an ExtenionObject and stores the data to a new UaGenericUnionValue. More...
 
virtual ~UaGenericUnionValue ()
 Desctruction.
 
virtual void clear ()
 Clears the UaGenericUnionValue. More...
 
bool operator== (const UaGenericUnionValue &other) const
 Compares the content of two UaGenericUnionValues. More...
 
bool operator!= (const UaGenericUnionValue &other) const
 Check if two UaGenericUnionValue are unequal.
 
OpcUa_StatusCode setGenericUnion (const UaByteString &bsData, UaAbstractGenericValue::Encoding valueEncoding, const UaStructureDefinition &structureDefinition)
 Assignment operator. More...
 
OpcUa_StatusCode setGenericUnion (const UaExtensionObject &extensionObject, const UaStructureDefinition &structureDefinition)
 Parses a the binary data of an ExtenionObject and stores the data to a new UaGenericUnionValue. More...
 
OpcUa_StatusCode setValue (const UaString &sFieldName, UaVariant &value, OpcUa_Boolean bDetach)
 Sets the value of the union based on the structure field name. More...
 
OpcUa_StatusCode setValue (int iIndex, UaVariant &value, OpcUa_Boolean bDetach)
 Sets the value of the union based on the structure field index. More...
 
OpcUa_StatusCode setValue (const UaString &sFieldName, const UaVariant &value)
 Sets the value of the union based on the structure field name. More...
 
OpcUa_StatusCode setValue (int iIndex, const UaVariant &value)
 Sets the value of the union based on the structure field index. More...
 
OpcUa_StatusCode setValue (const UaString &sFieldName, const UaGenericStructureValue &value)
 Sets the value of the union based on the structure field name. More...
 
OpcUa_StatusCode setValue (int iIndex, const UaGenericStructureValue &value)
 Sets the value of the union based on the structure field index. More...
 
OpcUa_StatusCode setValue (const UaString &sFieldName, const UaGenericStructureArray &value)
 Sets the value of the union based on the structure field name. More...
 
OpcUa_StatusCode setValue (int iIndex, const UaGenericStructureArray &value)
 Sets the value of the union based on the structure field index. More...
 
OpcUa_StatusCode setValue (const UaString &sFieldName, const UaGenericUnionValue &value)
 Sets the value of the union based on the structure field name. More...
 
OpcUa_StatusCode setValue (int iIndex, const UaGenericUnionValue &value)
 Sets the value of the union based on the structure field index. More...
 
OpcUa_StatusCode setValue (const UaString &sFieldName, const UaGenericUnionArray &value)
 Sets the value of the union based on the structure field name. More...
 
OpcUa_StatusCode setValue (int iIndex, const UaGenericUnionArray &value)
 Sets the value of the union based on the structure field index. More...
 
OpcUa_StatusCode setValue (const UaString &sFieldName, const UaGenericOptionSetValue &value)
 Sets the value of the union based on the structure field name. More...
 
OpcUa_StatusCode setValue (int iIndex, const UaGenericOptionSetValue &value)
 Sets the value of the union based on the structure field index. More...
 
OpcUa_StatusCode setValue (const UaString &sFieldName, const UaGenericOptionSetArray &value)
 Sets the value of the union based on the structure field name. More...
 
OpcUa_StatusCode setValue (int iIndex, const UaGenericOptionSetArray &value)
 Sets the value of the union based on the structure field index. More...
 
UaVariant value () const
 Returns the current value of the UaGenericUnionValue. More...
 
UaGenericStructureValue genericStructure (OpcUa_StatusCode *status=0) const
 Returns the current value of the UaGenericUnionValue. More...
 
UaGenericStructureArray genericStructureArray (OpcUa_StatusCode *status=0) const
 Returns the current value of the UaGenericUnionValue. More...
 
UaGenericUnionValue genericUnion (OpcUa_StatusCode *status=0) const
 Returns the current value of the UaGenericUnionValue. More...
 
UaGenericUnionArray genericUnionArray (OpcUa_StatusCode *status=0) const
 Returns the current value of the UaGenericUnionValueArray. More...
 
UaGenericOptionSetValue genericOptionSet (OpcUa_StatusCode *status=0) const
 Returns the current value of the UaGenericUnionValue. More...
 
UaGenericOptionSetArray genericOptionSetArray (OpcUa_StatusCode *status=0) const
 Returns the current value of the UaGenericUnionValueArray. More...
 
int switchValue () const
 Returns the index of the current used field for the UaGenericUnionValue.
 
UaStructureField field () const
 Returns the current used field for the UaGenericUnionValue.
 
virtual UaStructureDefinition definition () const
 Returns the definition of the UaGenericUnionValue. 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...
 

Detailed Description

A class that serializes and deserializes unions that is described by an UaStructureDefinition.

The class can be used for DataTypes that are not registered to the stack.

Constructor & Destructor Documentation

UaGenericUnionValue::UaGenericUnionValue ( )

Creates an empty UaGenericUnionValue.

UaGenericUnionValue::UaGenericUnionValue ( const UaStructureDefinition structureDefinition)

Creates an UaGenericUnionValue without a field set.

UaGenericUnionValue::UaGenericUnionValue ( const UaGenericUnionValue other)

Copy constructor.

Parameters
otherThe other UaGenericUnionValue.
UaGenericUnionValue::UaGenericUnionValue ( const UaByteString bsData,
Encoding  valueEncoding,
const UaStructureDefinition structureDefinition 
)

Parses a ByteString and stores the data to a new UaGenericUnionValue.

UaGenericUnionValue::UaGenericUnionValue

Parameters
bsDataThe contend that will be deserialized.
valueEncodingThe encoding of bsData
structureDefinitionThe definition that is used for deserializing.
UaGenericUnionValue::UaGenericUnionValue ( const UaExtensionObject extensionObject,
const UaStructureDefinition structureDefinition 
)

Parses a the binary data of an ExtenionObject and stores the data to a new UaGenericUnionValue.

If the TypeId of the ExtenionObject does not match the structureDefinition, an empty UaGenericUnionValue will be created.

Parameters
extensionObjectContains the content that will be deserialized.
structureDefinitionThe definition that is used for deserializing.

Member Function Documentation

void UaGenericUnionValue::clear ( )
virtual

Clears the UaGenericUnionValue.

Clears the value and sets the StructureDefinition to an invalid definition.

Implements UaAbstractGenericValue.

void UaGenericUnionValue::decode ( UaAbstractDecoder pDecoder)
virtual

Deserializing method that is used by the SDK internally.

Implements UaAbstractGenericValue.

UaStructureDefinition UaGenericUnionValue::definition ( ) const
virtual

Returns the definition of the UaGenericUnionValue.

Implements UaAbstractGenericStructureValue.

void UaGenericUnionValue::encode ( UaAbstractEncoder pEncoder) const
virtual

Serializing method that is used by the SDK internally.

Implements UaAbstractGenericValue.

UaGenericOptionSetValue UaGenericUnionValue::genericOptionSet ( OpcUa_StatusCode status = 0) const

Returns the current value of the UaGenericUnionValue.

Parameters
statusIs set to OpcUa_BadTypeMismatch if the current value of the UaGenericUnionValue is not a union. Is set too OpcUa_Good otherwise. Can be NULL.
Returns
The current value of the UaGenericUnionValue as UaGenericOptionSetValue. An empty UaGenericOptionSetValue if the current value of the UaGenericUnionValue is not an OptionSet.
UaGenericOptionSetArray UaGenericUnionValue::genericOptionSetArray ( OpcUa_StatusCode status = 0) const

Returns the current value of the UaGenericUnionValueArray.

Parameters
statusIs set to OpcUa_BadTypeMismatch if the current value of the UaGenericUnionValue is not an array of unions. Is set too OpcUa_Good otherwise. Can be NULL.
Returns
The current value of the UaGenericUnionValue as UaGenericOptionSetArray. An empty UaGenericOptionSetArray if the current value of the UaGenericUnionValue is not an array of OptionSets.
UaGenericStructureValue UaGenericUnionValue::genericStructure ( OpcUa_StatusCode status = 0) const

Returns the current value of the UaGenericUnionValue.

Parameters
statusIs set to OpcUa_BadTypeMismatch if the current value of the UaGenericUnionValue is not a structure. Is set too OpcUa_Good otherwise. Can be NULL.
Returns
The current value of the UaGenericUnionValue as UaGenericStructureValue. An empty UaGenericStructureValue if the current value of the UaGenericUnionValue is not a structure.
UaGenericStructureArray UaGenericUnionValue::genericStructureArray ( OpcUa_StatusCode status = 0) const

Returns the current value of the UaGenericUnionValue.

Parameters
statusIs set to OpcUa_BadTypeMismatch if the current value of the UaGenericUnionValue is not an array of structures. Is set too OpcUa_Good otherwise. Can be NULL.
Returns
The current value of the UaGenericUnionValue as UaGenericStructureArray. An empty UaGenericStructureArray if the current value of the UaGenericUnionValue is not an array of structures.
UaGenericUnionValue UaGenericUnionValue::genericUnion ( OpcUa_StatusCode status = 0) const

Returns the current value of the UaGenericUnionValue.

Parameters
statusIs set to OpcUa_BadTypeMismatch if the current value of the UaGenericUnionValue is not a union. Is set too OpcUa_Good otherwise. Can be NULL.
Returns
The current value of the UaGenericUnionValue as UaGenericUnionValue. An empty UaGenericUnionValue if the current value of the UaGenericUnionValue is not a union.
UaGenericUnionArray UaGenericUnionValue::genericUnionArray ( OpcUa_StatusCode status = 0) const

Returns the current value of the UaGenericUnionValueArray.

Parameters
statusIs set to OpcUa_BadTypeMismatch if the current value of the UaGenericUnionValue is not an array of unions. Is set too OpcUa_Good otherwise. Can be NULL.
Returns
The current value of the UaGenericUnionValue as UaGenericUnionArray. An empty UaGenericUnionArray if the current value of the UaGenericUnionValue is not an array of unions.
bool UaGenericUnionValue::operator== ( const UaGenericUnionValue other) const

Compares the content of two UaGenericUnionValues.

Returns
'true' if the definitions, the selected field and the value are the same. 'false' otherwise
OpcUa_StatusCode UaGenericUnionValue::setGenericUnion ( const UaByteString bsData,
UaAbstractGenericValue::Encoding  valueEncoding,
const UaStructureDefinition structureDefinition 
)

Assignment operator.

OpcUa_StatusCode UaGenericUnionValue::setGenericUnion ( const UaExtensionObject extensionObject,
const UaStructureDefinition structureDefinition 
)

Parses a the binary data of an ExtenionObject and stores the data to a new UaGenericUnionValue.

If the TypeId of the ExtenionObject does not match the structureDefinition, the UaGenericUnionValue will not be changed.

Parameters
extensionObjectContains the content that will be deserialized.
structureDefinitionThe definition that is used for deserializing.
OpcUa_StatusCode UaGenericUnionValue::setValue ( const UaString sFieldName,
UaVariant value,
OpcUa_Boolean  bDetach 
)

Sets the value of the union based on the structure field name.

Parameters
sFieldNameThe name of the structure field to use for the value
valueThe new value of the UaGenericUnionValue
bDetachIf true UaGenericUnionValue attaches value. If false value is copied.
Returns
OpcUa_BadTypeMismatch if the DataType or the ValueRank do not match the DataType and the ValueRank of the structure field. OpcUa_BadInvalidArgument if the sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( int  iIndex,
UaVariant value,
OpcUa_Boolean  bDetach 
)

Sets the value of the union based on the structure field index.

Parameters
iIndexIndex of the structure field
valueThe new value of the UaGenericUnionValue
bDetachIf true UaGenericUnionValue attaches value. If false value is copied.
Returns
OpcUa_BadTypeMismatch if the DataType or the ValueRank do not match the DataType and the ValueRank of the structure field. OpcUa_BadInvalidArgument if the sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( const UaString sFieldName,
const UaVariant value 
)

Sets the value of the union based on the structure field name.

Parameters
sFieldNameThe name of the structure field to use for the value
valueThe new value of the UaGenericUnionValue
Returns
OpcUa_BadTypeMismatch if the DataType or the ValueRank do not match the DataType and the ValueRank of the structure field. OpcUa_BadInvalidArgument if the sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( int  iIndex,
const UaVariant value 
)

Sets the value of the union based on the structure field index.

Parameters
iIndexIndex of the structure field
valueThe new value of the UaGenericUnionValue
Returns
OpcUa_BadTypeMismatch if the DataType or the ValueRank do not match the DataType and the ValueRank of the structure field. OpcUa_BadInvalidArgument if the sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( const UaString sFieldName,
const UaGenericStructureValue value 
)

Sets the value of the union based on the structure field name.

Parameters
sFieldNameThe name of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue.
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Scalar. OpcUa_BadInvalidArgument if sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( int  iIndex,
const UaGenericStructureValue value 
)

Sets the value of the union based on the structure field index.

Parameters
iIndexThe index of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Scalar. OpcUa_BadInvalidArgument if iIndex is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( const UaString sFieldName,
const UaGenericStructureArray value 
)

Sets the value of the union based on the structure field name.

Parameters
sFieldNameThe name of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue.
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Array. OpcUa_BadInvalidArgument if sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( int  iIndex,
const UaGenericStructureArray value 
)

Sets the value of the union based on the structure field index.

Parameters
iIndexThe index of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Array. OpcUa_BadInvalidArgument if iIndex is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( const UaString sFieldName,
const UaGenericUnionValue value 
)

Sets the value of the union based on the structure field name.

Parameters
sFieldNameThe name of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue.
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Scalar. OpcUa_BadInvalidArgument if sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( int  iIndex,
const UaGenericUnionValue value 
)

Sets the value of the union based on the structure field index.

Parameters
iIndexThe index of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Scalar. OpcUa_BadInvalidArgument if iIndex is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( const UaString sFieldName,
const UaGenericUnionArray value 
)

Sets the value of the union based on the structure field name.

Parameters
sFieldNameThe name of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue.
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Array. OpcUa_BadInvalidArgument if sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( int  iIndex,
const UaGenericUnionArray value 
)

Sets the value of the union based on the structure field index.

Parameters
iIndexThe index of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Array. OpcUa_BadInvalidArgument if iIndex is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( const UaString sFieldName,
const UaGenericOptionSetValue value 
)

Sets the value of the union based on the structure field name.

Parameters
sFieldNameThe name of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue.
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Scalar. OpcUa_BadInvalidArgument if sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( int  iIndex,
const UaGenericOptionSetValue value 
)

Sets the value of the union based on the structure field index.

Parameters
iIndexThe index of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Scalar. OpcUa_BadInvalidArgument if iIndex is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( const UaString sFieldName,
const UaGenericOptionSetArray value 
)

Sets the value of the union based on the structure field name.

Parameters
sFieldNameThe name of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue.
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Array. OpcUa_BadInvalidArgument if sFieldName is invalid. OpcUa_Good if setting the value succeeded.
OpcUa_StatusCode UaGenericUnionValue::setValue ( int  iIndex,
const UaGenericOptionSetArray value 
)

Sets the value of the union based on the structure field index.

Parameters
iIndexThe index of the structure field to use for the value.
valueThe new value of the UaGenericUnionValue
Returns
OpcUa_BadTypeMismatch if the DataType of value is not the DataType of the field or if the ValueRank of the field is not Array. OpcUa_BadInvalidArgument if iIndex is invalid. OpcUa_Good if setting the value succeeded.
UaVariant UaGenericUnionValue::value ( ) const

Returns the current value of the UaGenericUnionValue.


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