All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
AlgContext.cpp
Go to the documentation of this file.
1 // $Id: AlgContext.cpp,v 1.1 2007/05/24 13:48:50 hmd Exp $
2 // ============================================================================
3 // CVS tag $Name: $, version $Revision: 1.1 $
4 // ============================================================================
5 // $Log: AlgContext.cpp,v $
6 // Revision 1.1 2007/05/24 13:48:50 hmd
7 // ( Vanya Belyaev) patch #1171. The enhancement of existing Algorithm Context Service
8 // is the primary goal of the proposed patch. The existing
9 // AlgContextSvc is not safe with respect to e.g. Data-On-Demand
10 // service or to operations with subalgorithms. The patched service
11 // essentially implements the queue of executing algorithms, thus the
12 // problems are eliminiated. In addition the enriched interface
13 // provides the access to the whole queue of executing algorithms.
14 //
15 // ============================================================================
16 // Include files
17 // ============================================================================
18 // GaudiKernel
19 // ============================================================================
21 #include "GaudiKernel/IAlgorithm.h"
22 // ============================================================================
28 // ============================================================================
29 // virtual and protected destcructor
30 // ============================================================================
32 // ============================================================================
33 /* constructor from service and algorithm
34  * Internally invokes IAlgContextSvc::setCurrentAlg
35  * @see IAlgorithm
36  * @see IAlgContextSvc
37  * @param svc pointer to algorithm context service
38  * @param alg pointer to the current algorithm
39  */
40 // ============================================================================
43  IAlgorithm* alg )
44  : m_svc ( svc )
45  , m_alg ( alg )
46 {
47  if ( 0 != m_alg ) { m_alg -> addRef() ; }
48  if ( 0 != m_svc ) { m_svc -> addRef() ; }
49  if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; }
50 }
51 // ============================================================================
52 /* constructor from service and algorithm
53  * Internally invokes IAlgContextSvc::setCurrentAlg
54  * @see IAlgorithm
55  * @see IAlgContextSvc
56  * @param alg pointer to the current algorithm
57  * @param svc pointer to algorithm context service
58  */
59 // ============================================================================
61 ( IAlgorithm* alg ,
62  IAlgContextSvc* svc )
63  : m_svc ( svc )
64  , m_alg ( alg )
65 {
66  if ( 0 != m_alg ) { m_alg -> addRef() ; }
67  if ( 0 != m_svc ) { m_svc -> addRef() ; }
68  if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; }
69 }
70 // ============================================================================
71 /* destructor
72  * Internally invokes IAlgContextSvc::unSetCurrentAlg
73  * @see IAlgorithm
74  * @see IAlgContextSvc
75  */
76 // ============================================================================
78 {
79  if ( 0 != m_svc && 0 != m_alg )
80  { m_svc->unSetCurrentAlg ( m_alg ).ignore() ; }
81  if ( 0 != m_svc ) { m_svc -> release () ; m_svc = 0 ; }
82  if ( 0 != m_alg ) { m_alg -> release () ; m_alg = 0 ; }
83 }
84 // ============================================================================
85 
86 
87 // ============================================================================
88 // The END
89 // ============================================================================
90 
~AlgContext()
destructor Internally invokes IAlgContextSvc::unSetCurrentAlg
Definition: AlgContext.cpp:77
virtual ~IAlgContextSvc()
virtual and protected desctructor
Definition: AlgContext.cpp:31
The IAlgorithm is the interface implemented by the Algorithm base class.
Definition: IAlgorithm.h:20
AlgContext()
no default constructor!
An abstract interface for Algorithm Context Service.
void ignore() const
Definition: StatusCode.h:107
IAlgContextSvc * m_svc
virtual StatusCode unSetCurrentAlg(IAlgorithm *a)=0
remove the algorithm ("pop_back")