EvalCase.cpp
Go to the documentation of this file.
00001 //
00002 // EvalCase.cpp
00003 //
00004 //  Created on: 05.09.2011
00005 //      Author: wahnfla
00006 //
00007 
00008 #include "EvalCase.hpp"
00009 #include "../tools/errorhandler.hpp"    // for print...
00010 //#include "StringToolbox.hpp"
00011 #include <bitset>
00012 
00013 namespace datatypes
00014 {
00015 
00016 EvalCase::EvalCase()
00017 {
00018         m_datatype = Datatype_EvalCase;
00019         
00020         m_versionNumberIntern = 1;
00021 }
00022 
00023 EvalCase::~EvalCase()
00024 {
00025 }
00026 
00027 // Estimate the memory usage of this object.
00028 const UINT32 EvalCase::getUsedMemory() const
00029 {
00030         return sizeof(*this) +
00031                         m_caseName.length() +
00032                         m_comment.length();
00033 }
00034 
00035 
00036 double EvalCase::getBlankingSize() const
00037 {
00038         return m_blankingSize;
00039 }
00040 
00041 const std::string& EvalCase::getCaseName() const
00042 {
00043         return m_caseName;
00044 }
00045 
00046 UINT8 EvalCase::getCaseNumber() const
00047 {
00048         return m_caseNumber;
00049 }
00050 
00051 const std::string& EvalCase::getComment() const
00052 {
00053         return m_comment;
00054 }
00055 
00056 UINT16 EvalCase::getFieldNumber() const
00057 {
00058         return m_fieldNumber;
00059 }
00060 
00061 EvalCase::FilterType EvalCase::getFilterType() const
00062 {
00063         return m_filterType;
00064 }
00065 
00066 // const EvalCase::InputStateVector& EvalCase::getHardwareInputs() const
00067 // {
00068 //      return m_hardwareInputs;
00069 // }
00070 
00071 const UINT8 EvalCase::getLogicalInputState_as_UINT8() const
00072 {
00073         UINT8 state = (((UINT8)(m_logicalInputState[1])) << 2) + ((UINT8)(m_logicalInputState[0]));
00074         return state;
00075 }
00076 
00077 double EvalCase::getMaxRadialCorridor() const
00078 {
00079         return m_maxRadialCorridor;
00080 }
00081 
00082 double EvalCase::getMinFieldExp() const
00083 {
00084         return m_minFieldExp;
00085 }
00086 
00087 UINT8 EvalCase::getOutputNumber() const
00088 {
00089         return m_outputNumber;
00090 }
00091 
00092 UINT32 EvalCase::getResponseTime() const
00093 {
00094         return m_responseTime;
00095 }
00096 
00097 UINT32 EvalCase::getResponseTimeExtended() const
00098 {
00099         return m_responseTimeExtended;
00100 }
00101 
00102 EvalCase::EvaluationStrategy EvalCase::getStrategy() const
00103 {
00104         return m_strategy;
00105 }
00106 
00107 UINT32 EvalCase::getVersionNumberIntern() const
00108 {
00109         return m_versionNumberIntern;
00110 }
00111 
00112 bool EvalCase::isDistDependent() const
00113 {
00114         return m_distDependent;
00115 }
00116 
00117 bool EvalCase::isResultNegation() const
00118 {
00119         return m_resultNegation;
00120 }
00121 
00122 void EvalCase::setBlankingSize(double blankingSize)
00123 {
00124         this->m_blankingSize = blankingSize;
00125         
00126         // Consistency check
00127         if (m_blankingSize > 10.0)
00128         {
00129                 printWarning("EvalCase::setBlankingSize: Blanking size is very large. Was it really written in [m]?");
00130         }
00131 }
00132 
00133 void EvalCase::setCaseName(const std::string& caseName)
00134 {
00135         m_caseName = caseName;
00136         if (m_caseName.length() > 32)
00137         {
00138                 m_caseName = m_caseName.substr(0, 32);
00139         }
00140 }
00141 
00142 void EvalCase::setCaseNumber(UINT8 caseNumber)
00143 {
00144         this->m_caseNumber = caseNumber;
00145         if (m_caseNumber == 0)
00146         {
00147                 printWarning("EvalCase::setCaseNumber: Case number must be >0 for a valid EvalCase!");
00148         }
00149 }
00150 
00151 void EvalCase::setComment(const std::string& comment)
00152 {
00153         m_comment = comment;
00154         if (m_comment.length() > 128)
00155         {
00156                 m_comment = m_comment.substr(0, 128);
00157         }
00158 }
00159 
00160 void EvalCase::setDistDependent(bool distDependent)
00161 {
00162         this->m_distDependent = distDependent;
00163 }
00164 
00165 bool EvalCase::getDistDependent()
00166 {
00167         return m_distDependent;
00168 }
00169 
00170 void EvalCase::setFieldNumber(UINT16 fieldNumber)
00171 {
00172         this->m_fieldNumber = fieldNumber;
00173 }
00174 
00175 void EvalCase::setFilterType(FilterType filterType)
00176 {
00177         this->m_filterType = filterType;
00178 }
00179 
00180 // void EvalCase::setHardwareInputs(const EvalCase::InputStateVector& hardwareInputs)
00181 // {
00182 //      this->m_hardwareInputs = hardwareInputs;
00183 // }
00184 
00185 // void EvalCase::setLogicalInputs(const EvalCase::InputStateVector& logicalInputs)
00186 // {
00187 //      this->m_logicalInputs = logicalInputs;
00188 // }
00189 
00190 void EvalCase::setMaxRadialCorridor(double maxRadialCorridor)
00191 {
00192         this->m_maxRadialCorridor = maxRadialCorridor;
00193 }
00194 
00195 void EvalCase::setMinFieldExp(double minFieldExp)
00196 {
00197         this->m_minFieldExp = minFieldExp;
00198 }
00199 
00200 void EvalCase::setOutputNumber(UINT8 outputNumber)
00201 {
00202         this->m_outputNumber = outputNumber;
00203 }
00204 
00205 void EvalCase::setResponseTime(UINT32 responseTime)
00206 {
00207         this->m_responseTime = responseTime;
00208 }
00209 
00210 void EvalCase::setResponseTimeExtended(UINT32 responseTimeExtended)
00211 {
00212         this->m_responseTimeExtended = responseTimeExtended;
00213 }
00214 
00215 void EvalCase::setResultNegation(bool resultNegation)
00216 {
00217         this->m_resultNegation = resultNegation;
00218 }
00219 
00220 bool EvalCase::getResultNegation()
00221 {
00222         return this->m_resultNegation;
00223 }
00224 
00225 void EvalCase::setStrategy(EvaluationStrategy strategy)
00226 {
00227         this->m_strategy = strategy;
00228 }
00229 
00230 //
00231 // Sets the internal version number, as used by the MRS.
00232 //
00233 void EvalCase::setVersionNumber(UINT16 versionNumber)
00234 {
00235         this->m_versionNumberIntern = versionNumber;
00236 }
00237 
00238 //
00239 // Returns the internal version number, as used by the MRS.
00240 //
00241 UINT16 EvalCase::getVersionNumber()
00242 {
00243         return (this->m_versionNumberIntern);
00244 }
00245 
00246 EvalCase::ManipulationPrevention EvalCase::getManipulationPrevention() const
00247 {
00248         return m_manipulationPrevention;
00249 }
00250 
00251 void EvalCase::setManipulationPrevention(EvalCase::ManipulationPrevention manPrev)
00252 {
00253         m_manipulationPrevention = manPrev;
00254 }
00255 
00256 //
00257 // Decode the input state data from the sensor into this
00258 // objects structure.
00259 //
00260 void EvalCase::setLogicalInputState_from_UINT8(UINT8 value)
00261 {
00262         // Input 1
00263         UINT8 inputValue = value & 0x03;
00264         switch (inputValue)
00265         {
00266                 case 0:
00267                         m_logicalInputState[0] = INPUT_INACTIVE;
00268                         break;
00269                 case  1:
00270                         m_logicalInputState[0] = INPUT_LOW_ACTIVE;
00271                         break;
00272                 case 2:
00273                         m_logicalInputState[0] = INPUT_HIGH_ACTIVE;
00274                         break;
00275                 default:
00276                         printError("EvalCase::setLogicalInputState_from_UINT8: Configuration of input 1 has an invalid value, aborting!");
00277                         return;
00278         }
00279 
00280         // Input 2
00281         inputValue = (value >> 2) & 0x03;
00282         switch (inputValue)
00283         {
00284                 case 0:
00285                         m_logicalInputState[1] = INPUT_INACTIVE;
00286                         break;
00287                 case  1:
00288                         m_logicalInputState[1] = INPUT_LOW_ACTIVE;
00289                         break;
00290                 case 2:
00291                         m_logicalInputState[1] = INPUT_HIGH_ACTIVE;
00292                         break;
00293                 default:
00294                         printError("EvalCase::setLogicalInputState_from_UINT8: Configuration of input 2 has an invalid value, aborting!");
00295                         return;
00296         }
00297 }
00298 
00299 
00300 } // namespace datatypes


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Thu Jun 6 2019 21:02:36