The method getEvent defined in the TimeWarp class is what the application uses to get the next event that it needs to process. This function returns a pointer to a BasicEvent. Something that should be noted is that the data pointed to by the pointer returned from a call to this function will always have other pointers to it as well. This means that changes made to the data will also effect the other entities holding pointers to this data, including the simulation kernel. This will have undesirable effects such as crashing the simulation. Therefore, data pointed to by a pointer returned from getEvent must never be modified by a simulation object.
If the application defines one or more types of events, the pointer returned from getEvent will need to be casted to the appropriate type to be accessed. One way to easily distinguish between multiple event types is to derive an intermediate type from BasicEvent that has an enumerated messageType field in it. Each event type derived from this intermediate class automatically fills in the appropriate type upon construction. Upon receiving an event, first it is cast to the intermediate type, and then based on the messageType field, cast into the appropriate type.
The method sendEvent takes a pointer to a BasicEvent (or a type derived from BasicEvent) as an argument and delivers it to the object specified by BasicEvent::dest. If dest holds an invalid object id, the result is undefined. The other fields that must be filled out before sending the event are size and recvTime. size refers to the size of the event in bytes, in its ``most derived'' form. (The kernel handles user messages internally as BasicEvents with extra data stuck on the end, so it needs to know to total size of the event.) recvTime is the time at which object with id == dest should receive this event.
Examples of both getEvent and sendEvent can be found in the code fragment for executeProcess.