| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# StatusCodeSvc Class Reference

`#include <StatusCodeSvc.h>`

Inheritance diagram for StatusCodeSvc:

[legend]
Collaboration diagram for StatusCodeSvc:

[legend]
List of all members.

## Detailed Description

Definition at line 14 of file StatusCodeSvc.h.

## Public Member Functions
virtual StatusCode | initialize ()
| Initialization (from CONFIGURED to INITIALIZED).
virtual StatusCode | reinitialize ()
| Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).
virtual StatusCode | finalize ()
| Finalize (from INITIALIZED to CONFIGURED).
virtual StatusCode | queryInterface (const InterfaceID &riid, void **ppvInterface)
| Query interfaces of Interface.
virtual void | regFnc (const std::string &func, const std::string &lib)
virtual void | list () const
virtual bool | suppressCheck () const
| StatusCodeSvc (const std::string &name, ISvcLocator *svc)
virtual | ~StatusCodeSvc ()
## Private Member Functions
void | filterFnc (std::string)
## Private Attributes
StringArrayProperty | m_pFilter
BooleanProperty | m_abort
BooleanProperty | m_suppress
std::map< std::string, StatCodeDat > | m_dat
std::set< std::string > | m_filter
## Friends
class | SvcFactory< StatusCodeSvc >
## Classes
struct | StatCodeDat

## Constructor & Destructor Documentation

StatusCodeSvc::StatusCodeSvc | ( | const std::string & | name,
|  | ISvcLocator * | svc |
| ) |  |  |

Definition at line 15 of file StatusCodeSvc.cpp.

    00016   : Service( name, svc )
    00017 {
    00018
    00019   declareProperty("Filter",m_pFilter);
    00020   declareProperty("AbortOnError",m_abort=false);
    00021   declareProperty("SuppressCheck", m_suppress=false);
    00022
    00023 }

StatusCodeSvc::~StatusCodeSvc | ( |  | ) | `[virtual]`

Definition at line 27 of file StatusCodeSvc.cpp.

    00027                               {
    00028
    00029 }

## Member Function Documentation

StatusCode StatusCodeSvc::initialize | ( |  | ) | `[virtual]`

Initialization (from CONFIGURED to INITIALIZED).

Reimplemented from Service.

Definition at line 56 of file StatusCodeSvc.cpp.

References endreq(), filterFnc(), MSG::INFO, Service::initialize(), StatusCode::isSuccess(), m_filter, m_pFilter, Service::msgSvc(), Service::name(), StatusCode::SUCCESS, and PropertyWithValue< TYPE >::value().

    00056                           {
    00057
    00058   StatusCode sc = Service::initialize();
    00059   if (!sc.isSuccess()) return sc;
    00060
    00061   MsgStream log( msgSvc(), name() );
    00062   log << MSG::INFO << "initialize" << endreq;
    00063
    00064   std::vector<std::string>::const_iterator itr;
    00065   for (itr = m_pFilter.value().begin(); itr != m_pFilter.value().end(); ++itr) {
    00066     // we need to do this if someone has gotten to regFnc before initialize
    00067     filterFnc(*itr);
    00068
    00069     m_filter.insert(*itr);
    00070   }
    00071
    00072   return StatusCode::SUCCESS;
    00073
    00074 }

StatusCode StatusCodeSvc::reinitialize | ( |  | ) | `[virtual]`

Initialization (from INITIALIZED or RUNNING to INITIALIZED, via CONFIGURED).

Reimplemented from Service.

Definition at line 79 of file StatusCodeSvc.cpp.

References endreq(), MSG::INFO, Service::msgSvc(), Service::name(), and StatusCode::SUCCESS.

    00079                             {
    00080
    00081   MsgStream log( msgSvc(), name() );
    00082   log << MSG::INFO << "reinitialize" << endreq;
    00083
    00084   return StatusCode::SUCCESS;
    00085
    00086 }

StatusCode StatusCodeSvc::finalize | ( |  | ) | `[virtual]`

Finalize (from INITIALIZED to CONFIGURED).

Reimplemented from Service.

Definition at line 90 of file StatusCodeSvc.cpp.

References endreq(), MSG::INFO, list(), m_dat, Service::msgSvc(), Service::name(), and StatusCode::SUCCESS.

    00090                         {
    00091
    00092   if (m_dat.size() > 0) {
    00093     MsgStream log( msgSvc(), name() );
    00094
    00095     log << MSG::INFO << "listing all unchecked return codes:" << endreq;
    00096
    00097     list();
    00098
    00099   }
    00100
    00101   return StatusCode::SUCCESS;
    00102
    00103 }

StatusCode StatusCodeSvc::queryInterface | ( | const InterfaceID & | riid,
|  | void ** | ppvInterface |
| ) |  |  | `[virtual]`

Query interfaces of Interface.

Parameters:

  | riid | ID of Interface to be retrieved
  | ppvUnknown | Pointer to Location for interface pointer

Reimplemented from Service.

Definition at line 33 of file StatusCodeSvc.cpp.

References Service::addRef(), StatusCode::FAILURE, IStatusCodeSvc::interfaceID(), Service::queryInterface(), and StatusCode::SUCCESS.

    00035 {
    00036   StatusCode sc = StatusCode::FAILURE;
    00037   if ( ppvInterface ) {
    00038     *ppvInterface = 0;
    00039
    00040     if ( IStatusCodeSvc::interfaceID().versionMatch(riid) )    {
    00041       //    if ( riid == IID_StatusCodeSvc ) {
    00042       *ppvInterface = static_cast<IStatusCodeSvc*>(this);
    00043       sc = StatusCode::SUCCESS;
    00044       addRef();
    00045     }
    00046     else
    00047       sc = Service::queryInterface( riid, ppvInterface );
    00048   }
    00049   return sc;
    00050 }

