46 #include <boost/mpi/communicator.hpp>
47 #include <boost/shared_ptr.hpp>
48 #include <boost/noncopyable.hpp>
58 virtual void operator()() = 0;
75 fptr(_fptr), obj(_obj) {
93 boost::shared_ptr<Functor> func_ptr;
163 double tick1 = one->event->tick;
164 double tick2 = two->event->tick;
165 return tick1 > tick2 ? 1 : 0;
175 typedef std::priority_queue<ScheduledEvent *, std::vector<ScheduledEvent*>,
EventCompare> QueueType;
228 return queue.top()->get_event()->tick;
245 double globalNextTick, localNextTick;
247 boost::mpi::communicator* comm;
248 std::vector<boost::shared_ptr<Functor> > endEvents;
virtual bool reschedule(std::priority_queue< ScheduledEvent *, std::vector< ScheduledEvent * >, EventCompare > &)
Always returns false, as it does not reschedule itself.
Definition: Schedule.cpp:74
ScheduledEvent that executes repeatedly.
Definition: Schedule.h:146
ScheduledEvent that will only execute only once.
Definition: Schedule.h:131
Functor interface.
Definition: Schedule.h:55
virtual bool reschedule(std::priority_queue< ScheduledEvent *, std::vector< ScheduledEvent * >, EventCompare > &)=0
Returns true if this event is rescheduled on the specified queue, otherwise false.
The simulation schedule queue.
Definition: Schedule.h:173
General class linking a function pointer to a specific tick.
Definition: Schedule.h:89
const Schedule & schedule()
Gets the schedule executed by this simulation runner.
Definition: Schedule.h:314
ScheduledEvent * scheduleEvent(double at, Schedule::FunctorPtr func)
Schedules the Functor to execute at the specified tick.
Definition: Schedule.cpp:162
double currentTick()
Gets the current tick.
Definition: Schedule.h:300
void stop()
Stops the simulation.
Definition: Schedule.cpp:174
double getNextTick() const
Gets the next tick at which the next events will be executed.
Definition: Schedule.h:225
Compares ScheduledEvents based on their tick times.
Definition: Schedule.h:160
boost::shared_ptr< Functor > FunctorPtr
Typedef of for the functors that get scheduled.
Definition: Schedule.h:183
void run()
Starts and runs the simulation schedule.
Definition: Schedule.cpp:182
ScheduledEvent * schedule_event(double at, FunctorPtr functor)
Schedule the specified functor to execute once at the specified tick.
Definition: Schedule.cpp:105
The object that is placed (scheduled) in the priority queue for execution.
Definition: Schedule.h:104
RepastEvent * get_event()
Gets the RepastEvent that this ScheduleEvent wraps.
Definition: Schedule.h:122
Adapts a no-arg method call on an object instance to a Functor interface.
Definition: Schedule.h:69
double getCurrentTick() const
Gets the current simulation tick.
Definition: Schedule.h:215
void scheduleStop(double at)
Schedules the simulation to stop at the specified tick.
Definition: Schedule.cpp:156
Runs the Schedule by popping events off of the Schedule and executing them; also provides methods for...
Definition: Schedule.h:239
void scheduleEndEvent(Schedule::FunctorPtr func)
Schedules the specified functor to execute when the simulation ends.
Definition: Schedule.cpp:178
virtual bool reschedule(std::priority_queue< ScheduledEvent *, std::vector< ScheduledEvent * >, EventCompare > &)
Returns true if this event is rescheduled on the specified queue, otherwise false.
Definition: Schedule.cpp:85