BooleanT.h
Go to the documentation of this file.
00001 //-----------------------------------------------------------------------------
00002 //  (c) 2006 by Basler Vision Technologies
00003 //  Section: Vision Components
00004 //  Project: GenApi
00005 //  Author:  Alexander Happe
00006 //  $Header$
00007 //
00008 //  License: This file is published under the license of the EMVA GenICam  Standard Group.
00009 //  A text file describing the legal terms is included in  your installation as 'GenICam_license.pdf'.
00010 //  If for some reason you are missing  this file please contact the EMVA or visit the website
00011 //  (http://www.genicam.org) for a full copy.
00012 //
00013 //  THIS SOFTWARE IS PROVIDED BY THE EMVA GENICAM STANDARD GROUP "AS IS"
00014 //  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00015 //  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00016 //  PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE EMVA GENICAM STANDARD  GROUP
00017 //  OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,  SPECIAL,
00018 //  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT  LIMITED TO,
00019 //  PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,  DATA, OR PROFITS;
00020 //  OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY  THEORY OF LIABILITY,
00021 //  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  (INCLUDING NEGLIGENCE OR OTHERWISE)
00022 //  ARISING IN ANY WAY OUT OF THE USE  OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00023 //  POSSIBILITY OF SUCH DAMAGE.
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             // a list of callbacks to fire held outside(!) the autolock on the stack(!)
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);  // dtor calls Base::PostSetValue
00067 
00068                     Base::PreSetValue(); // invalidates all nodes if this is the first call in a chain of SetValue calls
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                 // fire callbacks inside the lock
00082                 std::list<CNodeCallback*>::iterator ptrCallback;
00083                 for( ptrCallback = CallbacksToFire.begin(); ptrCallback != CallbacksToFire.end(); ptrCallback++ )
00084                 {
00085                     (*ptrCallback)->operator ()(cbPostInsideLock);
00086                 }
00087             }
00088 
00089             // fire callbacks outside the lock
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             // Note that readability is tested regardless of Verify
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


rc_visard_driver
Author(s): Heiko Hirschmueller , Christian Emmerich , Felix Ruess
autogenerated on Thu Jun 6 2019 20:43:01