Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00031 #ifndef GENAPI_IBOOLEAN_H
00032 #define GENAPI_IBOOLEAN_H
00033
00034 #include <GenApi/GenApiDll.h>
00035 #include <GenApi/Types.h>
00036 #include <GenApi/IValue.h>
00037
00038 #ifdef _MSC_VER
00039 # pragma warning ( push )
00040 # pragma warning ( disable : 4251 ) // XXX needs to have dll-interface to be used by clients of class YYY
00041 #endif
00042
00043 namespace GENAPI_NAMESPACE
00044 {
00045
00046
00047
00048
00053 interface GENAPI_DECL_ABSTRACT IBoolean : virtual public IValue
00054 {
00055 public:
00057
00061 virtual void SetValue(bool Value, bool Verify = true) = 0;
00062
00064 virtual void operator=(bool Value){ SetValue( Value ); }
00065
00067
00072 virtual bool GetValue(bool Verify = false, bool IgnoreCache = false) const = 0;
00073
00075 virtual bool operator()() const { return GetValue(); }
00076 };
00077
00078
00079
00080
00081
00082
00083 #ifndef DOXYGEN_IGNORE
00084
00089 template <class T>
00090 class CBooleanRefT : public CValueRefT<T>
00091 {
00092 typedef CValueRefT<T> ref;
00093
00094 public:
00095
00096
00097
00098
00100 virtual void SetValue(bool Value, bool Verify = true)
00101 {
00102 if(ref::m_Ptr)
00103 return ref::m_Ptr->SetValue(Value, Verify);
00104 else
00105 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00106
00107
00108 GC_UNUSED(Verify);
00109 }
00110
00112 virtual void operator=(bool Value)
00113 {
00114 if(ref::m_Ptr)
00115 return ref::m_Ptr->operator=(Value);
00116 else
00117 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00118 }
00119
00121 virtual bool GetValue(bool Verify = false, bool IgnoreCache = false) const
00122 {
00123 if(ref::m_Ptr)
00124 return ref::m_Ptr->GetValue(Verify, IgnoreCache);
00125 else
00126 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00127 }
00128
00130 virtual bool operator()() const
00131 {
00132 if(ref::m_Ptr)
00133 return ref::m_Ptr->operator()();
00134 else
00135 throw ACCESS_EXCEPTION("Feature not present (reference not valid)");
00136 }
00137
00138 };
00139
00142 typedef CBooleanRefT<IBoolean> CBooleanRef;
00143
00144 #endif
00145
00146
00147
00148 }
00149
00150 #ifdef _MSC_VER
00151 # pragma warning ( pop )
00152 #endif
00153
00154 #endif // ifndef GENAPI_IBOOLEAN_H