35#include "BESReporterList.h"
36#include "BESReporter.h"
43static std::once_flag d_euc_init_once;
45BESReporterList::BESReporterList() {}
47BESReporterList::~BESReporterList()
50 BESReporterList::Reporter_iter i = _reporter_list.begin() ;
51 for( ; i != _reporter_list.end(); i++ )
53 reporter = (*i).second ;
54 if( reporter ) {
delete reporter ; (*i).second = 0 ; }
58 _reporter_list.clear() ;
62BESReporterList::add_reporter(
string reporter_name,
65 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
67 if( find_reporter( reporter_name ) == 0 )
69 _reporter_list[reporter_name] = reporter_object ;
76BESReporterList::remove_reporter(
string reporter_name )
78 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
81 BESReporterList::Reporter_iter i ;
82 i = _reporter_list.find( reporter_name ) ;
83 if( i != _reporter_list.end() )
86 _reporter_list.erase( i ) ;
92BESReporterList::find_reporter(
string reporter_name )
94 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
96 BESReporterList::Reporter_citer i ;
97 i = _reporter_list.find( reporter_name ) ;
98 if( i != _reporter_list.end() )
108 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
111 BESReporterList::Reporter_iter i = _reporter_list.begin() ;
112 for( ; i != _reporter_list.end(); i++ )
114 reporter = (*i).second ;
115 if( reporter ) reporter->report( dhi ) ;
129 std::lock_guard<std::recursive_mutex> lock_me(d_cache_lock_mutex);
131 strm << BESIndent::LMarg <<
"BESReporterList::dump - ("
132 << (
void *)
this <<
")" << endl ;
133 BESIndent::Indent() ;
134 if( _reporter_list.size() )
136 strm << BESIndent::LMarg <<
"registered reporters:" << endl ;
137 BESIndent::Indent() ;
138 BESReporterList::Reporter_citer i = _reporter_list.begin() ;
139 BESReporterList::Reporter_citer ie = _reporter_list.end() ;
140 for( ; i != ie; i++ )
142 strm << BESIndent::LMarg <<
"reporter: " << (*i).first << endl ;
143 BESIndent::Indent() ;
145 reporter->
dump( strm ) ;
146 BESIndent::UnIndent() ;
148 BESIndent::UnIndent() ;
152 strm << BESIndent::LMarg <<
"registered reporters: none" << endl ;
154 BESIndent::UnIndent() ;
158BESReporterList::TheList()
160 std::call_once(d_euc_init_once,BESReporterList::initialize_instance);
164void BESReporterList::initialize_instance() {
167 atexit(delete_instance);
171void BESReporterList::delete_instance() {
Structure storing information used by the BES to handle the request.
void dump(std::ostream &strm) const override
dumps information about this object
virtual void dump(std::ostream &strm) const =0
dump the contents of this object to the specified ostream