GenApi  3.5.1
IValue.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // (c) 2006 by Basler Vision Technologies
3 // Author: Fritz Dierks
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_IVALUE_H
30 #define GENAPI_IVALUE_H
31 
32 #include <GenApi/GenApiDll.h>
33 #include <GenApi/Types.h>
34 #include <GenApi/IBase.h>
35 #include <GenApi/INode.h>
36 #include <Base/GCString.h>
37 #include <Base/GCException.h>
38 
39 #ifdef _MSC_VER
40 # pragma warning ( push )
41 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
42 #endif
43 
44 namespace GENAPI_NAMESPACE
45 {
46  GENICAM_INTERFACE INode;
47 
48  //*************************************************************
49  // IValue interface
50  //*************************************************************
51 
56  GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IValue : virtual public IBase
57  {
59  virtual INode* GetNode() { return dynamic_cast<INode*>(this); }
60 
62 
67  virtual GENICAM_NAMESPACE::gcstring ToString(bool Verify = false, bool IgnoreCache = false) = 0;
68 
70 
74  virtual void FromString(const GENICAM_NAMESPACE::gcstring& ValueStr, bool Verify = true) = 0;
75 
77  virtual bool IsValueCacheValid() const = 0;
78  };
79 
80 
81  //*************************************************************
82  // CValueRef class
83  //*************************************************************
84 
85 #ifndef DOXYGEN_IGNORE
86 
92  template <class T, class I=T>
93  class CValueRefT : public CBaseRefT<T,I>
94  {
95  typedef CBaseRefT<T, I> ref;
96 
97  public:
98  /*--------------------------------------------------------*/
99  // IValue
100  /*--------------------------------------------------------*/
101 
103  virtual INode* GetNode()
104  {
105  if(!ref::m_Ptr)
106  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
107  return ref::m_Ptr->GetNode();
108  }
109 
111  virtual GENICAM_NAMESPACE::gcstring ToString(bool Verify = false, bool IgnoreCache = false)
112  {
113  if(!ref::m_Ptr)
114  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
115  return ref::m_Ptr->ToString(Verify, IgnoreCache);
116  }
117 
119  virtual void FromString(const GENICAM_NAMESPACE::gcstring& ValueStr, bool Verify = true)
120  {
121  if (!ref::m_Ptr)
122  {
123  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
124  }
125  ref::m_Ptr->FromString(ValueStr, Verify);
126  }
127 
129  virtual bool IsValueCacheValid() const
130  {
131  if(!ref::m_Ptr)
132  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
133  return ref::m_Ptr->IsValueCacheValid();
134  }
135  };
136 
139  typedef CValueRefT<IValue> CValueRef;
140 
141 #endif
142 
143 }
144 
145 #ifdef _MSC_VER
146 # pragma warning ( pop )
147 #endif
148 
149 #endif // ifndef GENAPI_IVALUE_H
Definition of interface IBase.
Common types used in the public GenApi interface.
Definition of interface INode and types NodeList_t and CallbackHandleType:
GENICAM_INTERFACE INode
Interface common to all nodes.
Definition: ICategory.h:49
virtual void FromString(const GENICAM_NAMESPACE::gcstring &ValueStr, bool Verify=true)=0
Set content of the node as string.
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
Definition: GCException.h:252
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBase
Base interface common to all nodes.
Definition: IBase.h:53
virtual bool IsValueCacheValid() const =0
Checks if the value comes from cache or is requested from another node.
Standard GenICam Exceptions.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IValue
Interface for value properties.
Definition: IValue.h:59
A string class which is a clone of std::string.
Definition: GCString.h:50
Portable string implementation.
declspec&#39;s to be used for GenApi Windows dll
CValueRefT< IValue > CValueRef
Definition: IValue.h:139
Definition: ChunkAdapter.h:37
virtual INode * GetNode(const GENICAM_NAMESPACE::gcstring &Name) const =0
Retrieves the node from the central map by Name.