| Previous | Menu | Next |
|
Sending events to an ECS Engine requires you to instantiate an ECS_Engine object for the appropriate instance of ECS Engine you want to send events to. The engine object acts as a handle by which you can manipulate the ECS Engine itself. You must also create an instance of the ECS_Event class and set its PDU to contain the event itself. To send the events you call the processEvent() method on the engine handle, passing it the ECS_Event object. These steps are normally enclosed in a loop and augmented with facilities for acquiring a series of events from the network. The following source code illustrates the basic process:
.
.
.
while (gets(pdu))
{
event.setPdu(pdu);
cout << "Sending event " << ++count;
cout << ".\t" << event.getPdu() << endl;
ECS_Engine engine(instance);
int32 status = engine.processEvent(event);
if (status == ECS_SUCCESS)
{
cout << "Event successfully sent to engine " << instance << endl;
}
else
{
cout << "Error (" << status << ") sending event to engine "
<< instance << endl;
}
}
return 0;
|