| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Private Member Functions | Private Attributes | List of all members
Gaudi::Utils::AlgContext Class Referencefinal

Helper "sentry" class to automatize the safe register/unregister the algorithm's context. More...

`#include <GaudiKernel/IAlgContextSvc.h>`

Collaboration diagram for Gaudi::Utils::AlgContext:
[legend]

## Public Member Functions
| AlgContext (IAlgContextSvc *svc, IAlgorithm *alg)
| constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg More...
| AlgContext (IAlgorithm *alg, IAlgContextSvc *svc)
| constructor from the algorithm and the service Internally invokes IAlgContextSvc::setCurrentAlg More...
| ~AlgContext ()
| destructor Internally invokes IAlgContextSvc::unSetCurrentAlg More...

## Private Member Functions
| AlgContext ()=delete
| AlgContext (const AlgContext &right)=delete
AlgContext & | operator= (const AlgContext &right)=delete

## Private Attributes
SmartIF< IAlgContextSvc > | m_svc
SmartIF< IAlgorithm > | m_alg

## Detailed Description

Helper "sentry" class to automatize the safe register/unregister the algorithm's context.

Typical explicit usage:

StatusCode MyAlg::execute()
{
IAlgContextSvc* acs = ... ;
// define the context
Gaudi::Utils::AlgContext sentry ( this , acs ) ;
...
return StatusCode::SUCCESS ;
}

Note: for the regular job the context is properly defined with the help of corresponding auditor AlgContextAuditor. This helper class is needed only if one needs to ensure that the algorithm must register its context independently on job/auditor configuration

See also
  AlgContextAuditor

Author
  Vanya BELYAEV ibely.nosp@m.aev@.nosp@m.phys..nosp@m.syr..nosp@m.edu

Date
  2007-03-07

Definition at line 77 of file IAlgContextSvc.h.

## Constructor & Destructor Documentation

Gaudi::Utils::AlgContext::AlgContext | ( | IAlgContextSvc * | svc,
|  | IAlgorithm * | alg
| ) |  |

constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg

See also
  IAlgorithm
  IAlgContextSvc

Parameters

  svc | pointer to algorithm context service
  alg | pointer to the current algorithm

Definition at line 23 of file AlgContext.cpp.

23 : m_svc( svc ), m_alg( alg )
24 {
25 if ( m_svc && m_alg ) {
26 m_svc->setCurrentAlg( m_alg.get() ).ignore();
27 }
28 }
IAlgContextSvc::setCurrentAlg
virtual StatusCode setCurrentAlg(IAlgorithm *a)=0
set the currently executing algorithm ("push_back")
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
Gaudi::Utils::AlgContext::m_svc
SmartIF< IAlgContextSvc > m_svc
Definition: IAlgContextSvc.h:112
Gaudi::Utils::AlgContext::m_alg
SmartIF< IAlgorithm > m_alg
Definition: IAlgContextSvc.h:113

Gaudi::Utils::AlgContext::AlgContext | ( | IAlgorithm * | alg,
|  | IAlgContextSvc * | svc
| ) |  |

constructor from the algorithm and the service Internally invokes IAlgContextSvc::setCurrentAlg

See also
  IAlgorithm
  IAlgContextSvc

Parameters

  alg | pointer to the current algorithm
  svc | pointer to algorithm context service

Definition at line 38 of file AlgContext.cpp.

38 : m_svc( svc ), m_alg( alg )
39 {
40 if ( m_svc && m_alg ) {
41 m_svc->setCurrentAlg( m_alg.get() ).ignore();
42 }
43 }
IAlgContextSvc::setCurrentAlg
virtual StatusCode setCurrentAlg(IAlgorithm *a)=0
set the currently executing algorithm ("push_back")
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
Gaudi::Utils::AlgContext::m_svc
SmartIF< IAlgContextSvc > m_svc
Definition: IAlgContextSvc.h:112
Gaudi::Utils::AlgContext::m_alg
SmartIF< IAlgorithm > m_alg
Definition: IAlgContextSvc.h:113

Gaudi::Utils::AlgContext::~AlgContext | ( |  | ) |

destructor Internally invokes IAlgContextSvc::unSetCurrentAlg

See also
  IAlgorithm
  IAlgContextSvc

Definition at line 51 of file AlgContext.cpp.

52 {
53 if ( m_svc && m_alg ) {
54 m_svc->unSetCurrentAlg( m_alg.get() ).ignore();
55 }
56 }
SmartIF::get
TYPE * get() const
Get interface pointer.
Definition: SmartIF.h:82
Gaudi::Utils::AlgContext::m_svc
SmartIF< IAlgContextSvc > m_svc
Definition: IAlgContextSvc.h:112
IAlgContextSvc::unSetCurrentAlg
virtual StatusCode unSetCurrentAlg(IAlgorithm *a)=0
remove the algorithm ("pop_back")
Gaudi::Utils::AlgContext::m_alg
SmartIF< IAlgorithm > m_alg
Definition: IAlgContextSvc.h:113

Gaudi::Utils::AlgContext::AlgContext | ( |  | ) |
| private delete

Gaudi::Utils::AlgContext::AlgContext | ( | const AlgContext & | right | ) |
| private delete

## Member Function Documentation

AlgContext& Gaudi::Utils::AlgContext::operator= | ( | const AlgContext & | right | ) |
| private delete

## Member Data Documentation

SmartIF<IAlgorithm> Gaudi::Utils::AlgContext::m_alg
| private

Definition at line 113 of file IAlgContextSvc.h.

SmartIF<IAlgContextSvc> Gaudi::Utils::AlgContext::m_svc
| private

Definition at line 112 of file IAlgContextSvc.h.

The documentation for this class was generated from the following files:

- GaudiKernel/GaudiKernel/IAlgContextSvc.h
- GaudiKernel/src/Lib/AlgContext.cpp