00001 //----------------------------------------------------------------------------- 00002 // (c) 2006 by Basler Vision Technologies 00003 // Section: Vision Components 00004 // Project: GenApi 00005 // Author: Hartmut Nebelung 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_INTCONVERTER_H 00032 #define GENAPI_INTCONVERTER_H 00033 00034 #include "Base/GCString.h" 00035 #include "../IInteger.h" 00036 #include "Node.h" 00037 #include "BaseT.h" 00038 #include "ValueT.h" 00039 #include "NodeT.h" 00040 #include "IntSwissKnife.h" 00041 #include "IntegerT.h" 00042 #include "MathParser/Int64MathParser.h" 00043 #include "PolyReference.h" 00044 00045 namespace GENAPI_NAMESPACE 00046 { 00047 //************************************************************* 00048 // CIntConverter class 00049 //************************************************************* 00050 00052 00059 class CIntConverterImpl : public IInteger, public CNodeImpl 00060 { 00061 public: 00063 CIntConverterImpl(); 00064 protected: 00065 00066 //------------------------------------------------------------- 00067 // IInteger implementation 00068 //------------------------------------------------------------- 00069 00070 // Set feature value 00071 virtual void InternalSetValue(int64_t Value, bool Verify = true); 00072 00073 // Get feature value 00074 virtual int64_t InternalGetValue(bool Verify = false, bool IgnoreCache = false); 00075 00076 // Get minimum value allowed 00077 virtual int64_t InternalGetMin(); 00078 00079 // Get maximum value allowed 00080 virtual int64_t InternalGetMax(); 00081 00082 // Get increment 00083 virtual int64_t InternalGetInc(); 00084 00086 const int64_autovector_t InternalGetListOfValidValues(); 00087 00088 // Get recommended representation 00089 virtual ERepresentation InternalGetRepresentation() const 00090 { 00091 if (m_Representation != _UndefinedRepresentation) 00092 return m_Representation; 00093 else 00094 return m_Value.GetRepresentation(); 00095 00096 } 00097 00098 // Get the access mode of the node 00099 virtual EAccessMode InternalGetAccessMode() const; 00100 00102 virtual EInterfaceType InternalGetPrincipalInterfaceType() const 00103 { 00104 return intfIInteger; 00105 } 00106 00108 virtual GENICAM_NAMESPACE::gcstring InternalGetUnit() 00109 { 00110 if( m_Unit.empty() ) 00111 return m_Value.GetUnit(); 00112 00113 return m_Unit; 00114 } 00115 00117 virtual ECachingMode InternalGetCachingMode() const; 00118 00119 public: 00120 //------------------------------------------------------------- 00121 // Initializing 00122 //------------------------------------------------------------- 00123 public: 00124 00125 virtual void SetProperty( CProperty &Property ); 00126 virtual bool GetProperty( CNodeDataMap *pNodeDataMap, CPropertyID::EProperty_ID_t PropertyID, CNodeData::PropertyVector_t &PropertyList ) const; 00127 00128 // determine if the conversion function is increasing or decreasing 00129 void CheckIncreasing(); 00130 00131 00132 private: 00134 bool IsMinUninititialized() const; 00135 00137 bool IsMaxUninitialized() const; 00138 00139 //------------------------------------------------------------- 00140 // Member variables 00141 //------------------------------------------------------------- 00142 00144 GENICAM_NAMESPACE::gcstring m_FormulaTo; 00145 00147 GENICAM_NAMESPACE::gcstring m_FormulaFrom; 00148 00150 GENICAM_NAMESPACE::gcstring m_InputName; 00151 00153 CIntegerPolyRef m_pConvertTo; 00154 00156 CIntegerPolyRef m_pConvertFrom; 00157 00159 CIntegerPolyRef m_Value; 00160 00162 mutable ERepresentation m_Representation; 00163 00165 GENICAM_NAMESPACE::gcstring m_Unit; 00166 00168 ESlope m_Slope; 00169 00170 }; 00171 00173 class CIntConverter 00174 : public BaseT< ValueT< NodeT < IntegerT < CIntConverterImpl > > > > 00175 { 00176 }; 00177 } 00178 00179 #endif