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 #pragma warning ( push ) 00039 #pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY 00040 00041 namespace GENAPI_NAMESPACE 00042 { 00043 //************************************************************* 00044 // IFloat interface 00045 //************************************************************* 00046 00051 interface GENAPI_DECL_ABSTRACT IFloat : virtual public IValue 00052 { 00054 00058 virtual void SetValue(double Value, bool Verify = true) = 0; 00059 00061 virtual IFloat& operator=(double Value) = 0; 00062 00064 00069 virtual double GetValue(bool Verify = false, bool IgnoreCache = false) = 0; 00070 00072 virtual double operator()() = 0; 00073 00075 virtual double operator*() = 0; 00076 00078 virtual double GetMin() = 0; 00079 00081 virtual double GetMax() = 0; 00082 00084 virtual bool HasInc() = 0; 00085 00087 virtual EIncMode GetIncMode() = 0; 00088 00090 virtual double GetInc() = 0; 00091 00093 virtual double_autovector_t GetListOfValidValues( bool bounded = true) = 0; 00094 00096 virtual ERepresentation GetRepresentation() = 0; 00097 00099 virtual GENICAM_NAMESPACE::gcstring GetUnit() const = 0; 00100 00102 virtual EDisplayNotation GetDisplayNotation() const = 0; 00103 00105 virtual int64_t GetDisplayPrecision() const = 0; 00106 00108 virtual void ImposeMin(double Value) = 0; 00109 00111 virtual void ImposeMax(double Value) = 0; 00112 }; 00113 00114 //************************************************************* 00115 // CFloatRef class 00116 //************************************************************* 00117 00118 interface IInteger; 00119 interface IEnumeration; 00120 00121 #ifndef DOXYGEN_IGNORE 00122 00128 template <class T> 00129 class CFloatRefT : public CValueRefT<T> 00130 { 00131 typedef CValueRefT<T> ref; 00132 00133 public: 00134 /*--------------------------------------------------------*/ 00135 // IFloat 00136 /*--------------------------------------------------------*/ 00137 00139 virtual void SetValue(double Value, bool Verify = true) 00140 { 00141 if(ref::m_Ptr) 00142 return ref::m_Ptr->SetValue(Value, Verify); 00143 else 00144 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00145 } 00146 00148 virtual IFloat& operator=(double Value) 00149 { 00150 if(ref::m_Ptr) 00151 return ref::m_Ptr->operator=(Value); 00152 else 00153 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00154 } 00155 00157 virtual double GetValue(bool Verify = false, bool IgnoreCache = false) 00158 { 00159 if(ref::m_Ptr) 00160 return ref::m_Ptr->GetValue(Verify, IgnoreCache); 00161 else 00162 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00163 } 00164 00166 virtual double operator()() 00167 { 00168 if(ref::m_Ptr) 00169 return ref::m_Ptr->operator()(); 00170 else 00171 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00172 } 00173 00175 virtual double operator*() 00176 { 00177 if(ref::m_Ptr) 00178 return ref::m_Ptr->operator*(); 00179 else 00180 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00181 } 00182 00184 virtual double GetMin() 00185 { 00186 if(ref::m_Ptr) 00187 return ref::m_Ptr->GetMin(); 00188 else 00189 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00190 } 00191 00193 virtual double GetMax() 00194 { 00195 if(ref::m_Ptr) 00196 return ref::m_Ptr->GetMax(); 00197 else 00198 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00199 } 00200 00202 virtual bool HasInc() 00203 { 00204 if(ref::m_Ptr) 00205 return ref::m_Ptr->HasInc(); 00206 else 00207 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00208 } 00209 virtual EIncMode GetIncMode() 00210 { 00211 if(ref::m_Ptr) 00212 return ref::m_Ptr->GetIncMode(); 00213 else 00214 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00215 } 00216 00218 virtual double GetInc() 00219 { 00220 if(ref::m_Ptr) 00221 return ref::m_Ptr->GetInc(); 00222 else 00223 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00224 } 00225 00227 virtual double_autovector_t GetListOfValidValues(bool bounded = true) 00228 { 00229 if(ref::m_Ptr) 00230 return ref::m_Ptr->GetListOfValidValues(bounded); 00231 else 00232 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00233 } 00234 00236 virtual ERepresentation GetRepresentation() 00237 { 00238 if(ref::m_Ptr) 00239 return ref::m_Ptr->GetRepresentation(); 00240 else 00241 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00242 } 00243 00245 virtual GENICAM_NAMESPACE::gcstring GetUnit() const 00246 { 00247 if (ref::m_Ptr) 00248 return ref::m_Ptr->GetUnit(); 00249 else 00250 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00251 } 00252 00254 virtual EDisplayNotation GetDisplayNotation() const 00255 { 00256 if (ref::m_Ptr) 00257 return ref::m_Ptr->GetDisplayNotation(); 00258 else 00259 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00260 } 00261 00263 virtual int64_t GetDisplayPrecision() const 00264 { 00265 if (ref::m_Ptr) 00266 return ref::m_Ptr->GetDisplayPrecision(); 00267 else 00268 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00269 } 00270 00272 IInteger *GetIntAlias() 00273 { 00274 if (ref::m_Ptr) 00275 return dynamic_cast<IInteger*>(ref::m_Ptr->GetNode()->GetCastAlias()); 00276 else 00277 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00278 } 00279 00281 IEnumeration *GetEnumAlias() 00282 { 00283 if (ref::m_Ptr) 00284 return dynamic_cast<IEnumeration*>(ref::m_Ptr->GetNode()->GetCastAlias()); 00285 else 00286 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00287 } 00288 00290 virtual void ImposeMin(double Value) 00291 { 00292 if(ref::m_Ptr) 00293 return ref::m_Ptr->ImposeMin(Value); 00294 else 00295 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00296 } 00297 00299 virtual void ImposeMax(double Value) 00300 { 00301 if(ref::m_Ptr) 00302 return ref::m_Ptr->ImposeMax(Value); 00303 else 00304 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00305 } 00306 00307 }; 00308 00311 typedef CFloatRefT<IFloat> CFloatRef; 00312 00313 #endif 00314 00315 } 00316 00317 #pragma warning ( pop ) 00318 00319 #endif // ifndef GENAPI_IFLOAT_H