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 #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 // IInteger interface 00045 //************************************************************* 00046 00051 interface GENAPI_DECL_ABSTRACT IInteger : virtual public IValue 00052 { 00054 00058 virtual void SetValue(int64_t Value, bool Verify = true) = 0; 00059 00061 virtual IInteger& operator=(int64_t Value) = 0; 00062 00064 00069 virtual int64_t GetValue(bool Verify = false, bool IgnoreCache = false ) = 0; 00070 00072 virtual int64_t operator()() = 0; 00073 00075 virtual int64_t operator*() = 0; 00076 00078 virtual int64_t GetMin() = 0; 00079 00081 virtual int64_t GetMax() = 0; 00082 00084 virtual EIncMode GetIncMode() = 0; 00085 00087 virtual int64_t GetInc() = 0; 00088 00090 virtual int64_autovector_t GetListOfValidValues(bool bounded = true) = 0; 00091 00093 virtual ERepresentation GetRepresentation() = 0; 00094 00096 virtual GENICAM_NAMESPACE::gcstring GetUnit() = 0; 00097 00099 virtual void ImposeMin(int64_t Value) = 0; 00100 00102 virtual void ImposeMax(int64_t Value) = 0; 00103 }; 00104 00105 00106 //************************************************************* 00107 // CIntegerRef class 00108 //************************************************************* 00109 00110 #ifndef DOXYGEN_IGNORE 00111 00112 interface IFloat; 00113 00119 template <class T, class I=T> 00120 class CIntegerRefT : public CValueRefT<T, I> 00121 { 00122 typedef CValueRefT<T, I> ref; 00123 00124 public: 00125 /*--------------------------------------------------------*/ 00126 // IInteger 00127 /*--------------------------------------------------------*/ 00128 00130 virtual void SetValue(int64_t Value, bool Verify = true) 00131 { 00132 if(ref::m_Ptr) 00133 return ref::m_Ptr->SetValue(Value, Verify); 00134 else 00135 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00136 } 00137 00139 virtual IInteger& operator=(int64_t Value) 00140 { 00141 if(ref::m_Ptr) 00142 { 00143 ref::m_Ptr->SetValue(Value); 00144 return *this; 00145 } 00146 else 00147 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00148 } 00149 00151 virtual int64_t GetValue( bool Verify = false, bool IgnoreCache = false ) 00152 { 00153 if(ref::m_Ptr) 00154 return ref::m_Ptr->GetValue( Verify, IgnoreCache ); 00155 else 00156 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00157 } 00158 00160 virtual int64_t operator()() 00161 { 00162 if(ref::m_Ptr) 00163 return ref::m_Ptr->operator()(); 00164 else 00165 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00166 } 00167 00169 virtual int64_t operator*() 00170 { 00171 if(ref::m_Ptr) 00172 return ref::m_Ptr->operator*(); 00173 else 00174 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00175 } 00176 00178 virtual int64_t GetMin() 00179 { 00180 if(ref::m_Ptr) 00181 return ref::m_Ptr->GetMin(); 00182 else 00183 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00184 } 00185 00187 virtual int64_t GetMax() 00188 { 00189 if(ref::m_Ptr) 00190 return ref::m_Ptr->GetMax(); 00191 else 00192 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00193 } 00194 00196 virtual EIncMode GetIncMode() 00197 { 00198 if(ref::m_Ptr) 00199 return ref::m_Ptr->GetIncMode(); 00200 else 00201 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00202 } 00203 00205 virtual int64_t GetInc() 00206 { 00207 if(ref::m_Ptr) 00208 return ref::m_Ptr->GetInc(); 00209 else 00210 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00211 } 00212 00214 virtual int64_autovector_t GetListOfValidValues(bool bounded = true) 00215 { 00216 if(ref::m_Ptr) 00217 return ref::m_Ptr->GetListOfValidValues( bounded ); 00218 else 00219 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00220 00221 } 00222 00224 virtual ERepresentation GetRepresentation() 00225 { 00226 if(ref::m_Ptr) 00227 return ref::m_Ptr->GetRepresentation(); 00228 else 00229 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00230 } 00231 00233 virtual GENICAM_NAMESPACE::gcstring GetUnit() 00234 { 00235 if(ref::m_Ptr) 00236 return ref::m_Ptr->GetUnit(); 00237 else 00238 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00239 } 00240 00242 IFloat *GetFloatAlias() 00243 { 00244 if(ref::m_Ptr) 00245 return dynamic_cast<IFloat*>(ref::m_Ptr->GetNode()->GetCastAlias()); 00246 else 00247 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00248 } 00249 00251 virtual void ImposeMin(int64_t Value) 00252 { 00253 if(ref::m_Ptr) 00254 return ref::m_Ptr->ImposeMin(Value); 00255 else 00256 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00257 } 00258 00260 virtual void ImposeMax(int64_t Value) 00261 { 00262 if(ref::m_Ptr) 00263 return ref::m_Ptr->ImposeMax(Value); 00264 else 00265 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00266 } 00267 00268 }; 00269 00272 typedef CIntegerRefT<IInteger> CIntegerRef; 00273 00274 #endif 00275 00276 } 00277 00278 #pragma warning ( pop ) 00279 00280 #endif // ifndef GENAPI_IIINTEGER_H