#include <AlarmSourceImpl.h>
Public Member Functions | |
AlarmSourceImpl (const AlarmSourceThread *updaterThread) | |
AlarmSourceImpl () | |
virtual | ~AlarmSourceImpl () |
void | raiseAlarm (std::string faultFamily, std::string faultMember, int faultCode) |
void | raiseAlarm (std::string faultFamily, std::string faultMember, int faultCode, Properties properties) |
void | clearAlarm (std::string faultFamily, std::string faultMember, int faultCode) |
void | setAlarm (std::string faultFamily, std::string faultMember, int faultCode, Properties alarmProps, bool active) |
void | setAlarm (std::string faultFamily, std::string faultMember, int faultCode, bool active) |
void | terminateAllAlarms () |
void | queueAlarms (ACS::TimeInterval time) |
void | queueAlarms () |
void | flushAlarms () |
void | disableAlarms () |
void | enableAlarms () |
virtual void | update (ACS::Time now) |
void | start () |
void | tearDown () |
Private Member Functions | |
std::string | buildAlarmID (std::string faultFamily, std::string faultMember, int faultCode) |
void | internalAlarmSender (std::string faultFamily, std::string faultMember, int faultCode, Properties alarmProps, bool active) |
Private Attributes | |
bool | m_disabled |
bool | m_queuing |
ACE_Recursive_Thread_Mutex | m_mutex |
std::map< std::string, AlarmToQueue * > | m_queue |
std::set< std::string > | m_activatedAlarms |
AlarmsMap | m_alarms |
auto_ptr < acsalarm::AlarmSystemInterface > | m_alarmSource_ap |
const AlarmSourceThread * | m_updaterThread_p |
bool | m_locallyInstantiatedThread |
ACS::Time | m_nextMapUpdateTime |
ACS::Time | m_nextFlushTime |
An implementation of AlarmSource.
This class uses the ACSAlarmInterfaceFactory to publish alarms. It assumes that the ACSAlarmInterfaceFactory is already initialized before using this class. In the same way, it assumes that ACSAlarmInterfaceFactory is shutdown after terminated using objects from this class. At the present, this is usually done by ACS for example for the components and the clients.
It is possible to send alarms with several overloaded methods like raise(...), clear(...) and set(...). All the overloaded methods delegate to set(...). internalAlarmSend(..) does the real sending of alarms to the alarm server.
acsalarm::AlarmSourceImpl::AlarmSourceImpl | ( | const AlarmSourceThread * | updaterThread | ) |
Constructor
updaterThread | The thread to update the state of the object |
acsalarm::AlarmSourceImpl::AlarmSourceImpl | ( | ) |
Constructor
The thread to update the state of the object is instantiated by AlarmSourceImpl and therefore will not be shared between different instances.
virtual acsalarm::AlarmSourceImpl::~AlarmSourceImpl | ( | ) | [virtual] |
Destructor
std::string acsalarm::AlarmSourceImpl::buildAlarmID | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode | |||
) | [private] |
Build the ID of an alarm from the triplet
faultFamily | The Fault Family | |
faultMember | The Fault Member | |
faultCode | The Fault Code |
void acsalarm::AlarmSourceImpl::clearAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode | |||
) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::disableAlarms | ( | ) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::enableAlarms | ( | ) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::flushAlarms | ( | ) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::internalAlarmSender | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode, | |||
Properties | alarmProps, | |||
bool | active | |||
) | [private] |
Send an alarm to the alarm server.
faultFamily | The FaultFamily | |
faultMember | The FaultMember | |
faultCode | The FaultCode | |
alarmProps | The user properties. It can be null or empty. | |
active | if true the alarm is activated otherwise it is terminated. |
void acsalarm::AlarmSourceImpl::queueAlarms | ( | ) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::queueAlarms | ( | ACS::TimeInterval | time | ) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::raiseAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode, | |||
Properties | properties | |||
) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::raiseAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode | |||
) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::setAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode, | |||
Properties | alarmProps, | |||
bool | active | |||
) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::setAlarm | ( | std::string | faultFamily, | |
std::string | faultMember, | |||
int | faultCode, | |||
bool | active | |||
) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::start | ( | ) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::tearDown | ( | ) | [virtual] |
Implements acsalarm::AlarmSource.
void acsalarm::AlarmSourceImpl::terminateAllAlarms | ( | ) | [virtual] |
Implements acsalarm::AlarmSource.
virtual void acsalarm::AlarmSourceImpl::update | ( | ACS::Time | now | ) | [virtual] |
Reimplemented from acsalarm::AlarmSource.
std::set<std::string> acsalarm::AlarmSourceImpl::m_activatedAlarms [private] |
The alarms that have been activated and not yet terminated.
This is used by the terminateAllAlarms()
AlarmsMap acsalarm::AlarmSourceImpl::m_alarms [private] |
The map to avoid repeating alarms if their states did not change.
The map requires to be updated from time to time (
auto_ptr<acsalarm::AlarmSystemInterface> acsalarm::AlarmSourceImpl::m_alarmSource_ap [private] |
The source to send alarms to the AS
bool acsalarm::AlarmSourceImpl::m_disabled [private] |
bool acsalarm::AlarmSourceImpl::m_locallyInstantiatedThread [private] |
true if the thread is instantiated locally (empty constructor) and false otherwise.
ACE_Recursive_Thread_Mutex acsalarm::AlarmSourceImpl::m_mutex [private] |
ACS::Time acsalarm::AlarmSourceImpl::m_nextFlushTime [private] |
The time when the alarms must be flushed.
ACS::Time acsalarm::AlarmSourceImpl::m_nextMapUpdateTime [private] |
The time when the map needs to be updated
std::map<std::string, AlarmToQueue*> acsalarm::AlarmSourceImpl::m_queue [private] |
The map of queued alarms
The key is the ID of the alarm
bool acsalarm::AlarmSourceImpl::m_queuing [private] |
const AlarmSourceThread* acsalarm::AlarmSourceImpl::m_updaterThread_p [private] |
The thread to update