GenApi  3.5.1
IBoolean.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_IBOOLEAN_H
30 #define GENAPI_IBOOLEAN_H
31 
32 #include <GenApi/GenApiDll.h>
33 #include <GenApi/Types.h>
34 #include <GenApi/IValue.h>
35 
36 #ifdef _MSC_VER
37 # pragma warning ( push )
38 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
39 #endif
40 
41 namespace GENAPI_NAMESPACE
42 {
43  //*************************************************************
44  // IBoolean interface
45  //*************************************************************
46 
51  GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBoolean : virtual public IValue
52  {
53  public:
55 
59  virtual void SetValue(bool Value, bool Verify = true) = 0;
60 
62  virtual IBoolean& operator=(bool Value)
63  {
64  SetValue( Value );
65  return *this;
66  }
67 
69 
74  virtual bool GetValue(bool Verify = false, bool IgnoreCache = false) const = 0;
75 
77  virtual bool operator()() const { return GetValue(); }
78  };
79 
80 
81  //*************************************************************
82  // CBooleanRef class
83  //*************************************************************
84 
85 #ifndef DOXYGEN_IGNORE
86 
91  template <class T>
92  class CBooleanRefT : public CValueRefT<T>
93  {
94  typedef CValueRefT<T> ref;
95 
96  public:
97  /*--------------------------------------------------------*/
98  // IBoolean
99  /*--------------------------------------------------------*/
100 
102  virtual void SetValue(bool Value, bool Verify = true)
103  {
104  if (ref::m_Ptr)
105  {
106  ref::m_Ptr->SetValue( Value, Verify );
107  }
108  else
109  {
110  throw ACCESS_EXCEPTION( "Feature not present (reference not valid)" );
111  }
112  }
113 
115  virtual CBooleanRefT& operator=(bool Value)
116  {
117  if (ref::m_Ptr)
118  {
119  ref::m_Ptr->operator=(Value);
120  }
121  else
122  {
123  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
124  }
125 
126  return *this;
127  }
128 
130  virtual bool GetValue(bool Verify = false, bool IgnoreCache = false) const
131  {
132  if(!ref::m_Ptr)
133  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
134  return ref::m_Ptr->GetValue(Verify, IgnoreCache);
135  }
136 
138  virtual bool operator()() const
139  {
140  if(!ref::m_Ptr)
141  throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
142  return ref::m_Ptr->operator()();
143  }
144  };
145 
148  typedef CBooleanRefT<IBoolean> CBooleanRef;
149 
150 #endif
151 
152 }
153 
154 #ifdef _MSC_VER
155 # pragma warning ( pop )
156 #endif
157 
158 #endif // ifndef GENAPI_IBOOLEAN_H
Common types used in the public GenApi interface.
virtual bool operator()() const
Get node value.
Definition: IBoolean.h:77
CBooleanRefT< IBoolean > CBooleanRef
Definition: IBoolean.h:148
virtual IBoolean & operator=(bool Value)
Set node value.
Definition: IBoolean.h:62
#define ACCESS_EXCEPTION
Fires a access exception, e.g. throw ACCESS_EXCEPTION("Not everybody")
Definition: GCException.h:252
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBoolean
Interface for Boolean properties.
Definition: IBoolean.h:59
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IValue
Interface for value properties.
Definition: IValue.h:59
virtual bool GetValue(bool Verify=false, bool IgnoreCache=false) const =0
Get node value.
declspec&#39;s to be used for GenApi Windows dll
Definition of the interface IValue.
Definition: ChunkAdapter.h:37