#include <feeserver/fee_mon.hh>
Public Types | |
typedef std::map< std::string, Item * > | ItemMap |
Public Member Functions | |
MonitorThread (Main &main, unsigned int rate=1000) | |
void * | operator() () |
bool | Suspend () |
bool | Resume () |
void | SetRate (unsigned int rate) |
unsigned int | Rate () const |
int | Publish (ServiceBase &service) |
int | Unpublish (const std::string &name) |
void | RemoveServices () |
ItemMap & | Items () |
Protected Attributes | |
Main & | _main |
ItemMap | _items |
unsigned int | _update_rate |
Mutex | _mutex |
Condition | _condition |
bool | _suspend |
bool | _changed |
const unsigned int | _interval_multiplier |
typedef std::map<std::string, Item*> FeeServer::MonitorThread::ItemMap |
Map of items
FeeServer::MonitorThread::MonitorThread | ( | Main & | main, | |
unsigned int | rate = 1000 | |||
) |
Constructor
main | Reference to fee server main. | |
rate | Update rate in miliseconds. |
void * FeeServer::MonitorThread::operator() | ( | ) | [virtual] |
Do the thread thing
Implements FeeServer::Thread.
bool FeeServer::MonitorThread::Suspend | ( | ) |
Suspend the thread. Must not be called from monitor thread it self, as it would dead-lock the thread.
bool FeeServer::MonitorThread::Resume | ( | ) |
Resume the thread. Must not be called from monitor thread it self, as it would dead-lock the thread.
void FeeServer::MonitorThread::SetRate | ( | unsigned int | rate | ) | [inline] |
Set the update rate
unsigned int FeeServer::MonitorThread::Rate | ( | ) | const [inline] |
Get the update rate
int FeeServer::MonitorThread::Publish | ( | ServiceBase & | service | ) |
Add a service
service | Service to publish |
int FeeServer::MonitorThread::Unpublish | ( | const std::string & | name | ) |
Un-publish a service. It is not removed from the list, but will not be updated
name | Name of service to remove |
void FeeServer::MonitorThread::RemoveServices | ( | ) |
Remove all services
ItemMap& FeeServer::MonitorThread::Items | ( | ) | [inline] |
Get item map
Main& FeeServer::MonitorThread::_main [protected] |
Reference to server.
ItemMap FeeServer::MonitorThread::_items [protected] |
Items
unsigned int FeeServer::MonitorThread::_update_rate [protected] |
Update rate, in which the whole Item-list should be checked for changes. This value is given in milliseconds.
Mutex FeeServer::MonitorThread::_mutex [protected] |
Mutex for suspension
Condition FeeServer::MonitorThread::_condition [protected] |
Condition for suspension
bool FeeServer::MonitorThread::_suspend [protected] |
Flag to indicate suspension
bool FeeServer::MonitorThread::_changed [protected] |
The service list is changed - restart inner loop.
const unsigned int FeeServer::MonitorThread::_interval_multiplier [protected] |
Interval multiplier