QOpcUaGenericStructValue Class
Contiene el valor de un tipo estructurado OPC UA genérico. Más...
| Cabecera: | #include <QOpcUaGenericStructValue> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa)target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
| qmake: | QT += opcua |
| Desde: | Qt 6.7 |
Funciones Públicas
| QOpcUaGenericStructValue() | |
| QOpcUaGenericStructValue(const QString &typeName, const QString &typeId, const QOpcUaStructureDefinition &definition) | |
| QOpcUaGenericStructValue(const QString &typeName, const QString &typeId, const QOpcUaStructureDefinition &definition, const QHash<QString, QVariant> &fields) | |
| QOpcUaGenericStructValue(const QOpcUaGenericStructValue &other) | |
| QOpcUaGenericStructValue(QOpcUaGenericStructValue &&other) | |
| ~QOpcUaGenericStructValue() | |
| QHash<QString, QVariant> | fields() const |
| QHash<QString, QVariant> & | fieldsRef() |
| void | setFields(const QHash<QString, QVariant> &fields) |
| void | setStructureDefinition(const QOpcUaStructureDefinition &structureDefinition) |
| void | setTypeId(const QString &typeId) |
| void | setTypeName(const QString &typeName) |
| QOpcUaStructureDefinition | structureDefinition() const |
| void | swap(QOpcUaGenericStructValue &other) |
| QString | toString() const |
| QString | typeId() const |
| QString | typeName() const |
| operator QVariant() const | |
| QOpcUaGenericStructValue & | operator=(QOpcUaGenericStructValue &&other) |
| QOpcUaGenericStructValue & | operator=(const QOpcUaGenericStructValue &rhs) |
No miembros relacionados
| bool | operator!=(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs) |
| QDebug | operator<<(QDebug debug, const QOpcUaGenericStructValue &s) |
| bool | operator==(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs) |
Descripción detallada
Esta clase contiene un valor genérico OPC UA struct que consta de campos con nombre y sus valores, que pueden ser tipos incorporados o sus subtipos, así como otros structs genéricos anidados. También se incluye alguna metainformación como el ID del tipo y la definición de la estructura del tipo contenido en un objeto de esta clase.
Se utiliza como tipo de retorno para el resultado de la descodificación y como tipo de entrada para el método de codificación de QOpcUaGenericStructHandler.
En el caso de una estructura con campos opcionales, la lista fields() sólo contiene los campos especificados. Para omitir un campo opcional durante la codificación, no debe aparecer en la lista fields(). Para los structs derivados del tipo Union, sólo debe especificarse uno de los campos. La única entrada en la lista fields() de un tipo descodificado determina qué campo (si lo hay) de la definición del tipo se especificó.
Ejemplo:
// Decodificar un objeto de extensiónQOpcUaGenericStructValue value = decoder.decode(extensionObject, success);// Imprimir el valor de un campo obligatorioqDebug() << value.fields().value("MyField").value<QOpcUaLocalizedText>(); // Imprimir el valor de un campo opcionalif (value.fields().contains("MiCampoOpcional")) qDebug() << value.fields().value("MyField").value<QOpcUaQualifiedName>(); // Obtener una estructura anidada para un campoconst auto unionMember = value.fields().value("MyUnionMember").value<QOpcUaGenericStructValue>();// Imprimir el campo especificadoif (unionMember.fields().contains("UnionMember1")) qDebug() << unionMember.fields().value("UnionMember1").toInt(); else if (unionMember.fields().contains("UnionMember2")) qDebug() << unionMember.fields().value("UnionMember2").toDouble(); si no qDebug() << "Empty union";
Documentación de las funciones miembro
QOpcUaGenericStructValue::QOpcUaGenericStructValue()
Construye un valor struct genérico.
QOpcUaGenericStructValue::QOpcUaGenericStructValue(const QString &typeName, const QString &typeId, const QOpcUaStructureDefinition &definition)
Construye un valor struct genérico a partir de typeName, typeId y definition.
QOpcUaGenericStructValue::QOpcUaGenericStructValue(const QString &typeName, const QString &typeId, const QOpcUaStructureDefinition &definition, const QHash<QString, QVariant> &fields)
Construye un valor struct genérico a partir de typeName, typeId, definition y fields.
QOpcUaGenericStructValue::QOpcUaGenericStructValue(const QOpcUaGenericStructValue &other)
Construye un valor struct genérico a partir de other.
[constexpr noexcept] QOpcUaGenericStructValue::QOpcUaGenericStructValue(QOpcUaGenericStructValue &&other)
Mover-construye un nuevo valor struct genérico a partir de other.
Nota: El objeto movido-desde other se coloca en un estado parcialmente formado, en el que las únicas operaciones válidas son la destrucción y la asignación de un nuevo valor.
[noexcept] QOpcUaGenericStructValue::~QOpcUaGenericStructValue()
Destruye este objeto de valor struct genérico.
QHash<QString, QVariant> QOpcUaGenericStructValue::fields() const
Devuelve los campos de este valor struct genérico.
Véase también setFields().
QHash<QString, QVariant> &QOpcUaGenericStructValue::fieldsRef()
Devuelve una referencia a los campos de este valor struct genérico.
void QOpcUaGenericStructValue::setFields(const QHash<QString, QVariant> &fields)
Establece los campos de este valor struct genérico en fields.
Véase también fields().
void QOpcUaGenericStructValue::setStructureDefinition(const QOpcUaStructureDefinition &structureDefinition)
Establece la definición de estructura para este valor struct genérico en structureDefinition.
Véase también structureDefinition().
void QOpcUaGenericStructValue::setTypeId(const QString &typeId)
Establece el id del nodo de tipo para este valor struct genérico en typeId.
Véase también typeId().
void QOpcUaGenericStructValue::setTypeName(const QString &typeName)
Establece el nombre de tipo para este valor struct genérico en typeName.
Véase también typeName().
QOpcUaStructureDefinition QOpcUaGenericStructValue::structureDefinition() const
Devuelve la definición de estructura para este valor struct genérico.
Véase también setStructureDefinition().
[noexcept] void QOpcUaGenericStructValue::swap(QOpcUaGenericStructValue &other)
Intercambia el objeto struct value genérico other con este objeto struct value genérico. Esta operación es muy rápida y nunca falla.
QString QOpcUaGenericStructValue::toString() const
Devuelve una representación de cadena para este valor struct genérico.
QString QOpcUaGenericStructValue::typeId() const
Devuelve el id del nodo de tipo para este valor struct genérico.
Véase también setTypeId().
QString QOpcUaGenericStructValue::typeName() const
Devuelve el nombre del tipo para este valor struct genérico.
Véase también setTypeName().
QOpcUaGenericStructValue::operator QVariant() const
Devuelve un QVariant que contiene este valor struct genérico.
[noexcept] QOpcUaGenericStructValue &QOpcUaGenericStructValue::operator=(QOpcUaGenericStructValue &&other)
Mover-asigna other a esta instancia QOpcUaGenericStructValue.
Nota: El objeto movido-desde other se coloca en un estado parcialmente formado, en el que las únicas operaciones válidas son la destrucción y la asignación de un nuevo valor.
QOpcUaGenericStructValue &QOpcUaGenericStructValue::operator=(const QOpcUaGenericStructValue &rhs)
Establece el valor de rhs en este valor struct genérico.
No miembros relacionados
[noexcept] bool operator!=(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs)
Devuelve true si lhs no es igual a rhs.
QDebug operator<<(QDebug debug, const QOpcUaGenericStructValue &s)
Muestra la representación en cadena de s en debug.
[noexcept] bool operator==(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs)
Devuelve true si lhs es igual a rhs.
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.