21 #define GRT_DLL_EXPORTS
30 classType =
"DeadZone";
31 preProcessingType = classType;
32 debugLog.setProceedingText(
"[DEBUG DeadZone]");
33 errorLog.setProceedingText(
"[ERROR DeadZone]");
34 warningLog.setProceedingText(
"[WARNING DeadZone]");
35 init(lowerLimit,upperLimit,numDimensions);
41 classType =
"DeadZone";
42 preProcessingType = classType;
43 debugLog.setProceedingText(
"[DEBUG DeadZone]");
44 errorLog.setProceedingText(
"[ERROR DeadZone]");
45 warningLog.setProceedingText(
"[WARNING DeadZone]");
64 if( preProcessing == NULL )
return false;
77 errorLog <<
"clone(const PreProcessing *preProcessing) - PreProcessing Types Do Not Match!" << std::endl;
85 errorLog <<
"process(const VectorFloat &inputVector) - Not initialized!" << std::endl;
89 if( inputVector.size() != numInputDimensions ){
90 errorLog <<
"process(const VectorFloat &inputVector) - The size of the inputVector (" << inputVector.size() <<
") does not match that of the filter (" << numInputDimensions <<
")!" << std::endl;
96 if( processedData.size() == numOutputDimensions )
return true;
106 if( !file.is_open() ){
107 errorLog <<
"save(fstream &file) - The file is not open!" << std::endl;
111 file <<
"GRT_DEAD_ZONE_FILE_V1.0" << std::endl;
113 file <<
"NumInputDimensions: " << numInputDimensions << std::endl;
114 file <<
"NumOutputDimensions: " << numOutputDimensions << std::endl;
115 file <<
"LowerLimit: " <<
lowerLimit << std::endl;
116 file <<
"UpperLimit: " <<
upperLimit << std::endl;
123 if( !file.is_open() ){
124 errorLog <<
"load(fstream &file) - The file is not open!" << std::endl;
133 if( word !=
"GRT_DEAD_ZONE_FILE_V1.0" ){
134 errorLog <<
"load(fstream &file) - Invalid file format!" << std::endl;
140 if( word !=
"NumInputDimensions:" ){
141 errorLog <<
"load(fstream &file) - Failed to read NumInputDimensions header!" << std::endl;
144 file >> numInputDimensions;
148 if( word !=
"NumOutputDimensions:" ){
149 errorLog <<
"load(fstream &file) - Failed to read NumOutputDimensions header!" << std::endl;
152 file >> numOutputDimensions;
156 if( word !=
"LowerLimit:" ){
157 errorLog <<
"load(fstream &file) - Failed to read LowerLimit header!" << std::endl;
163 if( word !=
"UpperLimit:" ){
164 errorLog <<
"load(fstream &file) - Failed to read UpperLimit header!" << std::endl;
170 return init(lowerLimit,upperLimit,numInputDimensions);
177 if( numDimensions == 0 ){
178 errorLog <<
"init(Float lowerLimit,Float upperLimit,UINT numDimensions) - NumDimensions must be greater than 0!" << std::endl;
182 if( lowerLimit >= upperLimit ){
183 errorLog <<
"init(Float lowerLimit,Float upperLimit,UINT numDimensions) - The lower limit must be less than the upperlimit!" << std::endl;
189 this->numInputDimensions = numDimensions;
190 this->numOutputDimensions = numDimensions;
191 processedData.clear();
192 processedData.
resize(numOutputDimensions,0);
200 if( y.
getSize() == 0 )
return 0;
207 errorLog <<
"filter(const VectorFloat &x) - Not Initialized!" << std::endl;
211 if( x.
getSize() != numInputDimensions ){
212 errorLog <<
"filter(const VectorFloat &x) - The Number Of Input Dimensions (" << numInputDimensions <<
") does not match the size of the input vector (" << x.size() <<
")!" << std::endl;
216 for(UINT n=0; n<numInputDimensions; n++){
218 processedData[n] = 0;
224 return processedData;
Float upperLimit
The upper limit of the dead-zone region.
DeadZone & operator=(const DeadZone &rhs)
virtual bool process(const VectorFloat &inputVector)
virtual bool resize(const unsigned int size)
Float filter(const Float x)
bool setUpperLimit(Float upperLimit)
virtual bool deepCopyFrom(const PreProcessing *preProcessing)
std::string getPreProcessingType() const
Float lowerLimit
The lower limit of the dead-zone region.
virtual bool load(std::fstream &file)
bool setLowerLimit(Float lowerLimit)
virtual bool save(std::fstream &file) const
DeadZone(Float lowerLimit=-0.1, Float upperLimit=0.1, UINT numDimensions=1)
The DeadZone class sets any values in the input signal that fall within the dead-zone region to zero...
bool copyBaseVariables(const PreProcessing *preProcessingModule)