FactoryManager.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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_FACTORYMANAGER_H
  19. #define FL_FACTORYMANAGER_H
  20. #include "fl/fuzzylite.h"
  21. namespace fl {
  22. class TNormFactory;
  23. class SNormFactory;
  24. class DefuzzifierFactory;
  25. class TermFactory;
  26. class HedgeFactory;
  27. class FunctionFactory;
  28. class FL_API FactoryManager {
  29. protected:
  30. static FactoryManager _instance;
  31. FL_unique_ptr<TNormFactory> _tnorm;
  32. FL_unique_ptr<SNormFactory> _snorm;
  33. FL_unique_ptr<DefuzzifierFactory> _defuzzifier;
  34. FL_unique_ptr<TermFactory> _term;
  35. FL_unique_ptr<HedgeFactory> _hedge;
  36. FL_unique_ptr<FunctionFactory> _function;
  37. FactoryManager();
  38. FactoryManager(TNormFactory* tnorm, SNormFactory* snorm,
  39. DefuzzifierFactory* defuzzifier, TermFactory* term,
  40. HedgeFactory* hedge, FunctionFactory* function);
  41. FactoryManager(const FactoryManager& other);
  42. FactoryManager& operator=(const FactoryManager& other);
  43. FL_DEFAULT_MOVE(FactoryManager)
  44. virtual ~FactoryManager();
  45. public:
  46. static FactoryManager* instance();
  47. virtual void setTnorm(TNormFactory* tnorm);
  48. virtual TNormFactory* tnorm() const;
  49. virtual void setSnorm(SNormFactory* snorm);
  50. virtual SNormFactory* snorm() const;
  51. virtual void setDefuzzifier(DefuzzifierFactory* defuzzifier);
  52. virtual DefuzzifierFactory* defuzzifier() const;
  53. virtual void setTerm(TermFactory* term);
  54. virtual TermFactory* term() const;
  55. virtual void setHedge(HedgeFactory* hedge);
  56. virtual HedgeFactory* hedge() const;
  57. virtual void setFunction(FunctionFactory* function);
  58. virtual FunctionFactory* function() const;
  59. };
  60. }
  61. #endif /* FL_FACTORYMANAGER_H */