RuleBlock.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Copyright 2010 Juan Rada-Vilela
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
  11. */
  12. /*
  13. * RuleBlock.h
  14. *
  15. * Created on: Jan 2, 2010
  16. * Author: jcrada
  17. */
  18. #ifndef FL_RULEBLOCK_H_
  19. #define FL_RULEBLOCK_H_
  20. #include "FuzzyOperator.h"
  21. #include <vector>
  22. #include <string>
  23. namespace fl {
  24. class FuzzyRule;
  25. class RuleBlock {
  26. private:
  27. std::string _name;
  28. const FuzzyOperator* _fuzzy_operator;
  29. std::vector<FuzzyRule*> _rules;
  30. public:
  31. RuleBlock(const std::string& name = "");
  32. RuleBlock(const std::string& name, const FuzzyOperator& fuzzy_operator);
  33. virtual ~RuleBlock();
  34. virtual void setName(const std::string& name);
  35. virtual std::string name() const;
  36. virtual FuzzyRule* rule(int index) const;
  37. virtual void addRule(FuzzyRule* rule);
  38. virtual FuzzyRule* removeRule(int index);
  39. virtual int numberOfRules() const;
  40. virtual const FuzzyOperator& fuzzyOperator() const;
  41. virtual void setFuzzyOperator(const FuzzyOperator& fuzzy_op);
  42. virtual void fireRules();
  43. virtual void reset();
  44. virtual std::string toString() const;
  45. };
  46. } // namespace fl
  47. #endif /* FL_RULEBLOCK_H_ */