• StateEvaluator
  • StateEvaluator Class

    (nymeaserver::StateEvaluator)

    This class helps to evaluate a State and . More...

    Header: #include <StateEvaluator>

    Public Functions

    StateEvaluator(const StateDescriptor & stateDescriptor)
    StateEvaluator(QList<StateEvaluator> childEvaluators = QList<StateEvaluator> (), Types::StateOperator stateOperator = Types::StateOperatorAnd)
    void appendEvaluator(const StateEvaluator & stateEvaluator)
    QList<StateEvaluator> childEvaluators() const
    QList<DeviceId> containedDevices() const
    bool containsDevice(const DeviceId & deviceId) const
    void dumpToSettings(NymeaSettings & settings, const QString & groupName) const
    bool evaluate() const
    bool isEmpty() const
    bool isValid() const
    Types::StateOperator operatorType() const
    void removeDevice(const DeviceId & deviceId)
    void setChildEvaluators(const QList<StateEvaluator> & stateEvaluators)
    void setOperatorType(Types::StateOperator operatorType)
    StateDescriptor stateDescriptor() const

    Static Public Members

    StateEvaluator loadFromSettings(NymeaSettings & settings, const QString & groupName)

    Detailed Description

    This class helps to evaluate a State and .

    The StateEvaluator class helps to evaluate a StateDescriptor and check if all States from the given StateDescriptor are valid. A StateDescriptor is valid if conditions of the StateDescriptor are true.

    See also StateDescriptor, State, and RuleEngine.

    Member Function Documentation

    StateEvaluator::StateEvaluator(const StateDescriptor & stateDescriptor)

    Constructs a new StateEvaluator for the given stateDescriptor.

    StateEvaluator::StateEvaluator(QList<StateEvaluator> childEvaluators = QList<StateEvaluator> (), Types::StateOperator stateOperator = Types::StateOperatorAnd)

    Constructs a new StateEvaluator for the given childEvaluators and stateOperator.

    void StateEvaluator::appendEvaluator(const StateEvaluator & stateEvaluator)

    Appends the given stateEvaluator to the child evaluators of this StateEvaluator.

    See also childEvaluators().

    QList<StateEvaluator> StateEvaluator::childEvaluators() const

    Returns the list of child StateEvaluators of this StateEvaluator.

    See also setChildEvaluators().

    QList<DeviceId> StateEvaluator::containedDevices() const

    Returns a list of DeviceIds of this StateEvaluator.

    bool StateEvaluator::containsDevice(const DeviceId & deviceId) const

    Returns true if this StateEvaluator has a Device in it with the given deviceId.

    void StateEvaluator::dumpToSettings(NymeaSettings & settings, const QString & groupName) const

    This method will be used to save this StateEvaluator to the given settings. The groupName will normally be the corresponding Rule.

    bool StateEvaluator::evaluate() const

    Returns true, if all child evaluator conditions are true depending on the StateOperator.

    bool StateEvaluator::isEmpty() const

    Returns true if the StateEvaluator is empty, that is, has no StateDescriptor and no ChildEvaluators

    bool StateEvaluator::isValid() const

    Returns true, if all child evaluators are valid, the devices exist and all descriptors are in allowed paramerters.

    [static] StateEvaluator StateEvaluator::loadFromSettings(NymeaSettings & settings, const QString & groupName)

    This method will be used to load a StateEvaluator from the given settings. The groupName will be the corresponding RuleId. Returns the loaded StateEvaluator.

    Types::StateOperator StateEvaluator::operatorType() const

    Returns the StateOperator for this StateEvaluator.

    See also setOperatorType().

    void StateEvaluator::removeDevice(const DeviceId & deviceId)

    Removes a Device with the given deviceId from this StateEvaluator.

    void StateEvaluator::setChildEvaluators(const QList<StateEvaluator> & stateEvaluators)

    Sets the list of child evaluators of this StateEvaluator to the given stateEvaluators.

    See also childEvaluators().

    void StateEvaluator::setOperatorType(Types::StateOperator operatorType)

    Sets the StateOperator for this StateEvaluator to the given. operatorType. This operator will be used to evaluate the child evaluator list.

    See also operatorType().

    StateDescriptor StateEvaluator::stateDescriptor() const

    Returns the StateDescriptor of this StateEvaluator.