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_BOOLEANT_H
00032 #define GENAPI_BOOLEANT_H
00033
00034 #include "../IBoolean.h"
00035 #include "GenApi/impl/Log.h"
00036 #include "Exception.h"
00037
00038 namespace GENAPI_NAMESPACE
00039 {
00040
00044 template <class Base>
00045 class BooleanT : public Base
00046 {
00047 public:
00048
00050
00052 virtual void SetValue(bool Value, bool Verify = true)
00053 {
00054
00055 std::list<CNodeCallback*> CallbacksToFire;
00056 {
00057 AutoLock l(Base::GetLock());
00058 typename Base::EntryMethodFinalizer E( this, meSetValue );
00059
00060 if( Verify && !IsWritable( this ) )
00061 throw ACCESS_EXCEPTION_NODE("Node is not writable.");
00062 #pragma BullseyeCoverage off
00063 GCLOGINFOPUSH( Base::m_pValueLog, "SetValue( " + (Value ? GENICAM_NAMESPACE::gcstring("true") : GENICAM_NAMESPACE::gcstring("false")) + " )..." );
00064 #pragma BullseyeCoverage on
00065 {
00066 typename Base::PostSetValueFinalizer PostSetValueCaller(this, CallbacksToFire);
00067
00068 Base::PreSetValue();
00069
00070 Base::InternalSetValue( Value, Verify );
00071
00072 if( Verify )
00073 Base::InternalCheckError();
00074
00075 }
00076
00077 #pragma BullseyeCoverage off
00078 GCLOGINFOPOP( Base::m_pValueLog, "...SetValue" );
00079 #pragma BullseyeCoverage on
00080
00081
00082 std::list<CNodeCallback*>::iterator ptrCallback;
00083 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00084 {
00085 (*ptrCallback)->operator ()(cbPostInsideLock);
00086 }
00087 }
00088
00089
00090 std::list<CNodeCallback*>::iterator ptrCallback;
00091 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00092 {
00093 (*ptrCallback)->operator ()(cbPostOutsideLock);
00094 }
00095 }
00096
00098 virtual void operator=(bool Value)
00099 {
00100 SetValue( Value );
00101 }
00102
00104 virtual bool GetValue(bool Verify = false, bool IgnoreCache = false) const
00105 {
00106 AutoLock l(Base::GetLock());
00107 typename Base::EntryMethodFinalizer E( this, meGetValue, IgnoreCache );
00108
00109 GCLOGINFOPUSH( Base::m_pValueLog, "GetValue..." );
00110
00111
00112 if( !IsReadable( this ) )
00113 throw ACCESS_EXCEPTION_NODE("Node is not readable.");
00114
00115 const bool Value( Base::InternalGetValue(Verify, IgnoreCache) );
00116
00117 if( Verify )
00118 Base::InternalCheckError();
00119
00120 GCLOGINFOPOP( Base::m_pValueLog, "...GetValue = " + (Value ? GENICAM_NAMESPACE::gcstring("true") : GENICAM_NAMESPACE::gcstring("false") ) );
00121
00122 return Value;
00123
00124 }
00125
00127 virtual bool operator()() const
00128 {
00129 return GetValue();
00130 }
00131
00132
00133 };
00134 }
00135
00136 #endif // ifndef GENAPI_BOOLEANT_H