Kinetic::Simulator::Event

Definition

The concept Kinetic::Simulator::Event represents a single event. Models of Kinetic::Simulator::Event should be passed to the Kinetic::Simulator when scheduling events which will in turn pass them to the EventQueue.

Operations

void a.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.

std::ostream& std::ostream& << Event
Write a text description of the event to a standard stream.

Has Models

All over the place.

See Also

Kinetic::EventQueue

Example

All of the kinetic data structures provided have models of Kinetic::Simulator::Event. Here is the code implementing a swap event from the sorting kinetic data structure.

template <class Certificate, class Id, class Root_enumerator> 
class Swap_event {
public:
  Swap_event(Id o, typename Sort::Handle sorter, 
	     const Certificate &s): left_object_(o), 
                                    sorter_(sorter), 
                                    s_(s){}
  void process(){
    sorter_->swap(left_object_, s_);
  }
  Id left_object_; 
  typename Sort::Handle sorter_; 
  Certificate s_;
};