QOpcUaGenericStructValue Class
汎用OPC UA構造化型の値を保持します。詳細...
| ヘッダー: | #include <QOpcUaGenericStructValue> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa) target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
| qmake: | QT += opcua |
| 以下のように: | Qt 6.7 以降 |
パブリック関数
| 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) |
関連する非メンバー
| bool | operator!=(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs) |
| QDebug | operator<<(QDebug debug, const QOpcUaGenericStructValue &s) |
| bool | operator==(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs) |
詳細説明
このクラスは、名前付きフィールドとその値で構成される汎用OPC UA構造体値を保持します。フィールドの値には、組み込み型やそのサブタイプ、さらには他のネストされた汎用構造体も含まれる場合があります。また、このクラスのオブジェクトに含まれる型の型IDや構造体定義などのメタ情報も含まれます。
これは、デコード結果の戻り値型として、またQOpcUaGenericStructHandler のエンコードメソッドの入力型として使用されます。
オプションフィールドを持つ構造体の場合、fields() リストには指定されたフィールドのみが含まれます。エンコード時にオプションフィールドを省略するには、fields()リストにそのフィールドを含めないようにする必要があります。 Union型から派生した構造体については、フィールドを1つだけ指定する必要があります。デコードされた型のfields()リストに含まれる唯一のエントリによって、型定義のどのフィールド(ある場合)が指定されたかが決定されます。
例:
// 拡張オブジェクトをデコードする
QOpcUaGenericStructValue value=decoder.decode(extensionObject,success);
// 必須フィールドの値を出力する
qDebug() << value.fields().value("MyField").value<QOpcUaLocalizedText>();
// オプションフィールドの値を出力する
if(value.fields().contains("MyOptionalField"))
qDebug() << value.fields().value("MyField").value<QOpcUaQualifiedName>();
// フィールドのネストされた構造体を取得する
const autounionMember=value.fields().value("MyUnionMember").value<QOpcUaGenericStructValue>();
// 指定されたフィールドを出力する
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";メンバー関数のドキュメント
QOpcUaGenericStructValue::QOpcUaGenericStructValue()
汎用構造体の値を生成します。
QOpcUaGenericStructValue::QOpcUaGenericStructValue(const QString &typeName, const QString &typeId, const QOpcUaStructureDefinition &definition)
typeName 、typeId 、およびdefinition から、汎用構造体の値を構築します。
QOpcUaGenericStructValue::QOpcUaGenericStructValue(const QString &typeName, const QString &typeId, const QOpcUaStructureDefinition &definition, const QHash<QString, QVariant> &fields)
typeName 、typeId 、definition 、およびfields から、汎用構造体の値を構築します。
QOpcUaGenericStructValue::QOpcUaGenericStructValue(const QOpcUaGenericStructValue &other)
other からジェネリック構造体の値を生成します。
[constexpr noexcept default] QOpcUaGenericStructValue::QOpcUaGenericStructValue(QOpcUaGenericStructValue &&other)
other から新しいジェネリック構造体の値をムーブコンストラクトで生成します。
注:移動元のオブジェクト `other `は 、部分的に形成された状態になります。この状態では、有効な操作は破棄と新しい値への代入のみです。
[noexcept] QOpcUaGenericStructValue::~QOpcUaGenericStructValue()
この汎用構造体値オブジェクトを破棄します。
QHash<QString, QVariant> QOpcUaGenericStructValue::fields() const
このジェネリック構造体の値のフィールドを返します。
setFields()も参照してください 。
QHash<QString, QVariant> &QOpcUaGenericStructValue::fieldsRef()
このジェネリック構造体値のフィールドへの参照を返します。
void QOpcUaGenericStructValue::setFields(const QHash<QString, QVariant> &fields)
この汎用構造体の値の各フィールドを `fields` に設定します。
fields()も参照してください 。
void QOpcUaGenericStructValue::setStructureDefinition(const QOpcUaStructureDefinition &structureDefinition)
このジェネリック構造体値の構造体定義を `structureDefinition` に設定します。
structureDefinition()も参照してください 。
void QOpcUaGenericStructValue::setTypeId(const QString &typeId)
この汎用構造体値の型ノード ID を `typeId` に設定します。
typeId()も参照してください 。
void QOpcUaGenericStructValue::setTypeName(const QString &typeName)
このジェネリック構造体値の型名を「typeName 」に設定します。
typeName()も参照してください 。
QOpcUaStructureDefinition QOpcUaGenericStructValue::structureDefinition() const
このジェネリック構造体の値に対する構造体定義を返します。
setStructureDefinition()も参照してください 。
[noexcept] void QOpcUaGenericStructValue::swap(QOpcUaGenericStructValue &other)
ジェネリック構造体の値オブジェクト `other ` を、このジェネリック構造体の値オブジェクトと交換します。この操作は非常に高速で、失敗することはありません。
QString QOpcUaGenericStructValue::toString() const
このジェネリック構造体の値を表す文字列を返します。
QString QOpcUaGenericStructValue::typeId() const
このジェネリック構造体の値に対応する型ノードIDを返します。
setTypeId()も参照してください 。
QString QOpcUaGenericStructValue::typeName() const
このジェネリック構造体の値の型名を返します。
setTypeName()も参照してください 。
QOpcUaGenericStructValue::operator QVariant() const
このジェネリック構造体の値を含むQVariant を返します。
[noexcept] QOpcUaGenericStructValue &QOpcUaGenericStructValue::operator=(QOpcUaGenericStructValue &&other)
other をこのQOpcUaGenericStructValue インスタンスに割り当てます。
注: 移動元のオブジェクト other は 、部分的に形成された状態になります。この状態では、破棄と新しい値の代入のみが有効な操作となります。
QOpcUaGenericStructValue &QOpcUaGenericStructValue::operator=(const QOpcUaGenericStructValue &rhs)
この汎用構造体の値において、rhs の値を設定します。
関連する非メンバー
[noexcept] bool operator!=(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs)
lhs がrhs と等しくない場合、true を返します。
QDebug operator<<(QDebug debug, const QOpcUaGenericStructValue &s)
s の文字列表現をdebug に出力します。
[noexcept] bool operator==(const QOpcUaGenericStructValue &lhs, const QOpcUaGenericStructValue &rhs)
lhs がrhs と等しい場合、true を返します。
© 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.