IMS2
Pre-Alpha
An Orbiter add-on to allow on-runtime construction of spacecraft from predefined modules
|
EventGenerators take on events, equip them with additional information about the sender, and process them according to their urgency. More...
Private Member Functions | |
EventGenerator (EventHandler *_host, EVENTPIPE _pipe) | |
void | GenerateEvent (Event_Base *_event) |
Pass an event to this function to send it down the eventpipe. More... | |
bool | RelayEvent (Event_Base *_event) |
Relays an event to this event pipe. More... | |
void | ProcessEvents () |
Goes through the event queue and sends out the events that are due. More... | |
bool | processEvent (Event_Base *e) |
sends an event down the pipe of this generator. More... | |
Private Attributes | |
deque< Event_Base * > | eventqueue |
The eventqueue, containing all events that are waiting to be sent out. | |
EVENTPIPE | pipe |
Identifier of the event pipe this generator is part of. | |
bool | ignoredelay = false |
Friends | |
class | EventHandler |
Additional Inherited Members | |
Protected Member Functions inherited from EventNode | |
void | RegisterEventSink (EventSink *sink) |
registers an event sink as a child of this node More... | |
bool | UnregisterEventSink (EventSink *sink) |
unregisters an event sink. More... | |
Protected Attributes inherited from EventNode | |
EventHandler * | host |
The EventHandler hosting this EventNode. | |
vector< EventSink * > | children |
The event nodes connecting directly to this EventNode. | |
EventGenerators take on events, equip them with additional information about the sender, and process them according to their urgency.
Events that have no delay will be fed into the eventpipe immediately at the moment of their creation. Otherwise an event will be added to the generators event queue, which is advanced every time the ProcessEvents() method on the generator is called, which is called from EventHandler::sendEvents()).
This class is pure private. It cannot be instantiated or used directly. Instead, use the interface provided by EventHandler.
|
private |
_host | The EventHandler instance that is hosting this EventGenerator |
_pipe | The event pipe this generator should generate events for |
ignoredelay | A generator with this set to true will completely ignore event delays, always processing the whole queue at the next call to ProcessEvents(). |
|
private |
Pass an event to this function to send it down the eventpipe.
Depending whether the event is instantaneous or delayed, it gets processed immediately or added to the event queue, which will be emptied the next time ProcessEvents is called on this EventGenerator
_event | The event to be sent through the pipe |
ignoredelay | If true, an event with delay 0 is not generated immediately and instead added to the event queue |
|
privatevirtual |
sends an event down the pipe of this generator.
Also receives the response when propagation has finished and deallocates the event..
e | The event to be processed. |
Reimplemented from EventNode.
|
private |
Goes through the event queue and sends out the events that are due.
if an event is not due, it will stay in the queue until it is.
|
private |
Relays an event to this event pipe.
The event pipes are the usual lines of communication. However, every now and then it may be necessary for an event to jump pipes. The necessity for this has to be determined by the ProcessEvent implementation of the respective EventHandler. Then the event can be relayed to another eventgenerator using this method, which will propagate the event instantly through its pipe. This means that the event will propagate through this entire pipe first, before propagation through the original pipe is resumed. RelayEvent will NOT delete the event even if it was consumed, but it will return whether the event was consumed. If it was, the relaying ProcessEvent implementation has to decide whether to consume the event itself or continue propagation through its own pipe.
_event | The event to be relayed. |