#include <AlarmsMap.h>


Public Member Functions | |
| AlarmsMap () | |
| bool | raise (std::string alarmID) |
| void | start () |
| void | shutdown () |
| bool | clear (std::string alarmID) |
| virtual void | runLoop () |
| int | size () |
| void | getAllAlarms (std::vector< AlarmInfo > alarms) |
| void | clear () |
Private Member Functions | |
| bool | alarmSet (std::string alarmID, bool state) |
Private Attributes | |
| std::map< std::string, AlarmInfo * > | alarmsMap |
| ACE_Recursive_Thread_Mutex | m_mutex |
| bool | m_closed |
Static Private Attributes | |
| static const ACS::Time | KEEP_ALARMS_TIME = 30 |
AlarmsMap is a collection of alarms to avoid resending an alarm if its state did not change.
It stores alarm IDs and the time of their submission and offers methods to tell if a submitted alarm has to be sent to the alarm server or not.
A alarm have to be sent to the AS if
Alarms older then a given number of seconds are deleted from the queue so that they will be resend anyhow.
Life cycle: start() has to be called before using objects of this class; shutdown() has to be called when terminated. After shutdown is called, the class does not accept any new alarm and always returns false in clear(...) and raise(...)
| acsalarm::AlarmsMap::AlarmsMap | ( | ) |
Constructor
| bool acsalarm::AlarmsMap::alarmSet | ( | std::string | alarmID, | |
| bool | state | |||
| ) | [private] |
Store the alarm in the map with the passed ID and activation state.
| alarmID | The ID of the alarm | |
| state | The state (true means ACTIVE) |
| bool acsalarm::AlarmsMap::clear | ( | std::string | alarmID | ) |
Add a terminate alarm in the map and check if it has to be sent to the alarm server by returning true.
| alarmID | The ID of the alarm to raise |
| void acsalarm::AlarmsMap::clear | ( | ) | [inline] |
Clear the map
References alarmsMap.
| void acsalarm::AlarmsMap::getAllAlarms | ( | std::vector< AlarmInfo > | alarms | ) |
Copy of all the elements in the map in the passed vector.
| alarms | the vector to store all the alarms in the map |
| bool acsalarm::AlarmsMap::raise | ( | std::string | alarmID | ) |
Add an active alarm in the map and check if it has to be sent to the alarm server by returning true.
| alarmID | The ID of the alarm to raise |
| virtual void acsalarm::AlarmsMap::runLoop | ( | ) | [virtual] |
The loop that removes the alarm older then KEEP_ALARMS_TIME from the map
Reimplemented from ACS::Thread.
| void acsalarm::AlarmsMap::shutdown | ( | ) |
Lyfe cycle: this method has to be called after using objects from this class.
This method free all the allocated resources
| int acsalarm::AlarmsMap::size | ( | ) | [inline] |
References alarmsMap.
| void acsalarm::AlarmsMap::start | ( | ) |
Lyfe cycle: this method has to be called before using objects from this class.
This method initialize the internal data structures
std::map<std::string, AlarmInfo*> acsalarm::AlarmsMap::alarmsMap [private] |
const ACS::Time acsalarm::AlarmsMap::KEEP_ALARMS_TIME = 30 [static, private] |
bool acsalarm::AlarmsMap::m_closed [private] |
ACE_Recursive_Thread_Mutex acsalarm::AlarmsMap::m_mutex [private] |
1.7.0