fuzzylite  6.0
A Fuzzy Logic Control Library in C++
fl::FldExporter Class Reference

The FldExporter class is an Exporter that evaluates an Engine and exports its input values and output values to the FuzzyLite Dataset (FLD) format, see http://www.fuzzylite.com/fll-fld for more information. More...

#include <FldExporter.h>

Inheritance diagram for fl::FldExporter:
Collaboration diagram for fl::FldExporter:

Public Types

enum  ScopeOfValues { EachVariable, AllVariables }
 The ScopeOfValues refers to the scope of the equally-distributed values to generate. More...
 

Public Member Functions

 FldExporter (const std::string &separator=" ")
 
virtual ~FldExporter () FL_IOVERRIDE
 
virtual std::string name () const FL_IOVERRIDE
 Returns the name of the exporter. More...
 
virtual void setSeparator (const std::string &separator)
 Sets the separator of the dataset columns. More...
 
virtual std::string getSeparator () const
 Gets the separator of the dataset columns. More...
 
virtual void setExportHeader (bool exportHeaders)
 Sets whether the header of the dataset is to be exported. More...
 
virtual bool exportsHeader () const
 Gets whether the header of the dataset is to be exported. More...
 
virtual void setExportInputValues (bool exportInputValues)
 Sets whether the values of the input variables are to be exported. More...
 
virtual bool exportsInputValues () const
 Gets whether the values of the input variables are to be exported. More...
 
virtual void setExportOutputValues (bool exportOutputValues)
 Sets whether the values of the output variables are to be exported. More...
 
virtual bool exportsOutputValues () const
 Gets whether the values of the output variables are to be exported. More...
 
virtual std::string header (const Engine *engine) const
 Gets the header of the dataset for the given engine. More...
 
virtual std::string toString (const Engine *engine) const FL_IOVERRIDE
 Returns a FuzzyLite Dataset from the engine. More...
 
virtual std::string toString (Engine *engine, int values, ScopeOfValues scope=AllVariables) const
 Returns a FuzzyLite Dataset from the engine. More...
 
virtual std::string toString (Engine *engine, int values, ScopeOfValues scope, const std::vector< InputVariable *> &activeVariables) const
 Returns a FuzzyLite Dataset from the engine. More...
 
virtual std::string toString (Engine *engine, std::istream &reader) const
 Returns a FuzzyLite Dataset from the engine. More...
 
virtual void toFile (const std::string &path, Engine *engine, int values, ScopeOfValues scope=AllVariables) const
 Saves the engine as a FuzzyLite Dataset into the specified file. More...
 
virtual void toFile (const std::string &path, Engine *engine, int values, ScopeOfValues scope, const std::vector< InputVariable *> &activeVariables) const
 Saves the engine as a FuzzyLite Dataset into the specified file. More...
 
virtual void toFile (const std::string &path, Engine *engine, std::istream &reader) const
 Saves the engine as a FuzzyLite Dataset into the specified file. More...
 
virtual std::vector< scalarparse (const std::string &values) const
 Parses the string into a vector of values unless the string starts with # More...
 
virtual void write (Engine *engine, std::ostream &writer, int values, ScopeOfValues scope=AllVariables) const
 Writes the engine into the given writer. More...
 
virtual void write (Engine *engine, std::ostream &writer, int values, ScopeOfValues scope, const std::vector< InputVariable *> &activeVariables) const
 Writes the engine into the given writer. More...
 
virtual void write (Engine *engine, std::ostream &writer, std::istream &reader) const
 Writes the engine into the given writer. More...
 
virtual void write (Engine *engine, std::ostream &writer, const std::vector< scalar > &inputValues) const
 Writes the engine into the given writer. More...
 
virtual void write (Engine *engine, std::ostream &writer, const std::vector< scalar > &inputValues, const std::vector< InputVariable *> &activeVariables) const
 Writes the engine into the given writer. More...
 
virtual FldExporterclone () const FL_IOVERRIDE
 Creates a clone of the exporter. More...
 
- Public Member Functions inherited from fl::Exporter
 Exporter ()
 
virtual ~Exporter ()
 
virtual void toFile (const std::string &path, const Engine *engine) const
 Stores the string representation of the engine into the specified file. More...
 

