EventFilter Class

class QOpcUaMonitoringParameters::EventFilter

Defines an EventFilter for a monitored item. More...

Public Functions

EventFilter(const EventFilter &rhs)
EventFilter &operator=(const EventFilter &rhs)
QVector<QOpcUaSimpleAttributeOperand> selectClauses() const
QVector<QOpcUaSimpleAttributeOperand> &selectClausesRef()
void setSelectClauses(const QVector<QOpcUaSimpleAttributeOperand> &selectClauses)
void setWhereClause(const QVector<QOpcUaContentFilterElement> &whereClause)
QVector<QOpcUaContentFilterElement> whereClause() const
QVector<QOpcUaContentFilterElement> &whereClauseRef()
const QVariant operator const QVariant()
EventFilter &operator<<(const QOpcUaContentFilterElement &whereClauseElement)
EventFilter &operator<<(const QOpcUaSimpleAttributeOperand &selectClauseElement)
bool operator==(const EventFilter &rhs) const

Detailed Description

An event filter is required for monitoring events on the server. It consists of select clauses and a where clause.

The select clauses are used to specify the data the user wants to receive when an event occurs. It consists of QOpcUaSimpleAttributeOperand simple attribute operands which select attributes of child nodes of an event type, for example the value attribute of the "Message" property of BaseEventType.

The where clause is used to restrict the reported events by matching against certain criteria. Several operators and four different operand types allow filtering based on the values of the attributes of the child nodes of an event type.

Filters can be constructed using the setter or the streaming operator. Streaming a QOpcUaSimpleAttributeOperand into an event filter adds a new select clause to the filter, a QOpcUaContentFilterElement is appended to the where clause. A content filter element can be constructed by streaming operands of the types QOpcUaLiteralOperand, QOpcUaElementOperand, QOpcUaAttributeOperand and QOpcUaSimpleAttributeOperand and an operator into a content filter element. Only the last operator is used, previous operators will be discarded.

The following EventFilter tells the server to report the value of the "Message" field for events that have a "Severity" field with value >= 500:

QOpcUaMonitoringParameters::EventFilter filter;
filter << QOpcUaSimpleAttributeOperand("Message"); // Select clause of the filter

QOpcUaContentFilterElement condition;
condition << QOpcUaContentFilterElement::FilterOperator::GreaterThanOrEqual;
condition << QOpcUaSimpleAttributeOperand("Severity");
condition << QOpcUaLiteralOperand(500, QOpcUa::Types::UInt16);
filter << condition; // Where clause of the filter

For a more complex example with two conditions, see QOpcUaElementOperand.

Member Function Documentation

EventFilter::EventFilter(const EventFilter &rhs)

Constructs an event filter from rhs.

EventFilter &EventFilter::operator=(const EventFilter &rhs)

Sets the values from rhs in this event filter.

QVector<QOpcUaSimpleAttributeOperand> EventFilter::selectClauses() const

Returns the selected event fields that shall be included when a new event is reported.

See also setSelectClauses().

QVector<QOpcUaSimpleAttributeOperand> &EventFilter::selectClausesRef()

Returns a reference to the select clauses.

void EventFilter::setSelectClauses(const QVector<QOpcUaSimpleAttributeOperand> &selectClauses)

Sets the select clauses to selectClauses.

See also selectClauses().

void EventFilter::setWhereClause(const QVector<QOpcUaContentFilterElement> &whereClause)

Sets the where clause to whereClause.

See also whereClause().

QVector<QOpcUaContentFilterElement> EventFilter::whereClause() const

Returns the content filter used to restrict the reported events to events matching certain criteria.

See also setWhereClause().

QVector<QOpcUaContentFilterElement> &EventFilter::whereClauseRef()

Returns a reference to the where clause.

See also whereClause().

const QVariant EventFilter::operator const QVariant()

Converts this event filter to QVariant.

EventFilter &EventFilter::operator<<(const QOpcUaContentFilterElement &whereClauseElement)

Adds the content filter element whereClauseElement to the where clause of this event filter.

EventFilter &EventFilter::operator<<(const QOpcUaSimpleAttributeOperand &selectClauseElement)

Adds the simple attribute operand selectClauseElement to the select clause of this content filter element.

bool EventFilter::operator==(const EventFilter &rhs) const

Returns true if this event filter has the same value as rhs.

© 2021 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.