GenApi  3.5.1
IFloat.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2006 by Basler Vision Technologies
3 // Author: Margret Albrecht
4 //
5 // License: This file is published under the license of the EMVA GenICam Standard Group.
6 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
7 // If for some reason you are missing this file please contact the EMVA or visit the website
8 // (http://www.genicam.org) for a full copy.
9 //
10 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
11 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
12 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
13 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
14 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
15 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20 // POSSIBILITY OF SUCH DAMAGE.
21 //
22 //-----------------------------------------------------------------------------
29 #ifndef GENAPI_IFLOAT_H
30 #define GENAPI_IFLOAT_H
31 
32 #include <GenApi/GenApiDll.h>
33 #include <GenApi/Types.h>
34 #include <GenApi/IValue.h>
35 
36 #ifdef _MSC_VER
37 # pragma warning ( push )
38 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
39 #endif
40 
41 namespace GENAPI_NAMESPACE
42 {
43  //*************************************************************
44  // IFloat interface
45  //*************************************************************
46 
51  GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IFloat : virtual public IValue
52  {
54 
58  virtual void SetValue(double Value, bool Verify = true) = 0;
59 
61  virtual IFloat& operator=(double Value) = 0;
62 
64 
69  virtual double GetValue(bool Verify = false, bool IgnoreCache = false) = 0;
70 
72  virtual double operator()() = 0;
73 
75  virtual double operator*() = 0;
76 
78  virtual double GetMin() = 0;
79 
81  virtual double GetMax() = 0;
82 
84  virtual bool HasInc() = 0;
85 
87  virtual EIncMode GetIncMode() = 0;
88 
90  virtual double GetInc() = 0;
91 
93  virtual double_autovector_t GetListOfValidValues( bool bounded = true) = 0;
94 
96  virtual ERepresentation GetRepresentation() = 0;
97 
99  virtual GENICAM_NAMESPACE::gcstring GetUnit() const = 0;
100 
102  virtual EDisplayNotation GetDisplayNotation() const = 0;
103 
105  virtual int64_t GetDisplayPrecision() const = 0;
106 
108  virtual void ImposeMin(double Value) = 0;
109 
111  virtual void ImposeMax(double Value) = 0;
112  };
113 
114  //*************************************************************
115  // CFloatRef class
116  //*************************************************************
117 
118  GENICAM_INTERFACE IInteger;
119  GENICAM_INTERFACE IEnumeration;
120 
121 #ifndef DOXYGEN_IGNORE
122 
128  template <class T>
129  class CFloatRefT : public CValueRefT<T>
130  {
131  typedef CValueRefT<T> ref;
132 
133  public:
134  /*--------------------------------------------------------*/
135  // IFloat
136  /*--------------------------------------------------------*/
137 
139  virtual void SetValue(double Value, bool Verify = true)
140  {
141  if(!ref::m_Ptr)
142  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
143  ref::m_Ptr->SetValue(Value, Verify);
144  }
145 
147  virtual IFloat& operator=(double Value)
148  {
149  if(!ref::m_Ptr)
150  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
151  return ref::m_Ptr->operator=(Value);
152  }
153 
155  virtual double GetValue(bool Verify = false, bool IgnoreCache = false)
156  {
157  if(!ref::m_Ptr)
158  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
159  return ref::m_Ptr->GetValue(Verify, IgnoreCache);
160  }
161 
163  virtual double operator()()
164  {
165  if(!ref::m_Ptr)
166  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
167  return ref::m_Ptr->operator()();
168  }
169 
171  virtual double operator*()
172  {
173  if(!ref::m_Ptr)
174  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
175  return ref::m_Ptr->operator*();
176  }
177 
179  virtual double GetMin()
180  {
181  if(!ref::m_Ptr)
182  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
183  return ref::m_Ptr->GetMin();
184  }
185 
187  virtual double GetMax()
188  {
189  if(!ref::m_Ptr)
190  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
191  return ref::m_Ptr->GetMax();
192  }
193 
195  virtual bool HasInc()
196  {
197  if(!ref::m_Ptr)
198  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
199  return ref::m_Ptr->HasInc();
200  }
201  virtual EIncMode GetIncMode()
202  {
203  if(!ref::m_Ptr)
204  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
205  return ref::m_Ptr->GetIncMode();
206  }
207 
209  virtual double GetInc()
210  {
211  if(!ref::m_Ptr)
212  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
213  return ref::m_Ptr->GetInc();
214  }
215 
217  virtual double_autovector_t GetListOfValidValues(bool bounded = true)
218  {
219  if(!ref::m_Ptr)
220  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
221  return ref::m_Ptr->GetListOfValidValues(bounded);
222  }
223 
226  {
227  if(!ref::m_Ptr)
228  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
229  return ref::m_Ptr->GetRepresentation();
230  }
231 
233  virtual GENICAM_NAMESPACE::gcstring GetUnit() const
234  {
235  if (!ref::m_Ptr)
236  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
237  return ref::m_Ptr->GetUnit();
238  }
239 
241  virtual EDisplayNotation GetDisplayNotation() const
242  {
243  if (!ref::m_Ptr)
244  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
245  return ref::m_Ptr->GetDisplayNotation();
246  }
247 
249  virtual int64_t GetDisplayPrecision() const
250  {
251  if(!ref::m_Ptr)
252  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
253  return ref::m_Ptr->GetDisplayPrecision();
254  }
255 
257  IInteger *GetIntAlias()
258  {
259  if (!ref::m_Ptr)
260  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
261  return dynamic_cast<IInteger*>(ref::m_Ptr->GetNode()->GetCastAlias());
262  }
263 
265  IEnumeration *GetEnumAlias()
266  {
267  if(!ref::m_Ptr)
268  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
269  return dynamic_cast<IEnumeration*>(ref::m_Ptr->GetNode()->GetCastAlias());
270  }
271 
273  virtual void ImposeMin(double Value)
274  {
275  if(!ref::m_Ptr)
276  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
277  ref::m_Ptr->ImposeMin(Value);
278  }
279 
281  virtual void ImposeMax(double Value)
282  {
283  if(!ref::m_Ptr)
284  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
285  ref::m_Ptr->ImposeMax(Value);
286  }
287 
288  };
289 
292  typedef CFloatRefT<IFloat> CFloatRef;
293 
294 #endif
295 
296 }
297 
298 #ifdef _MSC_VER
299 # pragma warning ( pop )
300 #endif
301 
302 #endif // ifndef GENAPI_IFLOAT_H
enum GENAPI_NAMESPACE::_EIncMode EIncMode
virtual EIncMode GetIncMode()=0
Get increment mode.
Common types used in the public GenApi interface.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
Definition: IFloat.h:58
virtual void ImposeMin(double Value)=0
Restrict minimum value.
virtual bool operator()() const
Get node value.
Definition: IBoolean.h:77
enum GENAPI_NAMESPACE::_ERepresentation ERepresentation
Vector of doubles with reference counting.
Definition: Autovector.h:74
virtual double GetMin()=0
Get minimum value allowed.
virtual double GetInc()=0
Get the constant increment if there is any.
virtual GENICAM_NAMESPACE::gcstring operator*()=0
Get string node value.
virtual void ImposeMax(double Value)=0
Restrict maximum value.
virtual IBoolean & operator=(bool Value)
Set node value.
Definition: IBoolean.h:62
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
Definition: GCException.h:252
virtual bool HasInc()=0
True if the float has a constant increment.
virtual GENICAM_NAMESPACE::gcstring GetUnit() const =0
Get the physical unit name.
CFloatRefT< IFloat > CFloatRef
Definition: IFloat.h:292
virtual ERepresentation GetRepresentation()=0
Get recommended representation.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IEnumeration
Interface for enumeration properties.
Definition: IEnumeration.h:58
virtual double_autovector_t GetListOfValidValues(bool bounded=true)=0
Get list of valid value.
virtual int64_t GetDisplayPrecision() const =0
Get the precision to be used when converting the float to a string.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IValue
Interface for value properties.
Definition: IValue.h:59
A string class which is a clone of std::string.
Definition: GCString.h:50
virtual EDisplayNotation GetDisplayNotation() const =0
Get the way the float should be converted to a string.
GENICAM_INTERFACE IInteger
Interface for integer properties.
Definition: IFloat.h:112
virtual bool GetValue(bool Verify=false, bool IgnoreCache=false) const =0
Get node value.
declspec&#39;s to be used for GenApi Windows dll
enum GENAPI_NAMESPACE::_EDisplayNotation EDisplayNotation
Definition of the interface IValue.
Definition: ChunkAdapter.h:37
virtual double GetMax()=0
Get maximum value allowed.