21 #define GRT_DLL_EXPORTS 27 const std::string DeadZone::id =
"DeadZone";
35 init(lowerLimit,upperLimit,numDimensions);
60 if( preProcessing == NULL )
return false;
73 errorLog <<
"deepCopyFrom(const PreProcessing *preProcessing) - PreProcessing Types Do Not Match!" << std::endl;
81 errorLog <<
"process(const VectorFloat &inputVector) - Not initialized!" << std::endl;
85 if( inputVector.size() != numInputDimensions ){
86 errorLog <<
"process(const VectorFloat &inputVector) - The size of the inputVector (" << inputVector.size() <<
") does not match that of the filter (" << numInputDimensions <<
")!" << std::endl;
92 if( processedData.size() == numOutputDimensions )
return true;
102 if( !file.is_open() ){
103 errorLog <<
"save(fstream &file) - The file is not open!" << std::endl;
107 file <<
"GRT_DEAD_ZONE_FILE_V1.0" << std::endl;
109 file <<
"NumInputDimensions: " << numInputDimensions << std::endl;
110 file <<
"NumOutputDimensions: " << numOutputDimensions << std::endl;
111 file <<
"LowerLimit: " <<
lowerLimit << std::endl;
112 file <<
"UpperLimit: " <<
upperLimit << std::endl;
119 if( !file.is_open() ){
120 errorLog <<
"load(fstream &file) - The file is not open!" << std::endl;
129 if( word !=
"GRT_DEAD_ZONE_FILE_V1.0" ){
130 errorLog <<
"load(fstream &file) - Invalid file format!" << std::endl;
136 if( word !=
"NumInputDimensions:" ){
137 errorLog <<
"load(fstream &file) - Failed to read NumInputDimensions header!" << std::endl;
140 file >> numInputDimensions;
144 if( word !=
"NumOutputDimensions:" ){
145 errorLog <<
"load(fstream &file) - Failed to read NumOutputDimensions header!" << std::endl;
148 file >> numOutputDimensions;
152 if( word !=
"LowerLimit:" ){
153 errorLog <<
"load(fstream &file) - Failed to read LowerLimit header!" << std::endl;
159 if( word !=
"UpperLimit:" ){
160 errorLog <<
"load(fstream &file) - Failed to read UpperLimit header!" << std::endl;
166 return init(lowerLimit,upperLimit,numInputDimensions);
173 if( numDimensions == 0 ){
174 errorLog <<
"init(Float lowerLimit,Float upperLimit,UINT numDimensions) - NumDimensions must be greater than 0!" << std::endl;
178 if( lowerLimit >= upperLimit ){
179 errorLog <<
"init(Float lowerLimit,Float upperLimit,UINT numDimensions) - The lower limit must be less than the upperlimit!" << std::endl;
185 this->numInputDimensions = numDimensions;
186 this->numOutputDimensions = numDimensions;
187 processedData.clear();
188 processedData.
resize(numOutputDimensions,0);
196 if( y.
getSize() == 0 )
return 0;
203 errorLog <<
"filter(const VectorFloat &x) - Not Initialized!" << std::endl;
207 if( x.
getSize() != numInputDimensions ){
208 errorLog <<
"filter(const VectorFloat &x) - The Number Of Input Dimensions (" << numInputDimensions <<
") does not match the size of the input vector (" << x.size() <<
")!" << std::endl;
212 for(UINT n=0; n<numInputDimensions; n++){
214 processedData[n] = 0;
220 return processedData;
std::string getId() const
Float upperLimit
The upper limit of the dead-zone region.
DeadZone(const Float lowerLimit=-0.1, const Float upperLimit=0.1, const UINT numDimensions=1)
DeadZone & operator=(const DeadZone &rhs)
Float getUpperLimit() const
virtual bool process(const VectorFloat &inputVector)
virtual bool resize(const unsigned int size)
Float filter(const Float x)
bool setUpperLimit(Float upperLimit)
Float getLowerLimit() const
The DeadZone class sets any values in the input signal that fall within the dead-zone region to zero...
virtual bool deepCopyFrom(const PreProcessing *preProcessing)
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
bool copyBaseVariables(const PreProcessing *preProcessingModule)
static std::string getId()