|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
00001 // $Id: AlgContext.cpp,v 1.1 2007/05/24 13:48:50 hmd Exp $ 00002 // ============================================================================ 00003 // CVS tag $Name: $, version $Revision: 1.1 $ 00004 // ============================================================================ 00005 // $Log: AlgContext.cpp,v $ 00006 // Revision 1.1 2007/05/24 13:48:50 hmd 00007 // ( Vanya Belyaev) patch #1171. The enhancement of existing Algorithm Context Service 00008 // is the primary goal of the proposed patch. The existing 00009 // AlgContextSvc is not safe with respect to e.g. Data-On-Demand 00010 // service or to operations with subalgorithms. The patched service 00011 // essentially implements the queue of executing algorithms, thus the 00012 // problems are eliminiated. In addition the enriched interface 00013 // provides the access to the whole queue of executing algorithms. 00014 // 00015 // ============================================================================ 00016 // Include files 00017 // ============================================================================ 00018 // GaudiKernel 00019 // ============================================================================ 00020 #include "GaudiKernel/IAlgContextSvc.h" 00021 #include "GaudiKernel/IAlgorithm.h" 00022 // ============================================================================ 00028 // ============================================================================ 00029 // virtual and protected destcructor 00030 // ============================================================================ 00031 IAlgContextSvc::~IAlgContextSvc(){} 00032 // ============================================================================ 00033 /* constructor from service and algorithm 00034 * Internally invokes IAlgContextSvc::setCurrentAlg 00035 * @see IAlgorithm 00036 * @see IAlgContextSvc 00037 * @param svc pointer to algorithm context service 00038 * @param alg pointer to the current algorithm 00039 */ 00040 // ============================================================================ 00041 Gaudi::Utils::AlgContext::AlgContext 00042 ( IAlgContextSvc* svc , 00043 IAlgorithm* alg ) 00044 : m_svc ( svc ) 00045 , m_alg ( alg ) 00046 { 00047 if ( 0 != m_alg ) { m_alg -> addRef() ; } 00048 if ( 0 != m_svc ) { m_svc -> addRef() ; } 00049 if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; } 00050 } 00051 // ============================================================================ 00052 /* constructor from service and algorithm 00053 * Internally invokes IAlgContextSvc::setCurrentAlg 00054 * @see IAlgorithm 00055 * @see IAlgContextSvc 00056 * @param alg pointer to the current algorithm 00057 * @param svc pointer to algorithm context service 00058 */ 00059 // ============================================================================ 00060 Gaudi::Utils::AlgContext::AlgContext 00061 ( IAlgorithm* alg , 00062 IAlgContextSvc* svc ) 00063 : m_svc ( svc ) 00064 , m_alg ( alg ) 00065 { 00066 if ( 0 != m_alg ) { m_alg -> addRef() ; } 00067 if ( 0 != m_svc ) { m_svc -> addRef() ; } 00068 if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; } 00069 } 00070 // ============================================================================ 00071 /* destructor 00072 * Internally invokes IAlgContextSvc::unSetCurrentAlg 00073 * @see IAlgorithm 00074 * @see IAlgContextSvc 00075 */ 00076 // ============================================================================ 00077 Gaudi::Utils::AlgContext::~AlgContext() 00078 { 00079 if ( 0 != m_svc && 0 != m_alg ) 00080 { m_svc->unSetCurrentAlg ( m_alg ).ignore() ; } 00081 if ( 0 != m_svc ) { m_svc -> release () ; m_svc = 0 ; } 00082 if ( 0 != m_alg ) { m_alg -> release () ; m_alg = 0 ; } 00083 } 00084 // ============================================================================ 00085 00086 00087 // ============================================================================ 00088 // The END 00089 // ============================================================================ 00090