EvalCase.cpp
Go to the documentation of this file.
1 //
2 // EvalCase.cpp
3 //
4 // Created on: 05.09.2011
5 // Author: wahnfla
6 //
7 
8 #include "EvalCase.hpp"
9 #include "../tools/errorhandler.hpp" // for print...
10 //#include "StringToolbox.hpp"
11 #include <bitset>
12 
13 namespace datatypes
14 {
15 
17 {
19 
21 }
22 
24 {
25 }
26 
27 // Estimate the memory usage of this object.
29 {
30  return sizeof(*this) +
31  m_caseName.length() +
32  m_comment.length();
33 }
34 
35 
37 {
38  return m_blankingSize;
39 }
40 
41 const std::string& EvalCase::getCaseName() const
42 {
43  return m_caseName;
44 }
45 
47 {
48  return m_caseNumber;
49 }
50 
51 const std::string& EvalCase::getComment() const
52 {
53  return m_comment;
54 }
55 
57 {
58  return m_fieldNumber;
59 }
60 
62 {
63  return m_filterType;
64 }
65 
66 // const EvalCase::InputStateVector& EvalCase::getHardwareInputs() const
67 // {
68 // return m_hardwareInputs;
69 // }
70 
72 {
73  UINT8 state = (((UINT8)(m_logicalInputState[1])) << 2) + ((UINT8)(m_logicalInputState[0]));
74  return state;
75 }
76 
78 {
79  return m_maxRadialCorridor;
80 }
81 
83 {
84  return m_minFieldExp;
85 }
86 
88 {
89  return m_outputNumber;
90 }
91 
93 {
94  return m_responseTime;
95 }
96 
98 {
100 }
101 
103 {
104  return m_strategy;
105 }
106 
108 {
109  return m_versionNumberIntern;
110 }
111 
113 {
114  return m_distDependent;
115 }
116 
118 {
119  return m_resultNegation;
120 }
121 
122 void EvalCase::setBlankingSize(double blankingSize)
123 {
124  this->m_blankingSize = blankingSize;
125 
126  // Consistency check
127  if (m_blankingSize > 10.0)
128  {
129  printWarning("EvalCase::setBlankingSize: Blanking size is very large. Was it really written in [m]?");
130  }
131 }
132 
133 void EvalCase::setCaseName(const std::string& caseName)
134 {
135  m_caseName = caseName;
136  if (m_caseName.length() > 32)
137  {
138  m_caseName = m_caseName.substr(0, 32);
139  }
140 }
141 
143 {
144  this->m_caseNumber = caseNumber;
145  if (m_caseNumber == 0)
146  {
147  printWarning("EvalCase::setCaseNumber: Case number must be >0 for a valid EvalCase!");
148  }
149 }
150 
151 void EvalCase::setComment(const std::string& comment)
152 {
153  m_comment = comment;
154  if (m_comment.length() > 128)
155  {
156  m_comment = m_comment.substr(0, 128);
157  }
158 }
159 
160 void EvalCase::setDistDependent(bool distDependent)
161 {
162  this->m_distDependent = distDependent;
163 }
164 
166 {
167  return m_distDependent;
168 }
169 
171 {
172  this->m_fieldNumber = fieldNumber;
173 }
174 
176 {
177  this->m_filterType = filterType;
178 }
179 
180 // void EvalCase::setHardwareInputs(const EvalCase::InputStateVector& hardwareInputs)
181 // {
182 // this->m_hardwareInputs = hardwareInputs;
183 // }
184 
185 // void EvalCase::setLogicalInputs(const EvalCase::InputStateVector& logicalInputs)
186 // {
187 // this->m_logicalInputs = logicalInputs;
188 // }
189 
190 void EvalCase::setMaxRadialCorridor(double maxRadialCorridor)
191 {
192  this->m_maxRadialCorridor = maxRadialCorridor;
193 }
194 
195 void EvalCase::setMinFieldExp(double minFieldExp)
196 {
197  this->m_minFieldExp = minFieldExp;
198 }
199 
201 {
202  this->m_outputNumber = outputNumber;
203 }
204 
206 {
207  this->m_responseTime = responseTime;
208 }
209 
210 void EvalCase::setResponseTimeExtended(UINT32 responseTimeExtended)
211 {
212  this->m_responseTimeExtended = responseTimeExtended;
213 }
214 
215 void EvalCase::setResultNegation(bool resultNegation)
216 {
217  this->m_resultNegation = resultNegation;
218 }
219 
221 {
222  return this->m_resultNegation;
223 }
224 
226 {
227  this->m_strategy = strategy;
228 }
229 
230 //
231 // Sets the internal version number, as used by the MRS.
232 //
234 {
235  this->m_versionNumberIntern = versionNumber;
236 }
237 
238 //
239 // Returns the internal version number, as used by the MRS.
240 //
242 {
243  return (this->m_versionNumberIntern);
244 }
245 
247 {
249 }
250 
252 {
253  m_manipulationPrevention = manPrev;
254 }
255 
256 //
257 // Decode the input state data from the sensor into this
258 // objects structure.
259 //
261 {
262  // Input 1
263  UINT8 inputValue = value & 0x03;
264  switch (inputValue)
265  {
266  case 0:
268  break;
269  case 1:
271  break;
272  case 2:
274  break;
275  default:
276  printError("EvalCase::setLogicalInputState_from_UINT8: Configuration of input 1 has an invalid value, aborting!");
277  return;
278  }
279 
280  // Input 2
281  inputValue = (value >> 2) & 0x03;
282  switch (inputValue)
283  {
284  case 0:
286  break;
287  case 1:
289  break;
290  case 2:
292  break;
293  default:
294  printError("EvalCase::setLogicalInputState_from_UINT8: Configuration of input 2 has an invalid value, aborting!");
295  return;
296  }
297 }
298 
299 
300 } // namespace datatypes
double m_minFieldExp
[m]; minimum radial distance between field start and end point
Definition: EvalCase.hpp:135
void printError(std::string message)
void setMinFieldExp(double minFieldExp)
Definition: EvalCase.cpp:195
void setResponseTime(UINT32 responseTime)
Definition: EvalCase.cpp:205
UINT16 m_outputNumber
output which belongs to this evaluation case
Definition: EvalCase.hpp:128
void setDistDependent(bool distDependent)
Definition: EvalCase.cpp:160
FilterType m_filterType
Definition: EvalCase.hpp:137
void setStrategy(EvaluationStrategy strategy)
Definition: EvalCase.cpp:225
double getMaxRadialCorridor() const
Definition: EvalCase.cpp:77
uint16_t UINT16
ManipulationPrevention m_manipulationPrevention
Definition: EvalCase.hpp:133
void setFieldNumber(UINT16 fieldNumber)
Definition: EvalCase.cpp:170
const std::string & getComment() const
Definition: EvalCase.cpp:51
double getMinFieldExp() const
Definition: EvalCase.cpp:82
bool getResultNegation()
Definition: EvalCase.cpp:220
ManipulationPrevention
Manipulation prevention. If active, shadowing of field parts may trigger an event.
Definition: EvalCase.hpp:58
uint32_t UINT32
const std::string & getCaseName() const
Definition: EvalCase.cpp:41
virtual ~EvalCase()
Definition: EvalCase.cpp:23
FilterType
kind of filter which is connected to evaluation case
Definition: EvalCase.hpp:65
UINT8 getOutputNumber() const
Definition: EvalCase.cpp:87
UINT16 m_fieldNumber
index of field which is connected to evaluation case
Definition: EvalCase.hpp:136
void setCaseName(const std::string &caseName)
Definition: EvalCase.cpp:133
FilterType getFilterType() const
Definition: EvalCase.cpp:61
input is not relevant for this evaluation case
Definition: EvalCase.hpp:52
void setOutputNumber(UINT8 outputNumber)
Definition: EvalCase.cpp:200
double getBlankingSize() const
Definition: EvalCase.cpp:36
UINT32 m_responseTimeExtended
[µs]
Definition: EvalCase.hpp:127
bool isDistDependent() const
Definition: EvalCase.cpp:112
UINT16 getFieldNumber() const
Definition: EvalCase.cpp:56
UINT32 getVersionNumberIntern() const
Definition: EvalCase.cpp:107
UINT32 getResponseTimeExtended() const
Definition: EvalCase.cpp:97
UINT32 getResponseTime() const
Definition: EvalCase.cpp:92
EvaluationStrategy getStrategy() const
Definition: EvalCase.cpp:102
bool m_distDependent
if TRUE field evaluation works distance dependent
Definition: EvalCase.hpp:131
double m_blankingSize
[m]; minimum object size
Definition: EvalCase.hpp:134
InputState m_logicalInputState[2]
Definition: EvalCase.hpp:121
void setVersionNumber(UINT16 versionNumber)
Definition: EvalCase.cpp:233
ManipulationPrevention getManipulationPrevention() const
Definition: EvalCase.cpp:246
void setBlankingSize(double blankingSize)
Definition: EvalCase.cpp:122
UINT8 getCaseNumber() const
Definition: EvalCase.cpp:46
void setLogicalInputState_from_UINT8(UINT8 value)
Definition: EvalCase.cpp:260
bool m_resultNegation
negation of evaluation result
Definition: EvalCase.hpp:125
void setCaseNumber(UINT8 caseNumber)
Definition: EvalCase.cpp:142
void setResultNegation(bool resultNegation)
Definition: EvalCase.cpp:215
UINT16 m_versionNumberIntern
Definition: EvalCase.hpp:122
void setResponseTimeExtended(UINT32 responseTimeExtended)
Definition: EvalCase.cpp:210
EvaluationStrategy m_strategy
Definition: EvalCase.hpp:124
virtual const UINT32 getUsedMemory() const
Definition: EvalCase.cpp:28
void setMaxRadialCorridor(double maxRadialCorridor)
Definition: EvalCase.cpp:190
void setFilterType(FilterType filterType)
Definition: EvalCase.cpp:175
void setManipulationPrevention(ManipulationPrevention manPrev)
Definition: EvalCase.cpp:251
void setComment(const std::string &comment)
Definition: EvalCase.cpp:151
bool isResultNegation() const
Definition: EvalCase.cpp:117
std::string m_caseName
name of evaluation case is optional
Definition: EvalCase.hpp:138
UINT16 getVersionNumber()
Definition: EvalCase.cpp:241
UINT32 m_responseTime
[µs]
Definition: EvalCase.hpp:126
double m_maxRadialCorridor
[m]; max radial corridor (only active if distance dependency is active)
Definition: EvalCase.hpp:132
std::string m_comment
comment is optional
Definition: EvalCase.hpp:139
const UINT8 getLogicalInputState_as_UINT8() const
Definition: EvalCase.cpp:71
void printWarning(std::string message)
uint8_t UINT8


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Sat Jun 8 2019 17:57:33