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 "FloatT.h"
41 
42 namespace GENAPI_NAMESPACE
43 {
44  //*************************************************************
45  // CSwissKnife class
46  //*************************************************************
47 
56  class CSwissKnifeImpl : public IFloat, public CNodeImpl
57  {
58  public:
61 
63  virtual ~CSwissKnifeImpl();
64 
65  protected:
66  //-------------------------------------------------------------
67  // IBase implementation
68  //-------------------------------------------------------------
69 
70  // Get access mode
71  virtual EAccessMode InternalGetAccessMode() const;
72 
75  {
76  return intfIFloat;
77  }
78 
79 
80  public:
81  //-------------------------------------------------------------
82  // IInteger implementation
83  //-------------------------------------------------------------
84 
86 
87  virtual double GetValueWithInput(double input, bool Verify = false, bool IgnoreCache = false);
88 
89  protected:
90  //-------------------------------------------------------------
91  // IFloat implementation
92  //-------------------------------------------------------------
93 
94  // Set feature value
95  #pragma BullseyeCoverage off
96  virtual void InternalSetValue(double /*Value*/, bool /*Verify*/ )
97  {
98  throw LOGICAL_ERROR_EXCEPTION_NODE("SwissKnife : %s SetValue failed. SwissKnife is read only", m_Name.c_str() );
99  }
100  #pragma BullseyeCoverage on
101 
102  // Get feature value
103  virtual double InternalGetValue(bool Verify = false, bool IgnoreCache = false);
104 
105  // Get minimum value allowed
106  virtual double InternalGetMin()
107  {
108  return m_Min;
109  }
110 
111  // Get maximum value allowed
112  virtual double InternalGetMax()
113  {
114  return m_Max;
115  }
116 
118  virtual bool InternalHasInc()
119  {
120  // a swiss knife does not know about its increments
121  return false;
122  }
123 
125  #pragma BullseyeCoverage off
126  // (untestable, function never called)
127  virtual double InternalGetInc()
128  {
129  assert(false);
130  return -1.0;
131  }
132  #pragma BullseyeCoverage on
133 
136  {
137  return double_autovector_t();
138  }
139 
140 
141  // Get recommended representation
143  {
145  return m_Representation;
146  else
147  return PureNumber;
148  }
149 
150  // Get unit
152  {
153  return m_Unit;
154  }
155 
158  {
159  return m_DisplayNotation;
160  }
161 
164  {
165  return m_DisplayPrecision;
166  }
167 
169  virtual ECachingMode InternalGetCachingMode() const;
170 
171  public:
172  //-------------------------------------------------------------
173  // Initializing
174  //-------------------------------------------------------------
175 
176  virtual void FinalConstruct();
177 
178  virtual void SetProperty( CProperty &Property );
179 
180  virtual bool GetProperty(CNodeDataMap *pNodeDataMap, CPropertyID::EProperty_ID_t PropertyID, CNodeData::PropertyVector_t &PropertyList) const;
181  virtual void Parse();
182 
183  protected:
184 
185  //-------------------------------------------------------------
186  // Member variables
187  //-------------------------------------------------------------
188 
190  double m_Min;
191 
193  double m_Max;
194 
197 
199  std::map<GENICAM_NAMESPACE::gcstring, GENICAM_NAMESPACE::gcstring> m_Symbolics;
200 
202  std::map<GENICAM_NAMESPACE::gcstring, CFloatPolyRef> m_Variables;
203 
206 
209 
212 
215 
218 
221 
223 
225 
228 
231 
232  };
233 
234  class CSwissKnife : public BaseT< ValueT< NodeT< FloatT< CSwissKnifeImpl > > > >
235  {
236  };
237 
238 }
239 
240 #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:227
Map for variables in swissknife expression.
Definition: StrMap.h:27
GENICAM_NAMESPACE::gcstring m_InputName
A hard-coded variable name.
Definition: SwissKnife.h:224
Definition of the ValueT class template.
virtual ERepresentation InternalGetRepresentation()
Definition: SwissKnife.h:142
CStrMap m_VariableMap
the vairble used by th parser
Definition: SwissKnife.h:205
virtual EInterfaceType InternalGetPrincipalInterfaceType() const
Implementation of IBase::GetPrincipalInterfaceType()
Definition: SwissKnife.h:74
IFloat interface.
Definition: Types.h:196
GENICAM_NAMESPACE::gcstring m_Name
The name of the node.
Definition: Node.h:369
virtual GENICAM_NAMESPACE::gcstring InternalGetUnit() const
Definition: SwissKnife.h:151
double m_Min
minimum value to be stored in the Register
Definition: SwissKnife.h:190
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:199
Specialized SwissKnife for float nodes.
Definition: SwissKnife.h:56
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:217
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:193
virtual void InternalSetValue(double, bool)
Definition: SwissKnife.h:96
interface GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
Definition: IFloat.h:60
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:163
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:230
CMathParser m_MathParser
the parser doing the actual work
Definition: SwissKnife.h:208
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:196
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
interface GENAPI_DECL_ABSTRACT bool Verify
Definition: IBoolean.h:61
virtual EDisplayNotation InternalGetDisplayNotation() const
Get the way the float should be converted to a string.
Definition: SwissKnife.h:157
Definition of the BaseT class template.
Standard implementation for the INode and the ISelector interface.
Definition: Node.h:85
virtual double InternalGetInc()
Get the constant increment if there is any.
Definition: SwissKnife.h:127
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:118
virtual ECachingMode InternalGetCachingMode() const
Get Caching Mode.
ERepresentation m_Representation
the node&#39;s representation
Definition: SwissKnife.h:211
enum GENAPI_NAMESPACE::_EAccessMode EAccessMode
access mode of a node
enum GENAPI_NAMESPACE::_EInputDirection EInputDirection
typedef for link type
Definition of CMathParser.
virtual const double_autovector_t InternalGetListOfValidValues()
Get list of valid value.
Definition: SwissKnife.h:135
Definition of the FloatT class template.
virtual const char * c_str(void) const
Part of the generic device API.
Definition: Autovector.h:48
enum GENAPI_NAMESPACE::_EInterfaceType EInterfaceType
typedef for interface type
Expression parser and evaluator of CSwissKnife.
Definition: MathParser.h:51
GENICAM_NAMESPACE::gcstring m_Unit
the physical unit name
Definition: SwissKnife.h:214
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:202
int64_t m_DisplayPrecision
the precision the float is converted with to a string
Definition: SwissKnife.h:220
virtual ~CSwissKnifeImpl()
Destructor.


rc_genicam_api
Author(s): Heiko Hirschmueller
autogenerated on Thu Jun 6 2019 19:10:54