00001 //----------------------------------------------------------------------------- 00002 // (c) 2006 by Basler Vision Technologies 00003 // Section: Vision Components 00004 // Project: GenApi 00005 // Author: Margret Albrecht 00006 // $Header$ 00007 // 00008 // License: This file is published under the license of the EMVA GenICam Standard Group. 00009 // A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'. 00010 // If for some reason you are missing this file please contact the EMVA or visit the website 00011 // (http://www.genicam.org) for a full copy. 00012 // 00013 // THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS" 00014 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 00015 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 00016 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP 00017 // OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00018 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00019 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 00020 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 00021 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 00022 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 00023 // POSSIBILITY OF SUCH DAMAGE. 00024 //----------------------------------------------------------------------------- 00031 #ifndef GENAPI_IFLOAT_H 00032 #define GENAPI_IFLOAT_H 00033 00034 #include <GenApi/GenApiDll.h> 00035 #include <GenApi/Types.h> 00036 #include <GenApi/IValue.h> 00037 00038 #ifdef _MSC_VER 00039 # pragma warning ( push ) 00040 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY 00041 #endif 00042 00043 namespace GENAPI_NAMESPACE 00044 { 00045 //************************************************************* 00046 // IFloat interface 00047 //************************************************************* 00048 00053 interface GENAPI_DECL_ABSTRACT IFloat : virtual public IValue 00054 { 00056 00060 virtual void SetValue(double Value, bool Verify = true) = 0; 00061 00063 virtual IFloat& operator=(double Value) = 0; 00064 00066 00071 virtual double GetValue(bool Verify = false, bool IgnoreCache = false) = 0; 00072 00074 virtual double operator()() = 0; 00075 00077 virtual double operator*() = 0; 00078 00080 virtual double GetMin() = 0; 00081 00083 virtual double GetMax() = 0; 00084 00086 virtual bool HasInc() = 0; 00087 00089 virtual EIncMode GetIncMode() = 0; 00090 00092 virtual double GetInc() = 0; 00093 00095 virtual double_autovector_t GetListOfValidValues( bool bounded = true) = 0; 00096 00098 virtual ERepresentation GetRepresentation() = 0; 00099 00101 virtual GENICAM_NAMESPACE::gcstring GetUnit() const = 0; 00102 00104 virtual EDisplayNotation GetDisplayNotation() const = 0; 00105 00107 virtual int64_t GetDisplayPrecision() const = 0; 00108 00110 virtual void ImposeMin(double Value) = 0; 00111 00113 virtual void ImposeMax(double Value) = 0; 00114 }; 00115 00116 //************************************************************* 00117 // CFloatRef class 00118 //************************************************************* 00119 00120 interface IInteger; 00121 interface IEnumeration; 00122 00123 #ifndef DOXYGEN_IGNORE 00124 00130 template <class T> 00131 class CFloatRefT : public CValueRefT<T> 00132 { 00133 typedef CValueRefT<T> ref; 00134 00135 public: 00136 /*--------------------------------------------------------*/ 00137 // IFloat 00138 /*--------------------------------------------------------*/ 00139 00141 virtual void SetValue(double Value, bool Verify = true) 00142 { 00143 if(ref::m_Ptr) 00144 return ref::m_Ptr->SetValue(Value, Verify); 00145 else 00146 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00147 } 00148 00150 virtual IFloat& operator=(double Value) 00151 { 00152 if(ref::m_Ptr) 00153 return ref::m_Ptr->operator=(Value); 00154 else 00155 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00156 } 00157 00159 virtual double GetValue(bool Verify = false, bool IgnoreCache = false) 00160 { 00161 if(ref::m_Ptr) 00162 return ref::m_Ptr->GetValue(Verify, IgnoreCache); 00163 else 00164 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00165 } 00166 00168 virtual double operator()() 00169 { 00170 if(ref::m_Ptr) 00171 return ref::m_Ptr->operator()(); 00172 else 00173 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00174 } 00175 00177 virtual double operator*() 00178 { 00179 if(ref::m_Ptr) 00180 return ref::m_Ptr->operator*(); 00181 else 00182 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00183 } 00184 00186 virtual double GetMin() 00187 { 00188 if(ref::m_Ptr) 00189 return ref::m_Ptr->GetMin(); 00190 else 00191 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00192 } 00193 00195 virtual double GetMax() 00196 { 00197 if(ref::m_Ptr) 00198 return ref::m_Ptr->GetMax(); 00199 else 00200 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00201 } 00202 00204 virtual bool HasInc() 00205 { 00206 if(ref::m_Ptr) 00207 return ref::m_Ptr->HasInc(); 00208 else 00209 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00210 } 00211 virtual EIncMode GetIncMode() 00212 { 00213 if(ref::m_Ptr) 00214 return ref::m_Ptr->GetIncMode(); 00215 else 00216 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00217 } 00218 00220 virtual double GetInc() 00221 { 00222 if(ref::m_Ptr) 00223 return ref::m_Ptr->GetInc(); 00224 else 00225 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00226 } 00227 00229 virtual double_autovector_t GetListOfValidValues(bool bounded = true) 00230 { 00231 if(ref::m_Ptr) 00232 return ref::m_Ptr->GetListOfValidValues(bounded); 00233 else 00234 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00235 } 00236 00238 virtual ERepresentation GetRepresentation() 00239 { 00240 if(ref::m_Ptr) 00241 return ref::m_Ptr->GetRepresentation(); 00242 else 00243 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00244 } 00245 00247 virtual GENICAM_NAMESPACE::gcstring GetUnit() const 00248 { 00249 if (ref::m_Ptr) 00250 return ref::m_Ptr->GetUnit(); 00251 else 00252 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00253 } 00254 00256 virtual EDisplayNotation GetDisplayNotation() const 00257 { 00258 if (ref::m_Ptr) 00259 return ref::m_Ptr->GetDisplayNotation(); 00260 else 00261 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00262 } 00263 00265 virtual int64_t GetDisplayPrecision() const 00266 { 00267 if (ref::m_Ptr) 00268 return ref::m_Ptr->GetDisplayPrecision(); 00269 else 00270 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00271 } 00272 00274 IInteger *GetIntAlias() 00275 { 00276 if (ref::m_Ptr) 00277 return dynamic_cast<IInteger*>(ref::m_Ptr->GetNode()->GetCastAlias()); 00278 else 00279 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00280 } 00281 00283 IEnumeration *GetEnumAlias() 00284 { 00285 if (ref::m_Ptr) 00286 return dynamic_cast<IEnumeration*>(ref::m_Ptr->GetNode()->GetCastAlias()); 00287 else 00288 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00289 } 00290 00292 virtual void ImposeMin(double Value) 00293 { 00294 if(ref::m_Ptr) 00295 return ref::m_Ptr->ImposeMin(Value); 00296 else 00297 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00298 } 00299 00301 virtual void ImposeMax(double Value) 00302 { 00303 if(ref::m_Ptr) 00304 return ref::m_Ptr->ImposeMax(Value); 00305 else 00306 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00307 } 00308 00309 }; 00310 00313 typedef CFloatRefT<IFloat> CFloatRef; 00314 00315 #endif 00316 00317 } 00318 00319 #ifdef _MSC_VER 00320 # pragma warning ( pop ) 00321 #endif 00322 00323 #endif // ifndef GENAPI_IFLOAT_H