Detailed Description

The FldExporter class is an Exporter that evaluates an Engine and exports its input values and output values to the FuzzyLite Dataset (FLD) format, see http://www.fuzzylite.com/fll-fld for more information.

Author
Juan Rada-Vilela, Ph.D.
See also
FllExporter
Exporter
Since
4.0

Definition at line 40 of file FldExporter.h.

Member Enumeration Documentation

◆ ScopeOfValues

The ScopeOfValues refers to the scope of the equally-distributed values to generate.

Enumerator
EachVariable 

Generates \(n\) values for each variable.

AllVariables 

Generates \(n\) values for all variables.

Definition at line 52 of file FldExporter.h.

Constructor & Destructor Documentation

◆ FldExporter()

fl::FldExporter::FldExporter ( const std::string &  separator = " ")
explicit

◆ ~FldExporter()

virtual fl::FldExporter::~FldExporter ( )
virtual

Member Function Documentation

◆ clone()

virtual FldExporter* fl::FldExporter::clone ( ) const
virtual

Creates a clone of the exporter.

Returns
a clone of the exporter

Implements fl::Exporter.

◆ exportsHeader()

virtual bool fl::FldExporter::exportsHeader ( ) const
virtual

Gets whether the header of the dataset is to be exported.

Returns
whether the header of the dataset is to be exported

◆ exportsInputValues()

virtual bool fl::FldExporter::exportsInputValues ( ) const
virtual

Gets whether the values of the input variables are to be exported.

Returns
whether the values of the input variables are to be exported

◆ exportsOutputValues()

virtual bool fl::FldExporter::exportsOutputValues ( ) const
virtual

Gets whether the values of the output variables are to be exported.

Returns
whether the values of the output variables are to be exported

◆ getSeparator()

virtual std::string fl::FldExporter::getSeparator ( ) const
virtual

Gets the separator of the dataset columns.

Returns
the separator of the dataset columns

◆ header()

virtual std::string fl::FldExporter::header ( const Engine engine) const
virtual

Gets the header of the dataset for the given engine.

Parameters
engineis the engine to be exported
Returns
the header of the dataset for the given engine

◆ name()

virtual std::string fl::FldExporter::name ( ) const
virtual

Returns the name of the exporter.

Returns
the name of the exporter

Implements fl::Exporter.

◆ parse()

virtual std::vector<scalar> fl::FldExporter::parse ( const std::string &  values) const
virtual

Parses the string into a vector of values unless the string starts with #

Parameters
valuesis a space-separated set of values
Returns
a vector of values

◆ setExportHeader()

virtual void fl::FldExporter::setExportHeader ( bool  exportHeaders)
virtual

Sets whether the header of the dataset is to be exported.

Parameters
exportHeadersindicates whether the header of the dataset is to be exported

◆ setExportInputValues()

virtual void fl::FldExporter::setExportInputValues ( bool  exportInputValues)
virtual

Sets whether the values of the input variables are to be exported.

Parameters
exportInputValuesindicates whether the values of the input variables are to be exported

◆ setExportOutputValues()

virtual void fl::FldExporter::setExportOutputValues ( bool  exportOutputValues)
virtual

Sets whether the values of the output variables are to be exported.

Parameters
exportOutputValuesindicates whether the values of the output variables are to be exported

◆ setSeparator()

virtual void fl::FldExporter::setSeparator ( const std::string &  separator)
virtual

Sets the separator of the dataset columns.

Parameters
separatoris the separator of the dataset columns

◆ toFile() [1/3]

virtual void fl::FldExporter::toFile ( const std::string &  path,
Engine engine,
int  values,
ScopeOfValues  scope = AllVariables 
) const
virtual

Saves the engine as a FuzzyLite Dataset into the specified file.

Parameters
pathis the full path of the file
engineis the engine to export
valuesis the number of values to export
scopeindicates the scope of the values

◆ toFile() [2/3]

virtual void fl::FldExporter::toFile ( const std::string &  path,
Engine engine,
int  values,
ScopeOfValues  scope,
const std::vector< InputVariable *> &  activeVariables 
) const
virtual

Saves the engine as a FuzzyLite Dataset into the specified file.

