| # Gaudi Framework, version v22r4 |

Home |  | Generated: Fri Sep 2 2011

Public Member Functions | Private Member Functions | Private Attributes

# Gaudi::Utils::AlgContext Class Reference

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

`#include <IAlgContextSvc.h>`

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

List of all members.

## Public Member Functions
| AlgContext (IAlgContextSvc *svc, IAlgorithm *alg)
| constructor from the service and the algorithm Internally invokes IAlgContextSvc::setCurrentAlg
| AlgContext (IAlgorithm *alg, IAlgContextSvc *svc)
| constructor from the algorithm and the service Internally invokes IAlgContextSvc::setCurrentAlg
| ~AlgContext ()
| destructor Internally invokes IAlgContextSvc::unSetCurrentAlg
## Private Member Functions
| AlgContext ()
| no default constructor!
| AlgContext (const AlgContext &right)
| no copy!
AlgContext & | operator= (const AlgContext &right)
| no assignement!
## Private Attributes
IAlgContextSvc * | m_svc
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 ibelyaev@phys.syr.edu

Date:
  2007-03-07

Definition at line 84 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 42 of file AlgContext.cpp.

      : m_svc ( svc )
      , m_alg ( alg )
    {
      if ( 0 != m_alg ) { m_alg -> addRef() ; }
      if ( 0 != m_svc ) { m_svc -> addRef() ; }
      if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; }
    }

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 61 of file AlgContext.cpp.

      : m_svc ( svc )
      , m_alg ( alg )
    {
      if ( 0 != m_alg ) { m_alg -> addRef() ; }
      if ( 0 != m_svc ) { m_svc -> addRef() ; }
      if ( 0 != m_svc && 0 != m_alg ) { m_svc->setCurrentAlg ( m_alg ).ignore() ; }
    }

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

destructor Internally invokes IAlgContextSvc::unSetCurrentAlg

See also:
  IAlgorithm
  IAlgContextSvc

Definition at line 77 of file AlgContext.cpp.

    {
      if ( 0 != m_svc && 0 != m_alg )
      { m_svc->unSetCurrentAlg ( m_alg ).ignore() ; }
      if ( 0 != m_svc ) { m_svc -> release () ; m_svc = 0 ; }
      if ( 0 != m_alg ) { m_alg -> release () ; m_alg = 0 ; }
    }

Gaudi::Utils::AlgContext::AlgContext | ( | ) | `[private]`

no default constructor!

Gaudi::Utils::AlgContext::AlgContext | ( | const AlgContext & | right ) | `[private]`

no copy!

## Member Function Documentation

AlgContext& Gaudi::Utils::AlgContext::operator= | ( | const AlgContext & | right ) | `[private]`

no assignement!

## Member Data Documentation

IAlgorithm* Gaudi::Utils::AlgContext::m_alg`[private]`

Definition at line 122 of file IAlgContextSvc.h.

IAlgContextSvc* Gaudi::Utils::AlgContext::m_svc`[private]`

Definition at line 121 of file IAlgContextSvc.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r4/GaudiKernel/GaudiKernel/IAlgContextSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v22r4/GaudiKernel/src/Lib/AlgContext.cpp

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines