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 타입에서 파생된 구조체의 경우, 필드 중 하나만 지정해야 합니다. 디코딩된 타입의 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 auto unionMember = 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.