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_CONVERTER_H 00032 #define GENAPI_CONVERTER_H 00033 #include "Base/GCString.h" 00034 #include "../IFloat.h" 00035 #include "Node.h" 00036 #include "BaseT.h" 00037 #include "ValueT.h" 00038 #include "NodeT.h" 00039 #include "SwissKnife.h" 00040 #include "FloatT.h" 00041 #include "PolyReference.h" 00042 00043 namespace GENAPI_NAMESPACE 00044 { 00045 //************************************************************* 00046 // CConverter class 00047 //************************************************************* 00048 00050 00057 class CConverterImpl : public IFloat, public CNodeImpl 00058 { 00059 public: 00061 CConverterImpl(); 00062 protected: 00063 00064 //------------------------------------------------------------- 00065 // IFloat implementation 00066 //------------------------------------------------------------- 00067 00068 // Set feature value 00069 virtual void InternalSetValue(double Value, bool Verify = true); 00070 00071 // Get feature value 00072 virtual double InternalGetValue(bool Verify = false, bool IgnoreCache = false); 00073 00074 // Get minimum value allowed 00075 virtual double InternalGetMin(); 00076 00077 // Get maximum value allowed 00078 virtual double InternalGetMax(); 00079 00081 virtual bool InternalHasInc(); 00082 00084 virtual double InternalGetInc(); 00085 00087 virtual const double_autovector_t InternalGetListOfValidValues(); 00088 00089 // Get recommended representation 00090 virtual ERepresentation InternalGetRepresentation() const 00091 { 00092 if (m_Representation != _UndefinedRepresentation) 00093 return m_Representation; 00094 else 00095 return m_Value.GetRepresentation(); 00096 } 00097 00098 // Get the access mode of the node 00099 virtual EAccessMode InternalGetAccessMode() const; 00100 00102 virtual EInterfaceType InternalGetPrincipalInterfaceType() const 00103 { 00104 return intfIFloat; 00105 } 00106 00108 virtual GENICAM_NAMESPACE::gcstring InternalGetUnit() const 00109 { 00110 if ( !m_Unit.empty() ) 00111 return m_Unit; 00112 else 00113 return m_Value.GetUnit(); 00114 } 00115 00117 virtual EDisplayNotation InternalGetDisplayNotation() const 00118 { 00119 if ( m_DisplayNotation != _UndefinedEDisplayNotation ) 00120 return m_DisplayNotation; 00121 else 00122 return m_Value.GetDisplayNotation(); 00123 } 00124 00126 virtual int64_t InternalGetDisplayPrecision() const 00127 { 00128 if ( m_DisplayPrecision != -1 ) 00129 return m_DisplayPrecision; 00130 else 00131 return m_Value.GetDisplayPrecision(); 00132 } 00133 00135 virtual ECachingMode InternalGetCachingMode() const; 00136 00137 public: 00139 //------------------------------------------------------------- 00140 // Initializing 00141 //------------------------------------------------------------- 00142 public: 00143 00144 00145 virtual void SetProperty( CProperty &Property ); 00146 virtual bool GetProperty(CNodeDataMap *pNodeDataMap, CPropertyID::EProperty_ID_t PropertyID, CNodeData::PropertyVector_t &PropertyList) const; 00147 00148 00149 // determine if the conversion function is increasing or decreasing 00150 void CheckIncreasing(); 00151 00152 00153 protected: 00155 bool IsMinUninititialized() const; 00156 00158 bool IsMaxUninitialized() const; 00159 00160 //------------------------------------------------------------- 00161 // Member variables 00162 //------------------------------------------------------------- 00163 00165 GENICAM_NAMESPACE::gcstring m_FormulaTo; 00166 00168 GENICAM_NAMESPACE::gcstring m_FormulaFrom; 00169 00171 GENICAM_NAMESPACE::gcstring m_InputName; 00172 00174 CFloatPolyRef m_ConvertTo; 00175 00177 CFloatPolyRef m_ConvertFrom; 00178 00180 CFloatPolyRef m_Value; 00181 00183 mutable ERepresentation m_Representation; 00184 00186 GENICAM_NAMESPACE::gcstring m_Unit; 00187 00189 EDisplayNotation m_DisplayNotation; 00190 00192 int64_t m_DisplayPrecision; 00193 00195 ESlope m_Slope; 00196 00198 EYesNo m_IsLinear; 00199 }; 00200 00202 class CConverter 00203 : public BaseT< ValueT< NodeT < FloatT < CConverterImpl > > > > 00204 { 00205 }; 00206 } 00207 00208 #endif // GENAPI_CONVERTER_H