SwissKnife.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2006 by Basler Vision Technologies
3 // Section: Vision Components
4 // Project: GenApi
5 // Author: Margret Albrecht
6 // $Header$
7 //
8 // License: This file is published under the license of the EMVA GenICam Standard Group.
9 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
10 // If for some reason you are missing this file please contact the EMVA or visit the website
11 // (http://www.genicam.org) for a full copy.
12 //
13 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
14 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
17 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
20 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
21 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
23 // POSSIBILITY OF SUCH DAMAGE.
24 //-----------------------------------------------------------------------------
31 #ifndef GENAPI_SWISSKNIFE_H
32 #define GENAPI_SWISSKNIFE_H
33 
34 #include "../IFloat.h"
35 #include "Node.h"
36 #include "MathParser/MathParser.h"
37 #include "BaseT.h"
38 #include "ValueT.h"
39 #include "NodeT.h"
40 #include "NodeMap.h"
41 #include "FloatT.h"
42 
43 namespace GENAPI_NAMESPACE
44 {
45  //*************************************************************
46  // CSwissKnife class
47  //*************************************************************
48 
57  class CSwissKnifeImpl : public IFloat, public CNodeImpl
58  {
59  public:
62 
64  virtual ~CSwissKnifeImpl();
65 
66  protected:
67  //-------------------------------------------------------------
68  // IBase implementation
69  //-------------------------------------------------------------
70 
71  // Get access mode
72  virtual EAccessMode InternalGetAccessMode() const;
73 
76  {
77  return intfIFloat;
78  }
79 
80 
81  public:
82  //-------------------------------------------------------------
83  // IInteger implementation
84  //-------------------------------------------------------------
85 
87 
88  virtual double GetValueWithInput(double input, bool Verify = false, bool IgnoreCache = false);
89 
90  protected:
91  //-------------------------------------------------------------
92  // IFloat implementation
93  //-------------------------------------------------------------
94 
95  // Set feature value
96  #pragma BullseyeCoverage off
97  virtual void InternalSetValue(double /*Value*/, bool /*Verify*/ )
98  {
99  throw LOGICAL_ERROR_EXCEPTION_NODE("SwissKnife : %s SetValue failed. SwissKnife is read only", m_Name.c_str() );
100  }
101  #pragma BullseyeCoverage on
102 
103  // Get feature value
104  virtual double InternalGetValue(bool Verify = false, bool IgnoreCache = false);
105 
106  // Get minimum value allowed
107  virtual double InternalGetMin()
108  {
109  return m_Min;
110  }
111 
112  // Get maximum value allowed
113  virtual double InternalGetMax()
114  {
115  return m_Max;
116  }
117 
119  virtual bool InternalHasInc()
120  {
121  // a swiss knife does not know about its increments
122  return false;
123  }
124 
126  #pragma BullseyeCoverage off
127  // (untestable, function never called)
128  virtual double InternalGetInc()
129  {
130  assert(false);
131  return -1.0;
132  }
133  #pragma BullseyeCoverage on
134 
137  {
138  return double_autovector_t();
139  }
140 
141 
142  // Get recommended representation
144  {
146  return m_Representation;
147  else
148  return PureNumber;
149  }
150 
151  // Get unit
153  {
154  return m_Unit;
155  }
156 
159  {
160  return m_DisplayNotation;
161  }
162 
165  {
166  return m_DisplayPrecision;
167  }
168 
170  virtual ECachingMode InternalGetCachingMode() const;
171 
172  public:
173  //-------------------------------------------------------------
174  // Initializing
175  //-------------------------------------------------------------
176 
177  virtual void FinalConstruct();
178 
179  virtual void SetProperty( CProperty &Property );
180 
181  virtual bool GetProperty(CNodeDataMap *pNodeDataMap, CPropertyID::EProperty_ID_t PropertyID, CNodeData::PropertyVector_t &PropertyList) const;
182  virtual void Parse();
183 
184  protected:
185 
186  //-------------------------------------------------------------
187  // Member variables
188  //-------------------------------------------------------------
189 
191  double m_Min;
192 
194  double m_Max;
195 
198 
200  std::map<GENICAM_NAMESPACE::gcstring, GENICAM_NAMESPACE::gcstring> m_Symbolics;
201 
203  std::map<GENICAM_NAMESPACE::gcstring, CFloatPolyRef> m_Variables;
204 
207 
210 
213 
216 
219 
222 
224 
226 
229 
232 
233  };
234 
235  class CSwissKnife : public BaseT< ValueT< NodeT< FloatT< CSwissKnifeImpl > > > >
236  {
237  };
238 
239 }
240 
241 #endif // GENAPI_SWISSKNIFE_H
GENAPI_NAMESPACE::EInputDirection m_InputDirection
Indicates if the SwissKnife is part of a Converter and shows which direction is implemented.
Definition: SwissKnife.h:228
GENICAM_NAMESPACE::gcstring m_InputName
A hard-coded variable name.
Definition: SwissKnife.h:225
Definition of the ValueT class template.
virtual ERepresentation InternalGetRepresentation()
Definition: SwissKnife.h:143
CStrMap m_VariableMap
the vairble used by th parser
Definition: SwissKnife.h:206
virtual EInterfaceType InternalGetPrincipalInterfaceType() const
Implementation of IBase::GetPrincipalInterfaceType()
Definition: SwissKnife.h:75
IFloat interface.
Definition: Types.h:196
GENICAM_NAMESPACE::gcstring m_Name
The name of the node.
Definition: Node.h:370
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT bool Verify
Definition: IBoolean.h:61
virtual GENICAM_NAMESPACE::gcstring InternalGetUnit() const
Definition: SwissKnife.h:152
double m_Min
minimum value to be stored in the Register
Definition: SwissKnife.h:191
std::map< GENICAM_NAMESPACE::gcstring, GENICAM_NAMESPACE::gcstring > m_Symbolics
Mapping of the variable&#39;s node names to the SYMBOLIC names in the formulas.
Definition: SwissKnife.h:200
Specialized SwissKnife for float nodes.
Definition: SwissKnife.h:57
Decimal number in an edit control.
Definition: Types.h:94
Vector of doubles with reference counting.
Definition: Autovector.h:76
__int64 int64_t
Definition: config-win32.h:21
EDisplayNotation m_DisplayNotation
the printf format specifier used to convert the float number to a string
Definition: SwissKnife.h:218
virtual EAccessMode InternalGetAccessMode() const
Get the access mode of the node.
double m_Max
maximum value to be stored in the Register
Definition: SwissKnife.h:194
virtual void InternalSetValue(double, bool)
Definition: SwissKnife.h:97
Expression parser and evaluator of CSwissKnife.
Definition: MathParser.h:53
Implementation of the IBase interface.
Definition: BaseT.h:48
virtual int64_t InternalGetDisplayPrecision() const
Get the precision to be used when converting the float to a string.
Definition: SwissKnife.h:164
Definition of the NodeT class template.
CFloatPolyRef m_Input
Pointer to the input required when the SwissKnife is used to implement a Converter.
Definition: SwissKnife.h:231
CMathParser m_MathParser
the parser doing the actual work
Definition: SwissKnife.h:209
enum GENAPI_NAMESPACE::_ERepresentation ERepresentation
recommended representation of a node value
enum GENAPI_NAMESPACE::_ECachingMode ECachingMode
caching mode of a register
GENICAM_NAMESPACE::gcstring m_Formula
the formula evaluated by the swiss knife
Definition: SwissKnife.h:197
enum GENAPI_NAMESPACE::_EDisplayNotation EDisplayNotation
typedef for float notation
virtual double InternalGetValue(bool Verify=false, bool IgnoreCache=false)
#define LOGICAL_ERROR_EXCEPTION_NODE
Fires a logical error exception, e.g. throw LOGICAL_ERROR_EXCEPTION("Should never reach this point") ...
Definition: Exception.h:169
virtual EDisplayNotation InternalGetDisplayNotation() const
Get the way the float should be converted to a string.
Definition: SwissKnife.h:158
Definition of the BaseT class template.
Standard implementation for the INode and the ISelector interface.
Definition: Node.h:86
virtual double InternalGetInc()
Get the constant increment if there is any.
Definition: SwissKnife.h:128
virtual bool GetProperty(CNodeDataMap *pNodeDataMap, CPropertyID::EProperty_ID_t PropertyID, CNodeData::PropertyVector_t &PropertyList) const
A reference to a float which can be either a double variable, or a pointer to an IFloat, IInteger, or an IEnumeration interface.
A string class which is a clone of std::string.
Definition: GCString.h:52
virtual double GetValueWithInput(double input, bool Verify=false, bool IgnoreCache=false)
Get feature value using m_InputName as hard coded variable name.
virtual bool InternalHasInc()
True if the float has a constant increment.
Definition: SwissKnife.h:119
virtual ECachingMode InternalGetCachingMode() const
Get Caching Mode.
ERepresentation m_Representation
the node&#39;s representation
Definition: SwissKnife.h:212
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
access mode of a node
enum GENAPI_NAMESPACE::_EInputDirection EInputDirection
typedef for link type
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
Definition: IFloat.h:60
Definition of CMathParser.
Declaration of CNodeMap.
virtual const double_autovector_t InternalGetListOfValidValues()
Get list of valid value.
Definition: SwissKnife.h:136
Definition of the FloatT class template.
virtual const char * c_str(void) const
Lexical analyzer for CIntSwissKnife.
Definition: Autovector.h:48
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
typedef for interface type
GENICAM_NAMESPACE::gcstring m_Unit
the physical unit name
Definition: SwissKnife.h:215
virtual void SetProperty(CProperty &Property)
std::map< GENICAM_NAMESPACE::gcstring, CFloatPolyRef > m_Variables
Mapping of SYMBOLIC names to the references of the variables.
Definition: SwissKnife.h:203
int64_t m_DisplayPrecision
the precision the float is converted with to a string
Definition: SwissKnife.h:221
virtual ~CSwissKnifeImpl()
Destructor.


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Wed Mar 17 2021 02:48:41