2 #ifndef __PHTIMESERVER_H__
3 #define __PHTIMESERVER_H__
38 timer(
const std::string& key,
unsigned short uid ):
44 {
return _timer.get(); }
47 {
return _timer.get(); }
55 std::shared_ptr<PHTimer> _timer;
84 void print( std::ostream& out = std::cout )
const;
87 void print_stat( std::ostream& out = std::cout )
const;
94 _single_shot_timer_id(0)
100 typedef std::map<std::string, timer > time_map;
103 typedef std::map<std::string, timer >::iterator time_iterator;
106 typedef std::map<std::string, timer >::const_iterator const_time_iterator;
112 time_map _single_shot_timers;
115 unsigned short _timer_id;
118 unsigned short _single_shot_timer_id;
130 if( _iter == _map.end() )
return 0;
139 if( _iter == _map.end() )
return 0;
140 return &_iter->second;
148 _iter( _map.begin() )
154 PHTimeServer::time_map _map;
157 PHTimeServer::time_iterator _iter;
light iterator over PHTimer map
iterator(PHTimeServer::time_map map)
creator
PHTimeServer::timer * current()
get PHTimer associated to current iterator position
PHTimeServer::timer * next()
get PHTimer associated to current iterator position, advance iterator
wrapper around PHTimer, for storage in a map
timer(const std::string &key, unsigned short uid)
unsigned short get_uid(void) const
const PHTimer * get(void) const
PHTimer server for accessing external information.
timer insert_new_single_shot(const std::string &)
insert new single_shot timer in map.
static PHTimeServer * get(void)
singleton accessor
iterator range(void)
return iterator over the map, located at begin
timer get_single_shot_timer(const std::string &)
retrieve existing timer. throw exception if not found
void print_stat(std::ostream &out=std::cout) const
dump all registered timer statistics.
timer insert_new(const std::string &)
insert new timer in map.
virtual ~PHTimeServer()
destructor
PHTimeServer()
constructor
timer get_timer(const std::string &)
retrieve existing timer. throw exception if not found
void print(std::ostream &out=std::cout) const
dump all registered timer value.