PySide6.QtOpcUa.QOpcUaGenericStructValue¶
- class QOpcUaGenericStructValue¶
- Holds the value of a generic OPC UA structured type. More… - Synopsis¶- Methods¶- def - __init__()
- def - fields()
- def - fieldsRef()
- def - __ne__()
- def - __eq__()
- def - setFields()
- def - setTypeId()
- def - setTypeName()
- def - swap()
- def - toString()
- def - typeId()
- def - typeName()
 - Note - This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE - Detailed Description¶- This class holds a generic OPC UA struct value which consists of named fields with their values which can be built-in types or their sub types as well as other nested generic structs. Some meta information like the type ID and the structure definition of the type contained in an object of this class is also included. - It is used as return type for the decoding result and as input type for the encoding method of - QOpcUaGenericStructHandler.- For a struct with optional fields, only the fields that were specified are contained in the - fields()list. To omit an optional field during encoding, it must not appear in the- fields()list. For structs derived from the Union type, only one of the fields must be specified. The only entry in the- fields()list of a decoded type determines which field (if any) of the type definition was specified.- Example: - // Decode an extension object QOpcUaGenericStructValue value = decoder.decode(extensionObject, success); // Print the value of a mandatory field qDebug() << value.fields().value("MyField").value<QOpcUaLocalizedText>(); // Print the value of an optional field if (value.fields().contains("MyOptionalField")) qDebug() << value.fields().value("MyField").value<QOpcUaQualifiedName>(); // Get a nested struct for a field const auto unionMember = value.fields().value("MyUnionMember").value<QOpcUaGenericStructValue>(); // Print the specified field if (unionMember.fields().contains("UnionMember1")) qDebug() << unionMember.fields().value("UnionMember1").toInt(); else if (unionMember.fields().contains("UnionMember2")) qDebug() << unionMember.fields().value("UnionMember2").toDouble(); else qDebug() << "Empty union"; - __init__()¶
 - Constructs a generic struct value. - __init__(other)
- Parameters:
- other – - QOpcUaGenericStructValue
 
 - Constructs a generic struct value from - other.- __init__(typeName, typeId, definition)
- Parameters:
- typeName – str 
- typeId – str 
- definition – - QOpcUaStructureDefinition
 
 
 - Constructs a generic struct value from - typeName,- typeIdand- definition.- __init__(typeName, typeId, definition, fields)
- Parameters:
- typeName – str 
- typeId – str 
- definition – - QOpcUaStructureDefinition
- fields – Dictionary with keys of type .QString and values of type QVariant. 
 
 
 - Constructs a generic struct value from - typeName,- typeId,- definitionand- fields.- fields()¶
- Return type:
- Dictionary with keys of type .QString and values of type QVariant. 
 
 - Returns the fields of this generic struct value. - See also - fieldsRef()¶
- Return type:
- Dictionary with keys of type .QString and values of type QVariant. 
 
 - Returns a reference to the fields of this generic struct value. - __ne__(rhs)¶
- Parameters:
- rhs – - QOpcUaGenericStructValue
- Return type:
- bool 
 
 - Returns - trueif- lhsis not equal to- rhs.- __eq__(rhs)¶
- Parameters:
- rhs – - QOpcUaGenericStructValue
- Return type:
- bool 
 
 - Returns - trueif- lhsis equal to- rhs.- setFields(fields)¶
- Parameters:
- fields – Dictionary with keys of type .QString and values of type QVariant. 
 
 - Sets the fields of this generic struct value to - fields.- See also - setStructureDefinition(structureDefinition)¶
- Parameters:
- structureDefinition – - QOpcUaStructureDefinition
 
 - Sets the structure definition for this generic struct value to - structureDefinition.- See also - setTypeId(typeId)¶
- Parameters:
- typeId – str 
 
 - Sets the type node id for this generic struct value to - typeId.- See also - setTypeName(typeName)¶
- Parameters:
- typeName – str 
 
 - Sets the type name for this generic struct value to - typeName.- See also - structureDefinition()¶
- Return type:
 
 - Returns the structure definition for this generic struct value. - See also - swap(other)¶
- Parameters:
- other – - QOpcUaGenericStructValue
 
 - Swaps generic struct value object - otherwith this generic struct value object. This operation is very fast and never fails.- toString()¶
- Return type:
- str 
 
 - Returns a string representation for this generic struct value. - typeId()¶
- Return type:
- str 
 
 - Returns the type node id for this generic struct value. - See also - typeName()¶
- Return type:
- str 
 
 - Returns the type name for this generic struct value. - See also