![]() |
|
|
Generated: 18 Jul 2008 |
00001 // $Id: AlgContext.cpp,v 1.1 2007/05/24 13:48:50 hmd Exp $ 00002 // ============================================================================ 00003 // CVS tag $Name: v25r2 $, 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 // The unique interface identifier 00030 // ============================================================================ 00031 const InterfaceID& IAlgContextSvc::interfaceID() 00032 { 00033 static const InterfaceID s_interface ( "IAlgContextSvc" , 2 , 0 ) ; 00034 return s_interface ; 00035 } 00036 // ============================================================================ 00037 // virtual and protected destcructor 00038 // ============================================================================ 00039 IAlgContextSvc::~IAlgContextSvc(){} 00040 // ============================================================================ 00041 /* constructor from service and algorithm 00042 * Internally invokes IAlgContextSvc::setCurrentAlg 00043 * @see IAlgorithm 00044 * @see IAlgContextSvc 00045 * @param svc pointer to algorithm context service 00046 * @param alg pointer to the current algorithm 00047 */ 00048 // ============================================================================ 00049 Gaudi::Utils::AlgContext::AlgContext 00050 ( IAlgContextSvc* svc , 00051 IAlgorithm* alg ) 00052 : m_svc ( svc ) 00053 , m_alg ( alg ) 00054 { 00055 if ( 0 != m_alg ) { m_alg -> addRef() ; } 00056 if ( 0 != m_svc ) { m_svc -> addRef() ; } 00057 if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; } 00058 } 00059 // ============================================================================ 00060 /* constructor from service and algorithm 00061 * Internally invokes IAlgContextSvc::setCurrentAlg 00062 * @see IAlgorithm 00063 * @see IAlgContextSvc 00064 * @param alg pointer to the current algorithm 00065 * @param svc pointer to algorithm context service 00066 */ 00067 // ============================================================================ 00068 Gaudi::Utils::AlgContext::AlgContext 00069 ( IAlgorithm* alg , 00070 IAlgContextSvc* svc ) 00071 : m_svc ( svc ) 00072 , m_alg ( alg ) 00073 { 00074 if ( 0 != m_alg ) { m_alg -> addRef() ; } 00075 if ( 0 != m_svc ) { m_svc -> addRef() ; } 00076 if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; } 00077 } 00078 // ============================================================================ 00079 /* destructor 00080 * Internally invokes IAlgContextSvc::unSetCurrentAlg 00081 * @see IAlgorithm 00082 * @see IAlgContextSvc 00083 */ 00084 // ============================================================================ 00085 Gaudi::Utils::AlgContext::~AlgContext() 00086 { 00087 if ( 0 != m_svc && 0 != m_alg ) 00088 { m_svc->unSetCurrentAlg ( m_alg ).ignore() ; } 00089 if ( 0 != m_svc ) { m_svc -> release () ; m_svc = 0 ; } 00090 if ( 0 != m_alg ) { m_alg -> release () ; m_alg = 0 ; } 00091 } 00092 // ============================================================================ 00093 00094 00095 // ============================================================================ 00096 // The END 00097 // ============================================================================ 00098