00001 //----------------------------------------------------------------------------- 00002 // (c) 2006 by Basler Vision Technologies 00003 // Section: Vision Components 00004 // Project: GenApi 00005 // Author: Fritz Dierks 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_IIINTEGER_H 00032 #define GENAPI_IIINTEGER_H 00033 00034 #include <Base/GCUtilities.h> 00035 #include <GenApi/GenApiDll.h> 00036 #include <GenApi/Types.h> 00037 #include <GenApi/IValue.h> 00038 00039 #ifdef _MSC_VER 00040 # pragma warning ( push ) 00041 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY 00042 #endif 00043 00044 namespace GENAPI_NAMESPACE 00045 { 00046 //************************************************************* 00047 // IInteger interface 00048 //************************************************************* 00049 00054 interface GENAPI_DECL_ABSTRACT IInteger : virtual public IValue 00055 { 00057 00061 virtual void SetValue(int64_t Value, bool Verify = true) = 0; 00062 00064 virtual IInteger& operator=(int64_t Value) = 0; 00065 00067 00072 virtual int64_t GetValue(bool Verify = false, bool IgnoreCache = false ) = 0; 00073 00075 virtual int64_t operator()() = 0; 00076 00078 virtual int64_t operator*() = 0; 00079 00081 virtual int64_t GetMin() = 0; 00082 00084 virtual int64_t GetMax() = 0; 00085 00087 virtual EIncMode GetIncMode() = 0; 00088 00090 virtual int64_t GetInc() = 0; 00091 00093 virtual int64_autovector_t GetListOfValidValues(bool bounded = true) = 0; 00094 00096 virtual ERepresentation GetRepresentation() = 0; 00097 00099 virtual GENICAM_NAMESPACE::gcstring GetUnit() = 0; 00100 00102 virtual void ImposeMin(int64_t Value) = 0; 00103 00105 virtual void ImposeMax(int64_t Value) = 0; 00106 }; 00107 00108 00109 //************************************************************* 00110 // CIntegerRef class 00111 //************************************************************* 00112 00113 #ifndef DOXYGEN_IGNORE 00114 00115 interface IFloat; 00116 00122 template <class T, class I=T> 00123 class CIntegerRefT : public CValueRefT<T, I> 00124 { 00125 typedef CValueRefT<T, I> ref; 00126 00127 public: 00128 /*--------------------------------------------------------*/ 00129 // IInteger 00130 /*--------------------------------------------------------*/ 00131 00133 virtual void SetValue(int64_t Value, bool Verify = true) 00134 { 00135 if(ref::m_Ptr) 00136 return ref::m_Ptr->SetValue(Value, Verify); 00137 else 00138 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00139 } 00140 00142 virtual IInteger& operator=(int64_t Value) 00143 { 00144 if(ref::m_Ptr) 00145 { 00146 ref::m_Ptr->SetValue(Value); 00147 return *this; 00148 } 00149 else 00150 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00151 } 00152 00154 virtual int64_t GetValue( bool Verify = false, bool IgnoreCache = false ) 00155 { 00156 if(ref::m_Ptr) 00157 return ref::m_Ptr->GetValue( Verify, IgnoreCache ); 00158 else 00159 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00160 } 00161 00163 virtual int64_t operator()() 00164 { 00165 if(ref::m_Ptr) 00166 return ref::m_Ptr->operator()(); 00167 else 00168 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00169 } 00170 00172 virtual int64_t operator*() 00173 { 00174 if(ref::m_Ptr) 00175 return ref::m_Ptr->operator*(); 00176 else 00177 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00178 } 00179 00181 virtual int64_t GetMin() 00182 { 00183 if(ref::m_Ptr) 00184 return ref::m_Ptr->GetMin(); 00185 else 00186 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00187 } 00188 00190 virtual int64_t GetMax() 00191 { 00192 if(ref::m_Ptr) 00193 return ref::m_Ptr->GetMax(); 00194 else 00195 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00196 } 00197 00199 virtual EIncMode GetIncMode() 00200 { 00201 if(ref::m_Ptr) 00202 return ref::m_Ptr->GetIncMode(); 00203 else 00204 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00205 } 00206 00208 virtual int64_t GetInc() 00209 { 00210 if(ref::m_Ptr) 00211 return ref::m_Ptr->GetInc(); 00212 else 00213 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00214 } 00215 00217 virtual int64_autovector_t GetListOfValidValues(bool bounded = true) 00218 { 00219 if(ref::m_Ptr) 00220 return ref::m_Ptr->GetListOfValidValues( bounded ); 00221 else 00222 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00223 00224 } 00225 00227 virtual ERepresentation GetRepresentation() 00228 { 00229 if(ref::m_Ptr) 00230 return ref::m_Ptr->GetRepresentation(); 00231 else 00232 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00233 } 00234 00236 virtual GENICAM_NAMESPACE::gcstring GetUnit() 00237 { 00238 if(ref::m_Ptr) 00239 return ref::m_Ptr->GetUnit(); 00240 else 00241 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00242 } 00243 00245 IFloat *GetFloatAlias() 00246 { 00247 if(ref::m_Ptr) 00248 return dynamic_cast<IFloat*>(ref::m_Ptr->GetNode()->GetCastAlias()); 00249 else 00250 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00251 } 00252 00254 virtual void ImposeMin(int64_t Value) 00255 { 00256 if(ref::m_Ptr) 00257 return ref::m_Ptr->ImposeMin(Value); 00258 else 00259 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00260 } 00261 00263 virtual void ImposeMax(int64_t Value) 00264 { 00265 if(ref::m_Ptr) 00266 return ref::m_Ptr->ImposeMax(Value); 00267 else 00268 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00269 } 00270 00271 }; 00272 00275 typedef CIntegerRefT<IInteger> CIntegerRef; 00276 00277 #endif 00278 00279 } 00280 00281 #ifdef _MSC_VER 00282 # pragma warning ( pop ) 00283 #endif 00284 00285 #endif // ifndef GENAPI_IIINTEGER_H