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 #pragma warning ( push ) 00040 #pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY 00041 00042 namespace GENAPI_NAMESPACE 00043 { 00044 //************************************************************* 00045 // IString interface 00046 //************************************************************* 00047 00052 interface GENAPI_DECL_ABSTRACT IString : virtual public IValue 00053 { 00055 00059 virtual void SetValue(const GENICAM_NAMESPACE::gcstring& Value, bool Verify = true) = 0; 00060 00062 virtual IString& operator=(const GENICAM_NAMESPACE::gcstring& Value) = 0; 00063 00065 00070 virtual GENICAM_NAMESPACE::gcstring GetValue(bool Verify = false, bool IgnoreCache = false) = 0; 00071 00073 virtual GENICAM_NAMESPACE::gcstring operator()() = 0; 00074 00076 virtual GENICAM_NAMESPACE::gcstring operator*() = 0; 00077 00079 virtual int64_t GetMaxLength() = 0; 00080 00081 }; 00082 //************************************************************* 00083 // CStringRef class 00084 //************************************************************* 00085 00086 #ifndef DOXYGEN_IGNORE 00087 00093 template <class T> 00094 class CStringRefT : public CValueRefT<T> 00095 { 00096 typedef CValueRefT<T> ref; 00097 00098 public: 00099 /*--------------------------------------------------------*/ 00100 // IString 00101 /*--------------------------------------------------------*/ 00102 00104 virtual void SetValue(const GENICAM_NAMESPACE::gcstring& Value, bool Verify = true) 00105 { 00106 if(ref::m_Ptr) 00107 return ref::m_Ptr->SetValue(Value, Verify); 00108 else 00109 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00110 } 00111 00113 virtual IString& operator=(const GENICAM_NAMESPACE::gcstring& Value) 00114 { 00115 if(ref::m_Ptr) 00116 return ref::m_Ptr->operator=(Value); 00117 else 00118 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00119 } 00120 00122 virtual GENICAM_NAMESPACE::gcstring GetValue(bool Verify = false, bool IgnoreCache = false) 00123 { 00124 if(ref::m_Ptr) 00125 return ref::m_Ptr->GetValue(Verify, IgnoreCache); 00126 else 00127 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00128 } 00129 00131 virtual GENICAM_NAMESPACE::gcstring operator()() 00132 { 00133 if(ref::m_Ptr) 00134 return ref::m_Ptr->operator()(); 00135 else 00136 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00137 } 00138 00140 virtual GENICAM_NAMESPACE::gcstring operator*() 00141 { 00142 if(ref::m_Ptr) 00143 return ref::m_Ptr-> operator*(); 00144 else 00145 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00146 } 00147 00149 virtual int64_t GetMaxLength() 00150 { 00151 if(ref::m_Ptr) 00152 return ref::m_Ptr->GetMaxLength(); 00153 else 00154 throw ACCESS_EXCEPTION("Feature not present (reference not valid)"); 00155 } 00156 00157 }; 00158 00161 typedef CStringRefT<IString> CStringRef; 00162 00163 #endif 00164 00165 } 00166 00167 #pragma warning ( pop ) 00168 00169 #endif // ifndef GENAPI_ISTRING_H