queue = q;
#endif
#ifdef EVENTQ_DEBUG
- whenScheduled = curTick;
+ whenScheduled = curTick();
#endif
}
queue = NULL;
#endif
#ifdef EVENTQ_DEBUG
- whenCreated = curTick;
+ whenCreated = curTick();
whenScheduled = 0;
#endif
}
void insert(Event *event);
void remove(Event *event);
+ EventQueue(const EventQueue &);
+ const EventQueue &operator=(const EventQueue &);
+
public:
- EventQueue(const std::string &n)
- : objName(n), head(NULL)
- {}
+ EventQueue(const std::string &n);
virtual const std::string name() const { return objName; }
}
}
- // default: process all events up to 'now' (curTick)
- void serviceEvents() { serviceEvents(curTick); }
+ // default: process all events up to 'now' (curTick())
+ void serviceEvents() { serviceEvents(curTick()); }
// return true if no events are queued
bool empty() const { return head == NULL; }
void dump() const;
- Tick nextEventTime() { return empty() ? curTick : head->when(); }
+ Tick nextEventTime() { return empty() ? curTick() : head->when(); }
bool debugVerify() const;
return eventq;
}
+ operator EventQueue *() const
+ {
+ return eventq;
+ }
+
void
schedule(Event &event, Tick when)
{
inline void
EventQueue::schedule(Event *event, Tick when)
{
- assert((UTick)when >= (UTick)curTick);
+ assert((UTick)when >= (UTick)curTick());
assert(!event->scheduled());
assert(event->initialized());
inline void
EventQueue::reschedule(Event *event, Tick when, bool always)
{
- assert(when >= curTick);
+ assert(when >= curTick());
assert(always || event->scheduled());
assert(event->initialized());
setFlags(AutoDelete);
}
+ EventWrapper(T &obj, bool del = false, Priority p = Default_Pri)
+ : Event(p), object(&obj)
+ {
+ if (del)
+ setFlags(AutoDelete);
+ }
+
void process() { (object->*F)(); }
const std::string