summaryrefslogtreecommitdiff
path: root/fuzzylite/fl/imex/FclExporter.h
blob: efec3c48c8ec599e89c95b69a1d967ae807c1559 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 fuzzylite (R), a fuzzy logic control library in C++.
 Copyright (C) 2010-2017 FuzzyLite Limited. All rights reserved.
 Author: Juan Rada-Vilela, Ph.D. <jcrada@fuzzylite.com>

 This file is part of fuzzylite.

 fuzzylite is free software: you can redistribute it and/or modify it under
 the terms of the FuzzyLite License included with the software.

 You should have received a copy of the FuzzyLite License along with
 fuzzylite. If not, see <http://www.fuzzylite.com/license/>.

 fuzzylite is a registered trademark of FuzzyLite Limited.
 */

#ifndef FL_FCLEXPORTER_H
#define FL_FCLEXPORTER_H

#include "fl/imex/Exporter.h"

namespace fl {
    class InputVariable;
    class OutputVariable;
    class RuleBlock;
    class Norm;
    class TNorm;
    class SNorm;
    class Defuzzifier;
    class Term;

    /**
      The FclExporter class is an Exporter that translates an Engine and its
      components to the Fuzzy Control Language specification.

      @author Juan Rada-Vilela, Ph.D.
      @see FclImporter
      @see Exporter
      @since 4.0
     */
    class FL_API FclExporter : public Exporter {
    private:
        std::string _indent;

    public:
        explicit FclExporter(const std::string& indent = "  ");
        virtual ~FclExporter() FL_IOVERRIDE;
        FL_DEFAULT_COPY_AND_MOVE(FclExporter)

        /**
          Sets the indentation string within blocks
          @param indent is the indentation string within blocks
         */
        virtual void setIndent(const std::string& indent);
        /**
          Gets the indentation string within blocks
          @return the indentation string within blocks
         */
        virtual std::string getIndent() const;

        virtual std::string name() const FL_IOVERRIDE;
        virtual std::string toString(const Engine* engine) const FL_IOVERRIDE;

        /**
          Returns a string representation of the InputVariable according to the Fuzzy Control Language specification
          @param variable is the input variable
          @return a string representation of the input variable  according to the Fuzzy Control Language specification
         */
        virtual std::string toString(const InputVariable* variable) const;
        /**
          Returns a string representation of the OutputVariable according to the Fuzzy Control Language specification
          @param variable is the output variable
          @return a string representation of the output variable according to the Fuzzy Control Language specification
         */
        virtual std::string toString(const OutputVariable* variable) const;
        /**
          Returns a string representation of the RuleBlock according to the Fuzzy Control Language specification
          @param ruleBlock is the rule block
          @return a string representation of the rule block according to the Fuzzy Control Language specification
         */
        virtual std::string toString(const RuleBlock* ruleBlock) const;
        /**
          Returns a string representation of the Norm according to the Fuzzy Control Language specification
          @param norm is the norm
          @return a string representation of the norm according to the Fuzzy Control Language specification
         */
        virtual std::string toString(const Norm* norm) const;
        /**
          Returns a string representation of the Defuzzifier according to the Fuzzy Control Language specification
          @param defuzzifier is the defuzzifier
          @return a string representation of the defuzzifier according to the Fuzzy Control Language specification
         */
        virtual std::string toString(const Defuzzifier* defuzzifier) const;
        /**
          Returns a string representation of the Term according to the Fuzzy Control Language specification
          @param term is the term
          @return a string representation of the term according to the Fuzzy Control Language specification
         */
        virtual std::string toString(const Term* term) const;

        virtual FclExporter* clone() const FL_IOVERRIDE;
    };
}

#endif /* FL_FCLEXPORTER_H */