|
Gaudi Framework, version v22r0 |
| Home | Generated: 9 Feb 2011 |
#include <StatusCodeSvc.h>


Classes | |
| struct | StatCodeDat |
Public Member Functions | |
| virtual StatusCode | initialize () |
| virtual StatusCode | reinitialize () |
| virtual StatusCode | finalize () |
| 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 | parseFilter (const std::string &str, std::string &fnc, std::string &lib) |
| void | filterFnc (const std::string &) |
| void | filterLib (const std::string &) |
Private Attributes | |
| StringArrayProperty | m_pFilter |
| BooleanProperty | m_abort |
| BooleanProperty | m_suppress |
| BooleanProperty | m_dict |
| std::map< std::string, StatCodeDat > | m_dat |
| std::set< std::string > | m_filterfnc |
| std::set< std::string > | m_filterlib |
Friends | |
| class | SvcFactory< StatusCodeSvc > |
Definition at line 14 of file StatusCodeSvc.h.
| StatusCodeSvc::StatusCodeSvc | ( | const std::string & | name, | |
| ISvcLocator * | svc | |||
| ) |
Definition at line 18 of file StatusCodeSvc.cpp.
00019 : base_class( name, svc ) 00020 { 00021 00022 declareProperty("Filter",m_pFilter); 00023 declareProperty("AbortOnError",m_abort=false); 00024 declareProperty("SuppressCheck", m_suppress=false); 00025 declareProperty("IgnoreDicts",m_dict=true); 00026 00027 }
| StatusCodeSvc::~StatusCodeSvc | ( | ) | [virtual] |
Definition at line 31 of file StatusCodeSvc.cpp.
| void StatusCodeSvc::filterFnc | ( | const std::string & | str | ) | [private] |
Definition at line 200 of file StatusCodeSvc.cpp.
| void StatusCodeSvc::filterLib | ( | const std::string & | str | ) | [private] |
Definition at line 215 of file StatusCodeSvc.cpp.
| StatusCode StatusCodeSvc::finalize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 84 of file StatusCodeSvc.cpp.
| StatusCode StatusCodeSvc::initialize | ( | ) | [virtual] |
Reimplemented from Service.
Definition at line 39 of file StatusCodeSvc.cpp.
00039 { 00040 00041 StatusCode sc = Service::initialize(); 00042 if (!sc.isSuccess()) return sc; 00043 00044 MsgStream log( msgSvc(), name() ); 00045 log << MSG::INFO << "initialize" << endmsg; 00046 00047 std::vector<std::string>::const_iterator itr; 00048 for (itr = m_pFilter.value().begin(); itr != m_pFilter.value().end(); ++itr) { 00049 // we need to do this if someone has gotten to regFnc before initialize 00050 00051 string fnc,lib; 00052 parseFilter(*itr,fnc,lib); 00053 00054 if (fnc != "") { 00055 filterFnc(fnc); 00056 m_filterfnc.insert(fnc); 00057 } 00058 00059 if (lib != "") { 00060 filterLib(lib); 00061 m_filterlib.insert(lib); 00062 } 00063 00064 } 00065 00066 return StatusCode::SUCCESS; 00067 00068 }
| void StatusCodeSvc::list | ( | ) | const [virtual] |
Implements IStatusCodeSvc.
Definition at line 154 of file StatusCodeSvc.cpp.
00154 { 00155 00156 MsgStream log( msgSvc(), name() ); 00157 log << MSG::INFO << endl; 00158 00159 map<string,StatCodeDat>::const_iterator itr; 00160 00161 #if defined (__GNUC__) && ( __GNUC__ <= 2 ) 00162 std::ostrstream os; 00163 #else 00164 std::ostringstream os; 00165 #endif 00166 00167 os << "Num | Function | Source Library" << endl; 00168 os << "----+--------------------------------+-------------------" 00169 << "-----------------------" << endl; 00170 00171 00172 for(itr = m_dat.begin(); itr != m_dat.end(); ++itr ) { 00173 StatCodeDat dat = itr->second; 00174 00175 os.width(3); 00176 os.setf(ios_base::right,ios_base::adjustfield); 00177 os << dat.count; 00178 00179 os << " | "; 00180 os.width(30); 00181 os.setf(ios_base::left,ios_base::adjustfield); 00182 os << dat.fnc; 00183 00184 os << " | "; 00185 os.setf(ios_base::left,ios_base::adjustfield); 00186 os << dat.lib; 00187 00188 os << endl; 00189 00190 } 00191 00192 00193 log << os.str() << endmsg; 00194 00195 }
| void StatusCodeSvc::parseFilter | ( | const std::string & | str, | |
| std::string & | fnc, | |||
| std::string & | lib | |||
| ) | [private] |
Definition at line 231 of file StatusCodeSvc.cpp.
00231 { 00232 00233 00234 string::size_type loc = str.find("="); 00235 if (loc == std::string::npos) { 00236 fnc = str; 00237 lib = ""; 00238 } else { 00239 string key,val; 00240 key = str.substr(0,loc); 00241 val = str.substr(loc+1,str.length()-loc-1); 00242 00243 toupper(key); 00244 00245 if (key == "FCN" || key == "FNC") { 00246 fnc = val; 00247 lib = ""; 00248 } else if (key == "LIB") { 00249 fnc = ""; 00250 lib = val; 00251 } else { 00252 fnc = ""; 00253 lib = ""; 00254 00255 MsgStream log( msgSvc(), name() ); 00256 log << MSG::WARNING << "ignoring unknown token in Filter: " << str 00257 << endmsg; 00258 } 00259 } 00260 00261 }
| void StatusCodeSvc::regFnc | ( | const std::string & | func, | |
| const std::string & | lib | |||
| ) | [virtual] |
Implements IStatusCodeSvc.
Definition at line 104 of file StatusCodeSvc.cpp.
00104 { 00105 00106 if (m_state == Gaudi::StateMachine::OFFLINE || 00107 m_state == Gaudi::StateMachine::CONFIGURED) { 00108 return; 00109 } 00110 00111 if (m_dict && lib.rfind("Dict.so") == (lib.length()-7) ) { 00112 return; 00113 } 00114 00115 { 00116 const string rlib = lib.substr(lib.rfind("/") + 1); 00117 00118 if (m_filterfnc.find(fnc) != m_filterfnc.end() || 00119 m_filterlib.find(rlib) != m_filterlib.end() ) { 00120 return; 00121 } 00122 } 00123 00124 if (m_abort) { 00125 MsgStream log( msgSvc(), name() ); 00126 log << MSG::FATAL << "Unchecked StatusCode in " << fnc << " from lib " 00127 << lib << endmsg; 00128 abort(); 00129 } 00130 00131 string key = fnc + lib; 00132 00133 map<string,StatCodeDat>::iterator itr = m_dat.find(key); 00134 00135 if (itr != m_dat.end()) { 00136 itr->second.count += 1; 00137 } else { 00138 00139 const string rlib = lib.substr(lib.rfind("/") + 1); 00140 00141 StatCodeDat dat; 00142 dat.fnc = fnc; 00143 dat.lib = rlib; 00144 dat.count = 1; 00145 00146 m_dat[key] = dat; 00147 } 00148 00149 }
| StatusCode StatusCodeSvc::reinitialize | ( | ) | [virtual] |
| virtual bool StatusCodeSvc::suppressCheck | ( | ) | const [inline, virtual] |
Implements IStatusCodeSvc.
Definition at line 24 of file StatusCodeSvc.h.
00024 { return m_suppress.value() ; }
friend class SvcFactory< StatusCodeSvc > [friend] |
Definition at line 45 of file StatusCodeSvc.h.
BooleanProperty StatusCodeSvc::m_abort [private] |
Definition at line 48 of file StatusCodeSvc.h.
std::map<std::string,StatCodeDat> StatusCodeSvc::m_dat [private] |
Definition at line 50 of file StatusCodeSvc.h.
BooleanProperty StatusCodeSvc::m_dict [private] |
Definition at line 48 of file StatusCodeSvc.h.
std::set<std::string> StatusCodeSvc::m_filterfnc [private] |
Definition at line 51 of file StatusCodeSvc.h.
std::set<std::string> StatusCodeSvc::m_filterlib [private] |
Definition at line 51 of file StatusCodeSvc.h.
StringArrayProperty StatusCodeSvc::m_pFilter [private] |
Definition at line 47 of file StatusCodeSvc.h.
BooleanProperty StatusCodeSvc::m_suppress [private] |
Definition at line 48 of file StatusCodeSvc.h.