Term.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. Author: Juan Rada-Vilela, Ph.D.
  3. Copyright (C) 2010-2014 FuzzyLite Limited
  4. All rights reserved
  5. This file is part of fuzzylite.
  6. fuzzylite is free software: you can redistribute it and/or modify it under
  7. the terms of the GNU Lesser General Public License as published by the Free
  8. Software Foundation, either version 3 of the License, or (at your option)
  9. any later version.
  10. fuzzylite is distributed in the hope that it will be useful, but WITHOUT
  11. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12. FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
  13. for more details.
  14. You should have received a copy of the GNU Lesser General Public License
  15. along with fuzzylite. If not, see <http://www.gnu.org/licenses/>.
  16. fuzzylite™ is a trademark of FuzzyLite Limited.
  17. */
  18. #ifndef FL_TERM_H
  19. #define FL_TERM_H
  20. #include "fl/fuzzylite.h"
  21. #include "fl/Operation.h"
  22. #include <cmath>
  23. #include <string>
  24. #include <vector>
  25. namespace fl {
  26. class Engine;
  27. class FL_API Term {
  28. protected:
  29. std::string _name;
  30. scalar _height;
  31. public:
  32. Term(const std::string& name = "", scalar height = 1.0);
  33. virtual ~Term();
  34. FL_DEFAULT_COPY_AND_MOVE(Term)
  35. virtual void setName(const std::string& name);
  36. virtual std::string getName() const;
  37. virtual void setHeight(scalar height);
  38. virtual scalar getHeight() const;
  39. virtual std::string toString() const;
  40. virtual std::string className() const = 0;
  41. virtual std::string parameters() const = 0;
  42. virtual void configure(const std::string& parameters) = 0;
  43. virtual scalar membership(scalar x) const = 0;
  44. virtual Term* clone() const = 0;
  45. static void updateReference(Term* term, const Engine* engine);
  46. };
  47. }
  48. #endif /* FL_TERM_H */