GenApi 3.5.1
IInteger.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// (c) 2006 by Basler Vision Technologies
3// Author: Fritz Dierks
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_IIINTEGER_H
30#define GENAPI_IIINTEGER_H
31
32#include <Base/GCUtilities.h>
33#include <GenApi/GenApiDll.h>
34#include <GenApi/Types.h>
35#include <GenApi/IValue.h>
36
37#ifdef _MSC_VER
38# pragma warning ( push )
39# pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
40#endif
41
42namespace GENAPI_NAMESPACE
43{
44 //*************************************************************
45 // IInteger interface
46 //*************************************************************
47
52 GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IInteger : virtual public IValue
53 {
55
59 virtual void SetValue(int64_t Value, bool Verify = true) = 0;
60
62 virtual IInteger& operator=(int64_t Value) = 0;
63
65
70 virtual int64_t GetValue(bool Verify = false, bool IgnoreCache = false ) = 0;
71
73 virtual int64_t operator()() = 0;
74
76 virtual int64_t operator*() = 0;
77
79 virtual int64_t GetMin() = 0;
80
82 virtual int64_t GetMax() = 0;
83
85 virtual EIncMode GetIncMode() = 0;
86
88 virtual int64_t GetInc() = 0;
89
91 virtual int64_autovector_t GetListOfValidValues(bool bounded = true) = 0;
92
95
98
100 virtual void ImposeMin(int64_t Value) = 0;
101
103 virtual void ImposeMax(int64_t Value) = 0;
104 };
105
106
107 //*************************************************************
108 // CIntegerRef class
109 //*************************************************************
110
111#ifndef DOXYGEN_IGNORE
112
113 GENICAM_INTERFACE IFloat;
114
120 template <class T, class I=T>
121 class CIntegerRefT : public CValueRefT<T, I>
122 {
123 typedef CValueRefT<T, I> ref;
124
125 public:
126 /*--------------------------------------------------------*/
127 // IInteger
128 /*--------------------------------------------------------*/
129
131 virtual void SetValue(int64_t Value, bool Verify = true)
132 {
133 if(!ref::m_Ptr)
134 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
135 ref::m_Ptr->SetValue(Value, Verify);
136 }
137
139 virtual IInteger& operator=(int64_t Value)
140 {
141 if(!ref::m_Ptr)
142 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
143 ref::m_Ptr->SetValue(Value);
144 return *this;
145 }
146
148 virtual int64_t GetValue( bool Verify = false, bool IgnoreCache = false )
149 {
150 if(!ref::m_Ptr)
151 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
152 return ref::m_Ptr->GetValue( Verify, IgnoreCache );
153 }
154
156 virtual int64_t operator()()
157 {
158 if(!ref::m_Ptr)
159 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
160 return ref::m_Ptr->operator()();
161 }
162
164 virtual int64_t operator*()
165 {
166 if(!ref::m_Ptr)
167 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
168 return ref::m_Ptr->operator*();
169 }
170
172 virtual int64_t GetMin()
173 {
174 if(!ref::m_Ptr)
175 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
176 return ref::m_Ptr->GetMin();
177 }
178
180 virtual int64_t GetMax()
181 {
182 if(!ref::m_Ptr)
183 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
184 return ref::m_Ptr->GetMax();
185 }
186
188 virtual EIncMode GetIncMode()
189 {
190 if(!ref::m_Ptr)
191 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
192 return ref::m_Ptr->GetIncMode();
193 }
194
196 virtual int64_t GetInc()
197 {
198 if(!ref::m_Ptr)
199 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
200 return ref::m_Ptr->GetInc();
201 }
202
204 virtual int64_autovector_t GetListOfValidValues(bool bounded = true)
205 {
206 if(!ref::m_Ptr)
207 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
208 return ref::m_Ptr->GetListOfValidValues(bounded);
209 }
210
212 virtual ERepresentation GetRepresentation()
213 {
214 if(!ref::m_Ptr)
215 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
216 return ref::m_Ptr->GetRepresentation();
217 }
218
220 virtual GENICAM_NAMESPACE::gcstring GetUnit()
221 {
222 if(!ref::m_Ptr)
223 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
224 return ref::m_Ptr->GetUnit();
225 }
226
228 IFloat *GetFloatAlias()
229 {
230 if(!ref::m_Ptr)
231 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
232 return dynamic_cast<IFloat*>(ref::m_Ptr->GetNode()->GetCastAlias());
233 }
234
236 virtual void ImposeMin(int64_t Value)
237 {
238 if(!ref::m_Ptr)
239 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
240 ref::m_Ptr->ImposeMin(Value);
241 }
242
244 virtual void ImposeMax(int64_t Value)
245 {
246 if(!ref::m_Ptr)
247 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
248 ref::m_Ptr->ImposeMax(Value);
249 }
250
251 };
252
255 typedef CIntegerRefT<IInteger> CIntegerRef;
256
257#endif
258
259}
260
261#ifdef _MSC_VER
262# pragma warning ( pop )
263#endif
264
265#endif // ifndef GENAPI_IIINTEGER_H
GenICam common utilities.
declspec's to be used for GenApi Windows dll
virtual IBoolean & operator=(bool Value)
Set node value.
Definition IBoolean.h:62
virtual bool operator()() const
Get node value.
Definition IBoolean.h:77
virtual bool GetValue(bool Verify=false, bool IgnoreCache=false) const =0
Get node value.
virtual GENICAM_NAMESPACE::gcstring operator*()=0
Get string node value.
virtual EIncMode GetIncMode()=0
Get increment mode.
virtual ERepresentation GetRepresentation()=0
Get recommended representation.
virtual double_autovector_t GetListOfValidValues(bool bounded=true)=0
Get list of valid value.
virtual double GetMax()=0
Get maximum value allowed.
virtual void ImposeMin(double Value)=0
Restrict minimum value.
virtual double GetMin()=0
Get minimum value allowed.
virtual GENICAM_NAMESPACE::gcstring GetUnit() const =0
Get the physical unit name.
virtual void ImposeMax(double Value)=0
Restrict maximum value.
virtual double GetInc()=0
Get the constant increment if there is any.
Definition of the interface IValue.
Common types used in the public GenApi interface.
Vector of integers with reference counting.
Definition Autovector.h:53
A string class which is a clone of std::string.
Definition GCString.h:51
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
Definition GCException.h:252
CIntegerRefT< IInteger > CIntegerRef
Definition IInteger.h:255
enum GENAPI_NAMESPACE::_EIncMode EIncMode
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IValue
Interface for value properties.
Definition IValue.h:59
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
Definition IFloat.h:58
GENICAM_INTERFACE IInteger
Interface for integer properties.
Definition IFloat.h:118
enum GENAPI_NAMESPACE::_ERepresentation ERepresentation