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_IVALUE_H 00032 #define GENAPI_IVALUE_H 00033 00034 #include <GenApi/GenApiDll.h> 00035 #include <GenApi/Types.h> 00036 #include <GenApi/IBase.h> 00037 #include <GenApi/INode.h> 00038 #include <Base/GCString.h> 00039 #include <Base/GCException.h> 00040 00041 #pragma warning ( push ) 00042 #pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY 00043 00044 namespace GENAPI_NAMESPACE 00045 { 00046 interface INode; 00047 00048 //************************************************************* 00049 // IValue interface 00050 //************************************************************* 00051 00056 interface GENAPI_DECL_ABSTRACT IValue : virtual public IBase 00057 { 00059 virtual INode* GetNode() { return dynamic_cast<INode*>(this); } 00060 00062 00067 virtual GENICAM_NAMESPACE::gcstring ToString(bool Verify = false, bool IgnoreCache = false) = 0; 00068 00070 00074 virtual void FromString(const GENICAM_NAMESPACE::gcstring& ValueStr, bool Verify = true) = 0; 00075 00077 virtual bool IsValueCacheValid() const = 0; 00078 }; 00079 00080 00081 //************************************************************* 00082 // CValueRef class 00083 //************************************************************* 00084 00085 #ifndef DOXYGEN_IGNORE 00086 00092 template <class T, class I=T> 00093 class CValueRefT : public CBaseRefT<T,I> 00094 { 00095 typedef CBaseRefT<T, I> ref; 00096 00097 public: 00098 /*--------------------------------------------------------*/ 00099 // IValue 00100 /*--------------------------------------------------------*/ 00101 00103 virtual INode* GetNode() 00104 { 00105 if(ref::m_Ptr) 00106 return ref::m_Ptr->GetNode(); 00107 else 00108 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00109 } 00110 00112 virtual GENICAM_NAMESPACE::gcstring ToString(bool Verify = false, bool IgnoreCache = false) 00113 { 00114 if(ref::m_Ptr) 00115 return ref::m_Ptr->ToString(Verify, IgnoreCache); 00116 else 00117 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00118 } 00119 00121 virtual void FromString(const GENICAM_NAMESPACE::gcstring& ValueStr, bool Verify = true) 00122 { 00123 if(ref::m_Ptr) 00124 return ref::m_Ptr->FromString(ValueStr, Verify); 00125 else 00126 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00127 } 00128 00130 virtual bool IsValueCacheValid() const 00131 { 00132 if(ref::m_Ptr) 00133 return ref::m_Ptr->IsValueCacheValid(); 00134 else 00135 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00136 } 00137 }; 00138 00141 typedef CValueRefT<IValue> CValueRef; 00142 00143 #endif 00144 00145 } 00146 00147 #pragma warning ( pop ) 00148 00149 #endif // ifndef GENAPI_IVALUE_H