OutputVariable.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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_OUTPUTVARIABLE_H
  19. #define FL_OUTPUTVARIABLE_H
  20. #include "fl/variable/Variable.h"
  21. namespace fl {
  22. class Accumulated;
  23. class Defuzzifier;
  24. class FL_API OutputVariable : public Variable {
  25. private:
  26. void copyFrom(const OutputVariable& other);
  27. protected:
  28. FL_unique_ptr<Accumulated> _fuzzyOutput;
  29. FL_unique_ptr<Defuzzifier> _defuzzifier;
  30. scalar _outputValue;
  31. scalar _previousOutputValue;
  32. scalar _defaultValue;
  33. bool _lockOutputValueInRange;
  34. bool _lockPreviousOutputValue;
  35. public:
  36. OutputVariable(const std::string& name = "",
  37. scalar minimum = -fl::inf, scalar maximum = fl::inf);
  38. OutputVariable(const OutputVariable& other);
  39. OutputVariable& operator=(const OutputVariable& other);
  40. virtual ~OutputVariable() FL_IOVERRIDE;
  41. FL_DEFAULT_MOVE(OutputVariable)
  42. virtual Accumulated* fuzzyOutput() const;
  43. virtual void setName(const std::string& name) FL_IOVERRIDE;
  44. virtual void setMinimum(scalar minimum) FL_IOVERRIDE;
  45. virtual void setMaximum(scalar maximum) FL_IOVERRIDE;
  46. virtual void setDefuzzifier(Defuzzifier* defuzzifier);
  47. virtual Defuzzifier* getDefuzzifier() const;
  48. virtual void setOutputValue(scalar outputValue);
  49. virtual scalar getOutputValue() const;
  50. virtual void setPreviousOutputValue(scalar defuzzifiedValue);
  51. virtual scalar getPreviousOutputValue() const;
  52. virtual void setDefaultValue(scalar defaultValue);
  53. virtual scalar getDefaultValue() const;
  54. virtual void setLockOutputValueInRange(bool lockOutputValueInRange);
  55. virtual bool isLockedOutputValueInRange() const;
  56. virtual void setLockPreviousOutputValue(bool lockPreviousOutputValue);
  57. virtual bool isLockedPreviousOutputValue() const;
  58. virtual void defuzzify();
  59. virtual std::string fuzzyOutputValue() const;
  60. virtual void clear();
  61. virtual std::string toString() const FL_IOVERRIDE;
  62. };
  63. }
  64. #endif /* FL_OUTPUTVARIABLE_H */