Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes

acsalarm::AlarmsMap Class Reference

#include <AlarmsMap.h>

Inheritance diagram for acsalarm::AlarmsMap:
Inheritance graph
[legend]
Collaboration diagram for acsalarm::AlarmsMap:
Collaboration graph
[legend]

List of all members.

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

Detailed Description

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(...)


Constructor & Destructor Documentation

acsalarm::AlarmsMap::AlarmsMap (  ) 

Constructor


Member Function Documentation

bool acsalarm::AlarmsMap::alarmSet ( std::string  alarmID,
bool  state 
) [private]

Store the alarm in the map with the passed ID and activation state.

Parameters:
alarmID The ID of the alarm
state The state (true means ACTIVE)
Returns:
true If the alarm must be send to the alarm service
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.

Parameters:
alarmID The ID of the alarm to raise
Returns:
true if the alarm was already present in the map (i.e. it must not be sent to the alarm server); false otherwise; false is also returned if the object has been shut down
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.

Parameters:
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.

Parameters:
alarmID The ID of the alarm to raise
Returns:
true if the alarm was already present in the map (i.e. it must not be sent to the alarm server); false otherwise false is also returned if the object has been shut down
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]
Returns:
the number of items in the map

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


Member Data Documentation

std::map<std::string, AlarmInfo*> acsalarm::AlarmsMap::alarmsMap [private]

Referenced by clear(), and size().

const ACS::Time acsalarm::AlarmsMap::KEEP_ALARMS_TIME = 30 [static, private]
ACE_Recursive_Thread_Mutex acsalarm::AlarmsMap::m_mutex [private]

The documentation for this class was generated from the following file: