FldExporter.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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_FLDEXPORTER_H
  19. #define FL_FLDEXPORTER_H
  20. #include "fl/imex/Exporter.h"
  21. #include <vector>
  22. namespace fl {
  23. class Engine;
  24. class InputVariable;
  25. class OutputVariable;
  26. class FL_API FldExporter : public Exporter {
  27. protected:
  28. std::string _separator;
  29. bool _exportHeaders;
  30. bool _exportInputValues;
  31. bool _exportOutputValues;
  32. public:
  33. FldExporter(const std::string& separator = " ");
  34. virtual ~FldExporter() FL_IOVERRIDE;
  35. FL_DEFAULT_COPY_AND_MOVE(FldExporter)
  36. virtual std::string name() const FL_IOVERRIDE;
  37. virtual void setSeparator(const std::string& separator);
  38. virtual std::string getSeparator() const;
  39. virtual void setExportHeader(bool exportHeaders);
  40. virtual bool exportsHeader() const;
  41. virtual void setExportInputValues(bool exportInputValues);
  42. virtual bool exportsInputValues() const;
  43. virtual void setExportOutputValues(bool exportOutputValues);
  44. virtual bool exportsOutputValues() const;
  45. virtual std::string header(const Engine* engine) const;
  46. //WARNING: The engine will be const_casted in order to be processed!
  47. virtual std::string toString(const Engine* engine) const FL_IOVERRIDE;
  48. virtual std::string toString(Engine* engine, int maximumNumberOfResults) const;
  49. virtual std::string toString(Engine* engine, const std::string& inputData) const;
  50. using Exporter::toFile;
  51. virtual void toFile(const std::string& path, Engine* engine, int maximumNumberOfResults) const;
  52. virtual void toFile(const std::string& path, Engine* engine, const std::string& inputData) const;
  53. virtual std::vector<scalar> parse(const std::string& x) const;
  54. void write(Engine* engine, std::ostream& writer, int maximumNumberOfResults) const;
  55. void write(Engine* engine, std::ostream& writer, std::istream& reader) const;
  56. void write(Engine* engine, std::ostream& writer, const std::vector<scalar>& inputValues) const;
  57. virtual FldExporter* clone() const FL_IOVERRIDE;
  58. };
  59. }
  60. #endif /* FL_FLDEXPORTER_H */