21 #define GRT_DLL_EXPORTS 27 UINT PreProcessing::numPreProcessingInstances = 0;
30 PreProcessing* PreProcessing::createInstanceFromString(
const std::string &
id) {
return create(
id); }
34 StringPreProcessingMap::iterator iter = getMap()->find(
id );
35 if( iter == getMap()->end() ){
38 return iter->second();
48 numInputDimensions = 0;
49 numOutputDimensions = 0;
50 numPreProcessingInstances++;
54 if( --numPreProcessingInstances == 0 ){
55 delete stringPreProcessingMap;
56 stringPreProcessingMap = NULL;
62 if( preProcessingModule == NULL ){
63 errorLog <<
"copyBaseVariables(const PreProcessing *preProcessingModule) - preProcessingModule pointer is NULL!" << std::endl;
71 this->initialized = preProcessingModule->initialized;
72 this->numInputDimensions = preProcessingModule->numInputDimensions;
73 this->numOutputDimensions = preProcessingModule->numOutputDimensions;
74 this->processedData = preProcessingModule->processedData;
75 this->debugLog = preProcessingModule->debugLog;
76 this->errorLog = preProcessingModule->errorLog;
77 this->warningLog = preProcessingModule->warningLog;
85 if( processedData.
getSize() > 0 )
86 fill(processedData.begin(),processedData.end(),0);
93 numInputDimensions = 0;
94 numOutputDimensions = 0;
95 processedData.clear();
101 if( numOutputDimensions == 0 ){
102 errorLog <<
"init() - Failed to init module, the number of output dimensions is zero!" << std::endl;
108 processedData.
resize( numOutputDimensions );
118 if( !file.is_open() ){
119 errorLog <<
"savePreProcessingSettingsToFile(fstream &file) - The file is not open!" << std::endl;
124 errorLog <<
"savePreProcessingSettingsToFile(fstream &file) - Failed to save base settings to file!" << std::endl;
128 file <<
"Initialized: " << initialized << std::endl;
135 if( !file.is_open() ){
136 errorLog <<
"loadPreProcessingSettingsFromFile(fstream &file) - The file is not open!" << std::endl;
142 errorLog <<
"loadPreProcessingSettingsFromFile(fstream &file) - Failed to load base settings from file!" << std::endl;
150 if( word !=
"Initialized:" ){
151 errorLog <<
"loadPreProcessingSettingsFromFile(fstream &file) - Failed to read Initialized header!" << std::endl;
165 std::string PreProcessing::getPreProcessingType()
const{
174 return processedData;
virtual bool clear() override
bool saveBaseSettingsToFile(std::fstream &file) const
virtual ~PreProcessing(void)
std::string getId() const
bool savePreProcessingSettingsToFile(std::fstream &file) const
bool loadPreProcessingSettingsFromFile(std::fstream &file)
PreProcessing(const std::string &id="")
virtual bool resize(const unsigned int size)
virtual bool reset() override
bool copyMLBaseVariables(const MLBase *mlBase)
PreProcessing * create() const
bool loadBaseSettingsFromFile(std::fstream &file)
VectorFloat getProcessedData() const
bool copyBaseVariables(const PreProcessing *preProcessingModule)
This is the main base class that all GRT PreProcessing algorithms should inherit from.
This is the main base class that all GRT machine learning algorithms should inherit from...
std::map< std::string, PreProcessing *(*)() > StringPreProcessingMap
bool getInitialized() const