GenApi 3.5.1
IString.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// (c) 2006 by Basler Vision Technologies
3// Author: Margret Albrecht
4//
5// License: This file is published under the license of the EMVA GenICam Standard Group.
6// A text file describing the legal terms is included in your installation as 'GenICam_license.pdf'.
7// If for some reason you are missing this file please contact the EMVA or visit the website
8// (http://www.genicam.org) for a full copy.
9//
10// THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
11// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
12// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
13// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD GROUP
14// OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
15// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
16// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
17// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
18// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
19// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
20// POSSIBILITY OF SUCH DAMAGE.
21//
22//-----------------------------------------------------------------------------
29#ifndef GENAPI_ISTRING_H
30#define GENAPI_ISTRING_H
31
32#include <Base/GCString.h>
33#include <GenApi/GenApiDll.h>
34#include <GenApi/Types.h>
35#include <GenApi/IValue.h>
36
37#ifdef _MSC_VER
38# pragma warning ( push )
39# pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
40#endif
41
42namespace GENAPI_NAMESPACE
43{
44 //*************************************************************
45 // IString interface
46 //*************************************************************
47
52 GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IString : virtual public IValue
53 {
55
59 virtual void SetValue(const GENICAM_NAMESPACE::gcstring& Value, bool Verify = true) = 0;
60
62 virtual IString& operator=(const GENICAM_NAMESPACE::gcstring& Value) = 0;
63
65
70 virtual GENICAM_NAMESPACE::gcstring GetValue(bool Verify = false, bool IgnoreCache = false) = 0;
71
74
77
79 virtual int64_t GetMaxLength(bool Verify = false) = 0;
80
81 };
82 //*************************************************************
83 // CStringRef class
84 //*************************************************************
85
86#ifndef DOXYGEN_IGNORE
87
93 template <class T>
94 class CStringRefT : public CValueRefT<T>
95 {
96 typedef CValueRefT<T> ref;
97
98 public:
99 /*--------------------------------------------------------*/
100 // IString
101 /*--------------------------------------------------------*/
102
104 virtual void SetValue(const GENICAM_NAMESPACE::gcstring& Value, bool Verify = true)
105 {
106 if(!ref::m_Ptr)
107 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
108 ref::m_Ptr->SetValue(Value, Verify);
109 }
110
112 virtual IString& operator=(const GENICAM_NAMESPACE::gcstring& Value)
113 {
114 if(!ref::m_Ptr)
115 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
116 return ref::m_Ptr->operator=(Value);
117 }
118
120 virtual GENICAM_NAMESPACE::gcstring GetValue(bool Verify = false, bool IgnoreCache = false)
121 {
122 if(!ref::m_Ptr)
123 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
124 return ref::m_Ptr->GetValue(Verify, IgnoreCache);
125 }
126
128 virtual GENICAM_NAMESPACE::gcstring operator()()
129 {
130 if(!ref::m_Ptr)
131 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
132 return ref::m_Ptr->operator()();
133 }
134
136 virtual GENICAM_NAMESPACE::gcstring operator*()
137 {
138 if(!ref::m_Ptr)
139 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
140 return ref::m_Ptr-> operator*();
141 }
142
144 virtual int64_t GetMaxLength(bool Verify = false)
145 {
146 if(!ref::m_Ptr)
147 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
148 return ref::m_Ptr->GetMaxLength(Verify);
149 }
150
151 };
152
155 typedef CStringRefT<IString> CStringRef;
156
157#endif
158
159}
160
161#ifdef _MSC_VER
162# pragma warning ( pop )
163#endif
164
165#endif // ifndef GENAPI_ISTRING_H
Portable string implementation.
declspec's to be used for GenApi Windows dll
virtual IBoolean & operator=(bool Value)
Set node value.
Definition IBoolean.h:62
virtual bool operator()() const
Get node value.
Definition IBoolean.h:77
virtual bool GetValue(bool Verify=false, bool IgnoreCache=false) const =0
Get node value.
virtual GENICAM_NAMESPACE::gcstring operator*()=0
Get string node value.
virtual int64_t GetMaxLength(bool Verify=false)=0
Retrieves the maximum length of the string in bytes.
Definition of the interface IValue.
Common types used in the public GenApi interface.
A string class which is a clone of std::string.
Definition GCString.h:51
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
Definition GCException.h:252
CStringRefT< IString > CStringRef
Definition IString.h:155
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IValue
Interface for value properties.
Definition IValue.h:59
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IString
Interface for string properties.
Definition IString.h:59