/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2015 Simon Stürz * * Copyright (C) 2014 Michael Zanetti * * * * This file is part of nymea. * * * * nymea is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, version 2 of the License. * * * * nymea is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with nymea. If not, see . * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef RULE_H #define RULE_H #include "types/state.h" #include "types/ruleaction.h" #include "types/eventdescriptor.h" #include "stateevaluator.h" #include "time/timedescriptor.h" #include namespace nymeaserver { class Rule { public: Rule(); RuleId id() const; void setId(const RuleId &ruleId); QString name() const; void setName(const QString &name); bool active() const; bool statesActive() const; bool timeActive() const; TimeDescriptor timeDescriptor() const; void setTimeDescriptor(const TimeDescriptor &timeDescriptor); StateEvaluator stateEvaluator() const; void setStateEvaluator(const StateEvaluator &stateEvaluator); QList eventDescriptors() const; void setEventDescriptors(const QList &eventDescriptors); QList actions() const; void setActions(const QList actions); QList exitActions() const; void setExitActions(const QList exitActions); bool enabled() const; void setEnabled(const bool &enabled); bool executable() const; void setExecutable(const bool &executable); // verification methods bool isValid() const; bool isConsistent() const; private: friend class RuleEngine; void setStatesActive(const bool &statesActive); void setTimeActive(const bool &timeActive); void setActive(const bool &active); private: RuleId m_id; QString m_name; TimeDescriptor m_timeDescriptor; StateEvaluator m_stateEvaluator; QList m_eventDescriptors; QList m_actions; QList m_exitActions; bool m_enabled; bool m_active; bool m_statesActive; bool m_timeActive; bool m_executable; }; QDebug operator<<(QDebug dbg, const Rule &rule); } #endif // RULE_H