33 ,
m_header (
" Counter :: Group | # | sum | mean/eff^* | rms/err^* | min | max |")
35 ,
m_format1 (
" %|15.15s|%|-15.15s|%|32t||%|10d| |%|11.7g| |%|#11.5g| |%|#11.5g| |%|#12.5g| |%|#12.5g| |" )
37 ,
m_format2 (
"*%|15.15s|%|-15.15s|%|32t||%|10d| |%|11.5g| |(%|#9.7g| +- %|-#9.7g|)%%| ------- | ------- |" )
46 "The header row for the output Stat-table" ) ;
50 "The format for the regular row in the output Stat-table" ) ;
54 "The format for the regular row in the outptu Stat-table" ) ;
58 "Use the special format for printout of efficiency counters" ) ;
79 (
const std::string& group ,
80 const std::string&
name )
const;
96 (
const std::string& group ,
97 const std::string&
name ,
112 (
const std::string& group ,
113 const std::string&
name ,
125 (
const std::string& group ,
126 const std::string&
name ) ;
133 (
const std::string& group ) ;
144 (
const std::string& group,
145 const std::string&
name,
146 Printout& printer)
const;
155 (
const std::string& group,
156 Printout& printer)
const;
165 Printout& printer)
const;
174 Printout& printer)
const;
182 const Counter* pCounter)
const ;
187 if ( 0 == c ) {
return std::pair<std::string,std::string>() ; }
191 {
if ( j->second == c ) {
return std::make_pair(
i->first , j->first ) ; } }
193 return std::pair<std::string,std::string>() ;
196 inline size_t num ()
const
203 {
if ( 0 != j->second ) { ++result ; } ; }
210 void print ()
const ;
235 ( const
std::
string& grp ,
236 const
std::
string& nam )
const
239 if ( m_counts.end() ==
i ) {
return 0 ; }
241 if ( i->second.end() == j ) {
return 0 ; }
253 { result.push_back(
CountObject ( j->second, i->first , j->first ) ) ; }
261 #pragma warning(push)
262 #pragma warning(disable:2259)
265 (
const std::string& grp ,
266 const std::string& nam ,
271 refpCounter =
get ( grp , nam ) ;
272 if ( 0 != refpCounter ) {
return COUNTER_EXISTS ; }
276 if ( 0 != initial_value ) {
277 refpCounter->
addFlag ( static_cast<double>(initial_value) ) ;
282 if ( m_counts.end() ==
i )
283 { i = m_counts.insert ( std::make_pair ( grp ,
NameMap() ) ).first ; }
285 i->second.insert( std::make_pair( nam , newc ) );
296 (
const std::string& group ,
297 const std::string& name ,
301 StatusCode sc = create ( group, name, initial_value, p ) ;
303 throw std::runtime_error(
"CounterSvc::Counter('"+group+
"::"+name+
"') exists already!");
309 (
const std::string& grp ,
310 const std::string& nam )
313 if ( m_counts.end() ==
i ) {
return COUNTER_NOT_PRESENT ; }
315 if ( i->second.end() == j ) {
return COUNTER_NOT_PRESENT ; }
317 i->second.erase ( j ) ;
328 {
delete j->second ; }
339 {
remove (
i->first ).ignore () ; }
347 (
const std::string& grp,
348 const std::string& nam,
351 const Counter*
c =
get( grp , nam ) ;
352 if ( 0 == c ) {
return COUNTER_NOT_PRESENT ; }
355 return printer ( log , c ) ;
360 class conditionalPrint {
367 void operator() (
const Pair &p) {
369 (*printer)(*
log, p.second).ignore();
378 (
const std::string& grp ,
382 if ( m_counts.end() ==
i ) {
return COUNTER_NOT_PRESENT ; }
386 typedef std::map<std::string, Counter*> sorted_map_t;
387 sorted_map_t sorted_map(i->second.begin(), i->second.end());
388 std::for_each(sorted_map.begin(), sorted_map.end(),
389 conditionalPrint(printer, log));
400 return printer ( log , pCounter ) ;
408 {
return print( refCounter.
counter() , printer ) ; }
416 typedef std::map<std::pair<std::string,std::string>,
Counter*> sorted_map_t;
417 sorted_map_t sorted_map;
422 sorted_map[std::make_pair(
i->first, j->first)] = j->second;
425 std::for_each(sorted_map.begin(), sorted_map.end(),
426 conditionalPrint(printer, log));
437 std::pair<std::string,std::string> p = _find ( c ) ;
440 <<
CountObject( const_cast<Counter*>(c) , p.first , p.second )
452 const size_t _num =
num() ;
456 <<
"Number of counters : " << _num <<
endmsg
461 typedef std::map<std::pair<std::string,std::string>,
Counter*> sorted_map_t;
462 sorted_map_t sorted_map;
468 if ( 0 == c ) { continue ; }
469 sorted_map[std::make_pair(
i->first, j->first)] =
c;
472 for (sorted_map_t::const_iterator
i = sorted_map.begin();
i != sorted_map.end(); ++
i )