A fuzzy logic C++ library
|
Data description: what do we want in the datafile ? What column of data ? More...
#include <data_descr.hpp>
Classes | |
struct | c_unique |
private class, used for fun ! More... | |
Public Member Functions | |
void | Print (FILE *f, const char *msg=0) const |
DATA_DESCR | ComputeIndexesAfterLoading () const |
Adjust the indexes after loading data. | |
Constructors and related functions | |
DATA_DESCR () | |
Constructor 1. | |
DATA_DESCR (size_t NbInputs) | |
Constructor 3, fills the input indexes with values from 0 to NbInputs-1 and output index with NbInputs. | |
DATA_DESCR (std::string output, std::string inputs, char delim=';') | |
Constructor 2. | |
void | Clear () |
Fetching information on description | |
bool | IsSet () const |
size_t | GetNbInputs () const |
size_t | GetInputIndex (size_t i) const |
size_t | GetOutputIndex () const |
bool | HasIndex (size_t idx) const |
Used to know if a given index idx (0-based) is used or not in the data description. | |
size_t | GetHighestIndex () const |
Returns the highest index mentioned here, including input indexes and output index. | |
Editing description | |
void | Set (std::string output, std::string inputs, char delim=';') |
Assigns description with strings. | |
void | SetOutputColumn (size_t idx) |
Assign output index (starting from 1) | |
void | SetOutputColumn (std::string idx) |
Assign output index (starting from 1) | |
void | AddInputColumn (size_t idx) |
Adds a column index (starting from 1) to the list of the ones we want. | |
void | AddInputColumn (std::string idx) |
Adds a column index (starting from 1) to the list of the ones we want. | |
void | SetInputColumns (std::string str, char sep=';') |
Assigns the vector of requested input columns from a string, typically given from command line. | |
Private Member Functions | |
bool | P_CheckOutputNotInInputs () const |
Returns false if the output index is included in the input indexes. | |
Private Attributes | |
size_t | _out_idx |
Index of column of the output value. | |
std::vector< size_t > | _v_in_idx |
Vector of indexes of input values, stored with increasing values. | |
struct slifis::DATA_DESCR::c_unique | UniqueNumber |
Friends | |
class | DATA_SET |
Data description: what do we want in the datafile ? What column of data ?
This class is designed to hold information that the users enters via command-line arguments. It only holds column indexes, but holds no information on what kind of data lies there.
If runtime checks are enabled it will check at every usage that it is valid, i.e. the output index is not one of the input indexes.
slifis::DATA_DESCR::DATA_DESCR | ( | ) | [inline] |
Constructor 1.
References Clear().
slifis::DATA_DESCR::DATA_DESCR | ( | size_t | NbInputs | ) | [inline] |
Constructor 3, fills the input indexes with values from 0 to NbInputs-1 and output index with NbInputs.
References _out_idx, _v_in_idx, and UniqueNumber.
slifis::DATA_DESCR::DATA_DESCR | ( | std::string | output, |
std::string | inputs, | ||
char | delim = ';' |
||
) | [inline] |
Constructor 2.
output | a string containing the column number of the output value |
inputs | a string containing the column numbers of the input values, separated by delim (default is semi-colon) |
delim | delimiter, default is semi-colon |
References Set().
void slifis::DATA_DESCR::Clear | ( | ) | [inline] |
References _out_idx, and _v_in_idx.
Referenced by DATA_DESCR().
bool slifis::DATA_DESCR::IsSet | ( | ) | const [inline] |
References _v_in_idx.
Referenced by slifis::DATA_POINT::FillWithInputValues(), and slifis::DATA_POINT::GetInputValue().
size_t slifis::DATA_DESCR::GetNbInputs | ( | ) | const [inline] |
size_t slifis::DATA_DESCR::GetInputIndex | ( | size_t | i | ) | const |
size_t slifis::DATA_DESCR::GetOutputIndex | ( | ) | const [inline] |
bool slifis::DATA_DESCR::HasIndex | ( | size_t | idx | ) | const [inline] |
size_t slifis::DATA_DESCR::GetHighestIndex | ( | ) | const |
Returns the highest index mentioned here, including input indexes and output index.
Referenced by slifis::DATA_SET::AssignDescription().
void slifis::DATA_DESCR::Set | ( | std::string | output, |
std::string | inputs, | ||
char | delim = ';' |
||
) |
Assigns description with strings.
output | a string holding the index of output column, for example "5" |
inputs | the input columns, for example "4;7;9" |
delim | the delimiter character, default is ; |
References __IN__, __OUT__, slifis::ERR_DATA_BAD_INDEX, and SLIFIS_ERROR_1.
Referenced by DATA_DESCR().
void slifis::DATA_DESCR::SetOutputColumn | ( | size_t | idx | ) | [inline] |
Assign output index (starting from 1)
References __IN__, __OUT__, _out_idx, slifis::ERR_DATA_BAD_INDEX, and SLIFIS_ERROR_2.
Referenced by slifis::DATA_SET::ReadData(), and SetOutputColumn().
void slifis::DATA_DESCR::SetOutputColumn | ( | std::string | idx | ) | [inline] |
Assign output index (starting from 1)
References __IN__, __OUT__, and SetOutputColumn().
void slifis::DATA_DESCR::AddInputColumn | ( | size_t | idx | ) | [inline] |
Adds a column index (starting from 1) to the list of the ones we want.
References __IN__, __OUT__, _v_in_idx, slifis::ERR_DATA_BAD_INDEX, and SLIFIS_ERROR_2.
Referenced by AddInputColumn().
void slifis::DATA_DESCR::AddInputColumn | ( | std::string | idx | ) | [inline] |
Adds a column index (starting from 1) to the list of the ones we want.
References __IN__, __OUT__, AddInputColumn(), slifis::ERR_DATA_BAD_INDEX, and SLIFIS_ERROR_2.
void slifis::DATA_DESCR::SetInputColumns | ( | std::string | str, |
char | sep = ';' |
||
) |
Assigns the vector of requested input columns from a string, typically given from command line.
str | the input string, with columns indexes ('1' means first column) |
sep | character used as separator, default is ';' |
References __IN__, __OUT__, slifis::ERR_DATA_BAD_INDEX, SLIFIS_ERROR_2, and slifis::TokensList().
void slifis::DATA_DESCR::Print | ( | FILE * | f, |
const char * | msg = 0 |
||
) | const |
Adjust the indexes after loading data.
When loading a file that has been given a description, only the required fields are loaded, so one needs to adjust this description. See file test_data_descr.cpp
References __IN__, __OUT__, _out_idx, _v_in_idx, slifis::ERR_DATA_DESCR_INVALID, and SLIFIS_ERROR.
Referenced by slifis::DATAFILE_INFO::AssignDataDescription(), and slifis::DATA_SET::ReadData().
bool slifis::DATA_DESCR::P_CheckOutputNotInInputs | ( | ) | const [inline, private] |
Returns false if the output index is included in the input indexes.
References _out_idx, and _v_in_idx.
Referenced by slifis::DATA_SET::AssignDescription(), and GetOutputIndex().
friend class DATA_SET [friend] |
size_t slifis::DATA_DESCR::_out_idx [private] |
Index of column of the output value.
Referenced by Clear(), ComputeIndexesAfterLoading(), DATA_DESCR(), GetOutputIndex(), HasIndex(), P_CheckOutputNotInInputs(), and SetOutputColumn().
std::vector<size_t> slifis::DATA_DESCR::_v_in_idx [private] |
Vector of indexes of input values, stored with increasing values.
Referenced by AddInputColumn(), Clear(), ComputeIndexesAfterLoading(), DATA_DESCR(), GetNbInputs(), HasIndex(), IsSet(), and P_CheckOutputNotInInputs().
struct slifis::DATA_DESCR::c_unique slifis::DATA_DESCR::UniqueNumber [private] |
Referenced by DATA_DESCR().