C++ Based OPC UA Client/Server/PubSub SDK  1.7.6.537

Wrapper class for the UA stack structure OpcUa_KeyValuePair. More...

#include <uakeyvaluepair.h>

Public Member Functions

 UaKeyValuePair ()
 Constructs an instance of the class UaKeyValuePair with empty default values.
 
 UaKeyValuePair (const UaKeyValuePair &other)
 Constructs an instance of the class UaKeyValuePair with values from another UaKeyValuePair object. More...
 
 UaKeyValuePair (const OpcUa_KeyValuePair &other)
 Constructs an instance of the class UaKeyValuePair with values from another OpcUa_KeyValuePair structure. More...
 
 UaKeyValuePair (const UaQualifiedName &key, const UaVariant &value)
 Constructs an instance of the class UaKeyValuePair with values provided in the constructor.
 
 UaKeyValuePair (const UaExtensionObject &extensionObject)
 Constructs an instance of the class UaKeyValuePair initialized with value from a UaExtensionObject. More...
 
 UaKeyValuePair (const OpcUa_ExtensionObject &extensionObject)
 Constructs an instance of the class UaKeyValuePair initialized with value from an OpcUa_ExtensionObject structure. More...
 
 ~UaKeyValuePair ()
 Destroys the UaKeyValuePair object.
 
void clear ()
 Clear the data of the UaKeyValuePair. More...
 
bool operator== (const UaKeyValuePair &other) const
 Compare two UaKeyValuePair for equality. More...
 
bool operator!= (const UaKeyValuePair &other) const
 Compare two UaKeyValuePair for inequality. More...
 
UaKeyValuePairoperator= (const UaKeyValuePair &other)
 Assignment operator. More...
 
OpcUa_KeyValuePair * copy () const
 Copy UaKeyValuePair data to a newly allocated OpcUa_KeyValuePair. More...
 
void copyTo (OpcUa_KeyValuePair *pDst) const
 Copy UaKeyValuePair data to an existing OpcUa_KeyValuePair structure. More...
 
void attach (OpcUa_KeyValuePair *pValue)
 Attaches to an existing OpcUa_KeyValuePair structure. More...
 
OpcUa_KeyValuePair * detach (OpcUa_KeyValuePair *pDst)
 Detaches the internal KeyValuePair structure from this class. More...
 
UaQualifiedName getKey () const
 Returns the Key.
 
UaVariant getValue () const
 Returns the Value.
 
void setKey (const UaQualifiedName &key)
 Sets the Key.
 
void setValue (const UaVariant &value)
 Sets the Value.
 

Static Public Member Functions

static OpcUa_KeyValuePair * clone (const OpcUa_KeyValuePair &source)
 Copy OpcUa_KeyValuePair data to a newly allocated OpcUa_KeyValuePair. More...
 
static void cloneTo (const OpcUa_KeyValuePair &source, OpcUa_KeyValuePair &copy)
 Copy OpcUa_KeyValuePair data to an existing OpcUa_KeyValuePair structure. More...
 

Detailed Description

Wrapper class for the UA stack structure OpcUa_KeyValuePair.

This class encapsulates the native OpcUa_KeyValuePair structure and handles memory allocation and cleanup for you. UaKeyValuePair uses implicit sharing to avoid needless copying and to boost the performance. Only if you modify a shared KeyValuePair it creates a copy for that (copy-on-write). So assigning another UaKeyValuePair or passing it as parameter needs constant time and is nearly as fast as assigning a pointer.

Constructor & Destructor Documentation

UaKeyValuePair::UaKeyValuePair ( const UaKeyValuePair other)

Constructs an instance of the class UaKeyValuePair with values from another UaKeyValuePair object.

Parameters
otherthe other UaKeyValuePair used to initialize the object
UaKeyValuePair::UaKeyValuePair ( const OpcUa_KeyValuePair &  other)

Constructs an instance of the class UaKeyValuePair with values from another OpcUa_KeyValuePair structure.

Parameters
otherthe other OpcUa_KeyValuePair used to initialize the object
UaKeyValuePair::UaKeyValuePair ( const UaExtensionObject extensionObject)

Constructs an instance of the class UaKeyValuePair initialized with value from a UaExtensionObject.

Parameters
extensionObjectthe extension object containing the KeyValuePair
UaKeyValuePair::UaKeyValuePair ( const OpcUa_ExtensionObject extensionObject)

Constructs an instance of the class UaKeyValuePair initialized with value from an OpcUa_ExtensionObject structure.

Parameters
extensionObjectthe extension object containing the KeyValuePair

Member Function Documentation

void UaKeyValuePair::attach ( OpcUa_KeyValuePair *  pValue)

Attaches to an existing OpcUa_KeyValuePair structure.

Don't manually free the attached structure afterwards, because UaKeyValuePair is responsible for it now.

Parameters
pValue[in] Parameter to attach to.
void UaKeyValuePair::clear ( )

Clear the data of the UaKeyValuePair.

OpcUa_KeyValuePair * UaKeyValuePair::clone ( const OpcUa_KeyValuePair &  source)
static

Copy OpcUa_KeyValuePair data to a newly allocated OpcUa_KeyValuePair.

Parameters
sourceSource to clone.
Returns
pointer to a newly allocated OpcUa_KeyValuePair.
void UaKeyValuePair::cloneTo ( const OpcUa_KeyValuePair &  source,
OpcUa_KeyValuePair &  copy 
)
static

Copy OpcUa_KeyValuePair data to an existing OpcUa_KeyValuePair structure.

Parameters
sourcethe source of the clone operation.
copythe destination of the clone operation.
OpcUa_KeyValuePair * UaKeyValuePair::copy ( ) const

Copy UaKeyValuePair data to a newly allocated OpcUa_KeyValuePair.

Returns
pointer to a newly allocated OpcUa_KeyValuePair.
void UaKeyValuePair::copyTo ( OpcUa_KeyValuePair *  pDst) const

Copy UaKeyValuePair data to an existing OpcUa_KeyValuePair structure.

Parameters
pDstthe destination of this copy operation.
OpcUa_KeyValuePair * UaKeyValuePair::detach ( OpcUa_KeyValuePair *  pDst)

Detaches the internal KeyValuePair structure from this class.

This way you take over the control of freeing the KeyValuePair data. If more than one reference exists, the data is copied to pDst instead of being detached.

Parameters
pDst[out] Pointer to an OpcUa_KeyValuePair structure that receives the KeyValuePair data.
Returns
If the function succeeds, pDst is returned, otherwise 0 is returned.
bool UaKeyValuePair::operator!= ( const UaKeyValuePair other) const

Compare two UaKeyValuePair for inequality.

See also
operator==
Parameters
otherthe UaKeyValuePair to compare with.
Returns
true if not equal, false otherwise.
UaKeyValuePair & UaKeyValuePair::operator= ( const UaKeyValuePair other)

Assignment operator.

Parameters
otherthe UaKeyValuePair to assign.
Returns
reference to itself.
bool UaKeyValuePair::operator== ( const UaKeyValuePair other) const

Compare two UaKeyValuePair for equality.

Parameters
otherthe UaKeyValuePair to compare with.
Returns
true if equal, false if not.

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