Athena Developer Guide
Athena Developer Guide
Athena Developer Guide
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
<strong>Athena</strong> Chapter 13 Framework services Version/Issue: 2.0.0<br />
13.9 The Incident Service<br />
The Incident service provides synchronization facilities to components in an <strong>Athena</strong> application.<br />
Incidents are named software events that are generated by software components and that are delivered<br />
to other components that have requested to be informed when that incident happens. The <strong>Athena</strong><br />
components that want to use this service need to implement the IIncidentListener interface,<br />
which has only one method: handle(Incident&), and they need to add themselves as Listeners<br />
to the IncidentSvc. The following code fragment works inside Algorithms.<br />
class MyAlgorithm : public Algorithm, virtual public IIncidentListener {<br />
...<br />
};<br />
MyAlgorithm::Initialize() {<br />
IIncidentSvc* incsvc;<br />
StatusCode sc = service("IncidentSvc", incsvc);<br />
int priority = 100;<br />
if( sc.isSuccess() ) {<br />
incsvc->addListener( this, "BeginEvent", priority);<br />
incsvc->addListener( this, "EndEvent");<br />
}<br />
}<br />
MyAlgorithm::handle(Incident& inc) {<br />
log