02.04.2014 Views

Downloadable - Hewlett-Packard

Downloadable - Hewlett-Packard

Downloadable - Hewlett-Packard

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Callbacks are defined as follows:<br />

MCC_T_CVR proc ( FEvent& event, const MEntitySpec& filter )<br />

{<br />

// ….<br />

return MCC_S_NORMAL;<br />

}<br />

The event is passed as a non-constant (modifiable) variable for practical reasons (access to all<br />

methods of the class FEvent). It should however not be modified. Modification to the event<br />

will have no effects other than being passed on to the next callbacks (same object passed to all<br />

callbacks).<br />

Each customized user library defines (optionally) a public function called initialize().It<br />

is mandatory to define the initialize() function in order to use discarding features. The<br />

initialize() function is responsible for advertising any discarded event callback using<br />

the discarded_events_add_callback() function:<br />

void initialize()<br />

{<br />

discarded_events_add_callback(“mylib”,my_callback_1);<br />

discarded_events_add_callback(“mylib”,my_callback_2);<br />

…<br />

}<br />

The callbacks and the initialization function can be defined in the same library than the<br />

corrective filter action routines or in a different library.<br />

Example<br />

Below is an example of custom library with action routines and callbacks:<br />

#include <br />

extern "C"<br />

{<br />

/* action routine */<br />

MCC_T_CVR SetAdditionalText(<br />

FEvent& event,<br />

const MSetOf &values)<br />

{<br />

event.SetAdditionalText(values[1]);<br />

return MCC_S_NORMAL ;<br />

}<br />

/* callback */<br />

MCC_T_CVR log_event(FEvent &event,const MEntitySpec &filter)<br />

{<br />

MTraceStream trace(0x1);<br />

trace

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!