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 #ifdef _MSC_VER 00042 # pragma warning ( push ) 00043 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY 00044 #endif 00045 00046 namespace GENAPI_NAMESPACE 00047 { 00048 interface INode; 00049 00050 //************************************************************* 00051 // IValue interface 00052 //************************************************************* 00053 00058 interface GENAPI_DECL_ABSTRACT IValue : virtual public IBase 00059 { 00061 virtual INode* GetNode() { return dynamic_cast<INode*>(this); } 00062 00064 00069 virtual GENICAM_NAMESPACE::gcstring ToString(bool Verify = false, bool IgnoreCache = false) = 0; 00070 00072 00076 virtual void FromString(const GENICAM_NAMESPACE::gcstring& ValueStr, bool Verify = true) = 0; 00077 00079 virtual bool IsValueCacheValid() const = 0; 00080 }; 00081 00082 00083 //************************************************************* 00084 // CValueRef class 00085 //************************************************************* 00086 00087 #ifndef DOXYGEN_IGNORE 00088 00094 template <class T, class I=T> 00095 class CValueRefT : public CBaseRefT<T,I> 00096 { 00097 typedef CBaseRefT<T, I> ref; 00098 00099 public: 00100 /*--------------------------------------------------------*/ 00101 // IValue 00102 /*--------------------------------------------------------*/ 00103 00105 virtual INode* GetNode() 00106 { 00107 if(ref::m_Ptr) 00108 return ref::m_Ptr->GetNode(); 00109 else 00110 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00111 } 00112 00114 virtual GENICAM_NAMESPACE::gcstring ToString(bool Verify = false, bool IgnoreCache = false) 00115 { 00116 if(ref::m_Ptr) 00117 return ref::m_Ptr->ToString(Verify, IgnoreCache); 00118 else 00119 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00120 } 00121 00123 virtual void FromString(const GENICAM_NAMESPACE::gcstring& ValueStr, bool Verify = true) 00124 { 00125 if(ref::m_Ptr) 00126 return ref::m_Ptr->FromString(ValueStr, Verify); 00127 else 00128 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00129 } 00130 00132 virtual bool IsValueCacheValid() const 00133 { 00134 if(ref::m_Ptr) 00135 return ref::m_Ptr->IsValueCacheValid(); 00136 else 00137 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00138 } 00139 }; 00140 00143 typedef CValueRefT<IValue> CValueRef; 00144 00145 #endif 00146 00147 } 00148 00149 #ifdef _MSC_VER 00150 # pragma warning ( pop ) 00151 #endif 00152 00153 #endif // ifndef GENAPI_IVALUE_H