| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

# StatusCode.cpp

Go to the documentation of this file.

    00001 #define GAUDIKERNEL_STATUSCODE_CPP 1
    00002
    00003 #include "GaudiKernel/StatusCode.h"
    00004 #include "GaudiKernel/System.h"
    00005 #include "GaudiKernel/Bootstrap.h"
    00006 #include "GaudiKernel/IMessageSvc.h"
    00007 #include "GaudiKernel/IStatusCodeSvc.h"
    00008 #include "GaudiKernel/ISvcLocator.h"
    00009 #include "GaudiKernel/MsgStream.h"
    00010 #include "GaudiKernel/IssueSeverity.h"
    00011 #include <fstream>
    00012 #include <iostream>
    00013 #include <sstream>
    00014 #include <stdlib.h>
    00015 #include <exception>
    00016
    00017 bool StatusCode::s_checking(false);
    00018
    00019 void StatusCode::enableChecking() {
    00020   s_checking = true;
    00021 }
    00022
    00023 void StatusCode::disableChecking() {
    00024   s_checking = false;
    00025 }
    00026
    00027 const IssueSeverity& StatusCode::severity() const {
    00028   static IssueSeverity dummy;
    00029   if (m_severity) return *m_severity;
    00030   else            return dummy;
    00031 }
    00032
    00033 StatusCode::~StatusCode() {
    00034   if(UNLIKELY(s_checking)) {
    00035
    00036     if (!m_checked && !GaudiException::s_proc && !std::uncaught_exception() ) {
    00037
    00038       SmartIF<IMessageSvc> msg(Gaudi::svcLocator());
    00039
    00040       SmartIF<IStatusCodeSvc> scs(Gaudi::svcLocator()->service("StatusCodeSvc"));
    00041
    00042       const size_t depth = 21;
    00043       void* addresses[depth];
    00044
    00045       std::string lib, fnc;
    00046       void* addr = 0;
    00048       if (System::backTrace(addresses, depth)) {
    00049
    00050         if (System::getStackLevel(addresses[2], addr, fnc, lib)) {
    00051
    00052           if (scs) {
    00053             scs->regFnc(fnc,lib);
    00054           } else {
    00055             if (msg) {
    00056               MsgStream log(msg,"StatusCode");
    00057               log << MSG::WARNING << "Unchecked in " << fnc << " " << lib << endmsg;
    00058             } else {
    00059               std::cout << MSG::WARNING << "Unchecked in " << fnc << " " << lib << std::endl;
    00060             }
    00061           }
    00062
    00063         }
    00064
    00065       }
    00066     }
    00067   }
    00068 }
    00069

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