void StatusCodeSvc::regFnc | ( | const std::string & | func,
|  | const std::string & | lib |
| ) |  |  | `[virtual]`

Implements IStatusCodeSvc.

Definition at line 110 of file StatusCodeSvc.cpp.

References StatusCodeSvc::StatCodeDat::count, endreq(), MSG::FATAL, StatusCodeSvc::StatCodeDat::fnc, StatusCodeSvc::StatCodeDat::lib, m_abort, m_dat, m_filter, Service::msgSvc(), and Service::name().

    00110                                                                 {
    00111
    00112   if (m_filter.find(fnc) != m_filter.end()) {
    00113     return;
    00114   }
    00115
    00116   if (m_abort) {
    00117     MsgStream log( msgSvc(), name() );
    00118     log << MSG::FATAL << "Unchecked StatusCode in " << fnc << " from lib "
    00119         << lib << endreq;
    00120     abort();
    00121   }
    00122
    00123   string key = fnc + lib;
    00124
    00125   map<string,StatCodeDat>::iterator itr = m_dat.find(key);
    00126
    00127   if (itr != m_dat.end()) {
    00128     itr->second.count += 1;
    00129   } else {
    00130
    00131     int i1 = lib.rfind("/",lib.length());
    00132     string rlib = lib.substr(i1+1,lib.length()-i1-1);
    00133
    00134     StatCodeDat dat;
    00135     dat.fnc = fnc;
    00136     dat.lib = rlib;
    00137     dat.count = 1;
    00138
    00139     m_dat[key] = dat;
    00140   }
    00141
    00142 }

void StatusCodeSvc::list | ( |  | ) | const`[virtual]`

Implements IStatusCodeSvc.

Definition at line 147 of file StatusCodeSvc.cpp.

References endl(), endreq(), MSG::INFO, m_dat, Service::msgSvc(), Service::name(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::setf(), std::basic_ostringstream< _CharT, _Traits, _Alloc >::str(), and std::basic_ostringstream< _CharT, _Traits, _Alloc >::width().

Referenced by finalize().

    00147                           {
    00148
    00149   MsgStream log( msgSvc(), name() );
    00150   log << MSG::INFO << endl;
    00151
    00152   map<string,StatCodeDat>::const_iterator itr;
    00153
    00154 #if defined (__GNUC__) && ( __GNUC__ <= 2 )
    00155   std::ostrstream os;
    00156 #else
    00157   std::ostringstream os;
    00158 #endif
    00159
    00160   os << "Num | Function                       | Source Library" << endl;
    00161   os << "----+--------------------------------+-------------------"
    00162      << "-----------------------" << endl;
    00163
    00164
    00165   for(itr = m_dat.begin(); itr != m_dat.end(); ++itr ) {
    00166     StatCodeDat dat = itr->second;
    00167
    00168     os.width(3);
    00169     os.setf(ios_base::right,ios_base::adjustfield);
    00170     os << dat.count;
    00171
    00172     os << " | ";
    00173     os.width(30);
    00174     os.setf(ios_base::left,ios_base::adjustfield);
    00175     os << dat.fnc;
    00176
    00177     os << " | ";
    00178     os.setf(ios_base::left,ios_base::adjustfield);
    00179     os << dat.lib;
    00180
    00181     os << endl;
    00182
    00183   }
    00184
    00185
    00186   log << os.str() << endreq;
    00187
    00188 }

virtual bool StatusCodeSvc::suppressCheck | ( |  | ) | const`[inline, virtual]`

Implements IStatusCodeSvc.

Definition at line 29 of file StatusCodeSvc.h.

References m_suppress, and PropertyWithValue< TYPE >::value().

    00029 { return m_suppress.value() ; }

void StatusCodeSvc::filterFnc | ( | std::string |  | ) | `[private]`

Definition at line 193 of file StatusCodeSvc.cpp.

References m_dat.

Referenced by initialize().

    00193                                       {
    00194
    00195   std::map<std::string, StatCodeDat>::iterator itr;
    00196   for (itr = m_dat.begin(); itr != m_dat.end(); ++itr ) {
    00197     if (itr->second.fnc == str) {
    00198       m_dat.erase(itr);
    00199       return;
    00200     }
    00201
    00202   }
    00203
    00204 }

## Friends And Related Function Documentation

friend class SvcFactory< StatusCodeSvc >`[friend]`

Definition at line 48 of file StatusCodeSvc.h.

## Member Data Documentation

StringArrayProperty StatusCodeSvc::m_pFilter`[private]`

Definition at line 50 of file StatusCodeSvc.h.

Referenced by initialize().

BooleanProperty StatusCodeSvc::m_abort`[private]`

Definition at line 51 of file StatusCodeSvc.h.

Referenced by regFnc().

BooleanProperty StatusCodeSvc::m_suppress`[private]`

Definition at line 52 of file StatusCodeSvc.h.

Referenced by suppressCheck().

std::map<std::string,StatCodeDat> StatusCodeSvc::m_dat`[private]`

Definition at line 54 of file StatusCodeSvc.h.

Referenced by filterFnc(), finalize(), list(), and regFnc().

std::set<std::string> StatusCodeSvc::m_filter`[private]`

Definition at line 55 of file StatusCodeSvc.h.

Referenced by initialize(), and regFnc().

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/StatusCodeSvc/StatusCodeSvc.h
- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiSvc/v17r1/src/StatusCodeSvc/StatusCodeSvc.cpp