00001 //----------------------------------------------------------------------------- 00002 // (c) 2006 by Basler Vision Technologies 00003 // Section: Vision Components 00004 // Project: GenApi 00005 // Author: Margret Albrecht 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_ISTRING_H 00032 #define GENAPI_ISTRING_H 00033 00034 #include <Base/GCString.h> 00035 #include <GenApi/GenApiDll.h> 00036 #include <GenApi/Types.h> 00037 #include <GenApi/IValue.h> 00038 00039 #ifdef _MSC_VER 00040 # pragma warning ( push ) 00041 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY 00042 #endif 00043 00044 namespace GENAPI_NAMESPACE 00045 { 00046 //************************************************************* 00047 // IString interface 00048 //************************************************************* 00049 00054 interface GENAPI_DECL_ABSTRACT IString : virtual public IValue 00055 { 00057 00061 virtual void SetValue(const GENICAM_NAMESPACE::gcstring& Value, bool Verify = true) = 0; 00062 00064 virtual IString& operator=(const GENICAM_NAMESPACE::gcstring& Value) = 0; 00065 00067 00072 virtual GENICAM_NAMESPACE::gcstring GetValue(bool Verify = false, bool IgnoreCache = false) = 0; 00073 00075 virtual GENICAM_NAMESPACE::gcstring operator()() = 0; 00076 00078 virtual GENICAM_NAMESPACE::gcstring operator*() = 0; 00079 00081 virtual int64_t GetMaxLength() = 0; 00082 00083 }; 00084 //************************************************************* 00085 // CStringRef class 00086 //************************************************************* 00087 00088 #ifndef DOXYGEN_IGNORE 00089 00095 template <class T> 00096 class CStringRefT : public CValueRefT<T> 00097 { 00098 typedef CValueRefT<T> ref; 00099 00100 public: 00101 /*--------------------------------------------------------*/ 00102 // IString 00103 /*--------------------------------------------------------*/ 00104 00106 virtual void SetValue(const GENICAM_NAMESPACE::gcstring& Value, bool Verify = true) 00107 { 00108 if(ref::m_Ptr) 00109 return ref::m_Ptr->SetValue(Value, Verify); 00110 else 00111 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00112 } 00113 00115 virtual IString& operator=(const GENICAM_NAMESPACE::gcstring& Value) 00116 { 00117 if(ref::m_Ptr) 00118 return ref::m_Ptr->operator=(Value); 00119 else 00120 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00121 } 00122 00124 virtual GENICAM_NAMESPACE::gcstring GetValue(bool Verify = false, bool IgnoreCache = false) 00125 { 00126 if(ref::m_Ptr) 00127 return ref::m_Ptr->GetValue(Verify, IgnoreCache); 00128 else 00129 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00130 } 00131 00133 virtual GENICAM_NAMESPACE::gcstring operator()() 00134 { 00135 if(ref::m_Ptr) 00136 return ref::m_Ptr->operator()(); 00137 else 00138 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00139 } 00140 00142 virtual GENICAM_NAMESPACE::gcstring operator*() 00143 { 00144 if(ref::m_Ptr) 00145 return ref::m_Ptr-> operator*(); 00146 else 00147 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00148 } 00149 00151 virtual int64_t GetMaxLength() 00152 { 00153 if(ref::m_Ptr) 00154 return ref::m_Ptr->GetMaxLength(); 00155 else 00156 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00157 } 00158 00159 }; 00160 00163 typedef CStringRefT<IString> CStringRef; 00164 00165 #endif 00166 00167 } 00168 00169 #ifdef _MSC_VER 00170 # pragma warning ( pop ) 00171 #endif 00172 00173 #endif // ifndef GENAPI_ISTRING_H