CGAL 4.10.2 - Kinetic Framework
|
The concept Event
represents a single event. Models of Event
should be passed to the Kinetic::Simulator
when scheduling events which will in turn pass them to the EventQueue
.
All over the place.
Kinetic::Event_base
Kinetic::EventQueue
Example
All of the kinetic data structures provided have models of Event
. Here is the code implementing a swap event from the sorting kinetic data structure. Events occuring at equal times are perturbed so that the one that occurs first in the list is processed first (just to illustrate the idea).
Operations | |
void | process () |
This method is called when the event occurs. More... | |
void * | kds () |
Return a void * which represents the KDS which this event belongs to. More... | |
CGAL::Comparison_result | compare_concurrent (Key a, Key b) const |
The two events a and b occur at the same time (this has key a ). More... | |
bool | merge_concurrent (Key a, Key b) |
The two events a and b occur at the same time (this has key a ) and cannot be perturbed to be unequal. More... | |
void | audit (Key this_key) |
Audit that this is a valid event. More... | |
std::ostream & | write (std::ostream &) const |
Write the event to a stream. | |
void Kinetic::Simulator::Event::audit | ( | Key | this_key) |
Audit that this is a valid event.
To use this, kinetic data structure can check that this event is indeed pointed to by the correct part of the combinatorial structure.
CGAL::Comparison_result Kinetic::Simulator::Event::compare_concurrent | ( | Key | a, |
Key | b | ||
) | const |
The two events a
and b
occur at the same time (this
has key a
).
This method returns a CGAL::Comparison_result
which is used to order the two equal events. If CGAL::EQUAL
is returned then merge
will be called.
void* Kinetic::Simulator::Event::kds | ( | ) |
Return a void *
which represents the KDS which this event belongs to.
The pointer is used solely to tell if two events come from the same KDS for the purposes of handling degeneracy.
The two events a
and b
occur at the same time (this
has key a
) and cannot be perturbed to be unequal.
This event allows the KDS to merge event b
with a
. If it returns true
then b
is dropped from the event queue.
void Kinetic::Simulator::Event::process | ( | ) |
This method is called when the event occurs.
This method will only be called once per time this event is scheduled and the event will be removed from the queue immediately afterwards.