Parameters
pathis the full path of the file
engineis the engine to export
valuesis the number of values to export
scopeindicates the scope of the values
activeVariablescontains the input variables to generate values for. The input variables must be in the same order as in the engine. A value of fl::null indicates the variable is not active.

◆ toFile() [3/3]

virtual void fl::FldExporter::toFile ( const std::string &  path,
Engine engine,
std::istream &  reader 
) const
virtual

Saves the engine as a FuzzyLite Dataset into the specified file.

Parameters
pathis the full path of the file
engineis the engine to export
readeris the reader of a set of lines containing space-separated input values

◆ toString() [1/4]

virtual std::string fl::FldExporter::toString ( const Engine engine) const
virtual

Returns a FuzzyLite Dataset from the engine.

Please consider that the engine will be const_casted to achieve so; that is, despite being marked as const, the engine will be modified in order to compute the output values based on the input values.

Parameters
engineis the engine to export
Returns
a FuzzyLite Dataset from the engine

Implements fl::Exporter.

◆ toString() [2/4]

virtual std::string fl::FldExporter::toString ( Engine engine,
int  values,
ScopeOfValues  scope = AllVariables 
) const
virtual

Returns a FuzzyLite Dataset from the engine.

Parameters
engineis the engine to export
valuesis the number of values to export
scopeindicates the scope of the values
Returns
a FuzzyLite Dataset from the engine

◆ toString() [3/4]

virtual std::string fl::FldExporter::toString ( Engine engine,
int  values,
ScopeOfValues  scope,
const std::vector< InputVariable *> &  activeVariables 
) const
virtual

Returns a FuzzyLite Dataset from the engine.

Parameters
engineis the engine to export
valuesis the number of values to export
scopeindicates the scope of the values
activeVariablescontains the input variables to generate values for. The input variables must be in the same order as in the engine. A value of fl::null indicates the variable is not active.
Returns
a FuzzyLite Dataset from the engine

◆ toString() [4/4]

virtual std::string fl::FldExporter::toString ( Engine engine,
std::istream &  reader 
) const
virtual

Returns a FuzzyLite Dataset from the engine.

Parameters
engineis the engine to export
readeris the reader of a set of lines containing space-separated input values
Returns
a FuzzyLite Dataset from the engine

◆ write() [1/5]

virtual void fl::FldExporter::write ( Engine engine,
std::ostream &  writer,
int  values,
ScopeOfValues  scope = AllVariables 
) const
virtual

Writes the engine into the given writer.

Parameters
engineis the engine to export
writeris the output where the engine will be written to
valuesis the number of values to export
scopeindicates the scope of the values

◆ write() [2/5]

virtual void fl::FldExporter::write ( Engine engine,
std::ostream &  writer,
int  values,
ScopeOfValues  scope,
const std::vector< InputVariable *> &  activeVariables 
) const
virtual

Writes the engine into the given writer.

Parameters
engineis the engine to export
writeris the output where the engine will be written to
valuesis the number of values to export
scopeindicates the scope of the values
activeVariablescontains the input variables to generate values for. The input variables must be in the same order as in the engine. A value of fl::null indicates the variable is not active.

◆ write() [3/5]

virtual void fl::FldExporter::write ( Engine engine,
std::ostream &  writer,
std::istream &  reader 
) const
virtual

Writes the engine into the given writer.

Parameters
engineis the engine to export
writeris the output where the engine will be written to
readeris the reader of a set of lines containing space-separated input values

◆ write() [4/5]

virtual void fl::FldExporter::write ( Engine engine,
std::ostream &  writer,
const std::vector< scalar > &  inputValues 
) const
virtual

Writes the engine into the given writer.

Parameters
engineis the engine to export
writeris the output where the engine will be written to
inputValuesis the vector of input values

◆ write() [5/5]

virtual void fl::FldExporter::write ( Engine engine,
std::ostream &  writer,
const std::vector< scalar > &  inputValues,
const std::vector< InputVariable *> &  activeVariables 
) const
virtual

Writes the engine into the given writer.

Parameters
engineis the engine to export
writeris the output where the engine will be written to
inputValuesis the vector of input values
activeVariablescontains the input variables to generate values for. The input variables must be in the same order as in the engine. A value of fl::null indicates the variable is not active.

The documentation for this class was generated from the following file: