acsalarm::AlarmsMap

NAME
SYNOPSIS
Detailed Description
Constructor & Destructor Documentation
Member Function Documentation
Member Data Documentation
Author

NAME

acsalarm::AlarmsMap −

SYNOPSIS

#include <AlarmsMap.h>

Public Member Functions

AlarmsMap ()

virtual ~AlarmsMap ()

bool raise (std::string alarmID)

void start ()

void shutdown ()

bool clear (std::string alarmID)

virtual void updateInternalDataStructs ()

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

it has never been sent before

its state changed

the last time the alarm has been sent is older then KEEP_ALARMS_TIME

Alarms older then a given number of seconds are deleted from the queue so that they will be resend anyhow. This was initially achieved with a dedicated thread but since we have to reduce the number of thread to save memory, the updated is explicitly requested by an external entity executing updateInternalDataStructs().

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

virtual acsalarm::AlarmsMap::~AlarmsMap () [inline, virtual] Destructor

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

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

virtual void acsalarm::AlarmsMap::updateInternalDataStructs () [virtual] Removes the alarm older then KEEP_ALARMS_TIME from the map.

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]

bool acsalarm::AlarmsMap::m_closed [private]

ACE_Recursive_Thread_Mutex acsalarm::AlarmsMap::m_mutex [private]

Author

Generated automatically by Doxygen for ACS-2015.2 C++ API from the source code.