#endif
};
+#ifndef SWIG
+inline bool
+operator<(const Event &l, const Event &r)
+{
+ return l.when() < r.when() ||
+ (l.when() == r.when() && l.priority() < r.priority());
+}
+
+inline bool
+operator>(const Event &l, const Event &r)
+{
+ return l.when() > r.when() ||
+ (l.when() == r.when() && l.priority() > r.priority());
+}
+
+inline bool
+operator<=(const Event &l, const Event &r)
+{
+ return l.when() < r.when() ||
+ (l.when() == r.when() && l.priority() <= r.priority());
+}
+inline bool
+operator>=(const Event &l, const Event &r)
+{
+ return l.when() > r.when() ||
+ (l.when() == r.when() && l.priority() >= r.priority());
+}
+
+inline bool
+operator==(const Event &l, const Event &r)
+{
+ return l.when() == r.when() && l.priority() == r.priority();
+}
+
+inline bool
+operator!=(const Event &l, const Event &r)
+{
+ return l.when() != r.when() || l.priority() != r.priority();
+}
+#endif
+
/*
* Queue of events sorted in time order
*/
}
};
-template <class T, void (T::* F)()>
-void
-DelayFunction(EventQueue *eventq, Tick when, T *object)
-{
- class DelayEvent : public Event
- {
- private:
- T *object;
-
- public:
- DelayEvent(T *o)
- : object(o)
- { this->setFlags(AutoDelete); }
- void process() { (object->*F)(); }
- const char *description() const { return "delay"; }
- };
-
- eventq->schedule(new DelayEvent(object), when);
-}
-
-template <class T, void (T::* F)()>
-class EventWrapper : public Event
-{
- private:
- T *object;
-
- public:
- 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
- name() const
- {
- return object->name() + ".wrapped_event";
- }
-
- const char *description() const { return "EventWrapped"; }
-};
-
inline void
EventQueue::schedule(Event *event, Tick when)
{
event->trace("rescheduled");
}
-inline bool
-operator<(const Event &l, const Event &r)
+template <class T, void (T::* F)()>
+void
+DelayFunction(EventQueue *eventq, Tick when, T *object)
{
- return l.when() < r.when() ||
- (l.when() == r.when() && l.priority() < r.priority());
-}
+ class DelayEvent : public Event
+ {
+ private:
+ T *object;
-inline bool
-operator>(const Event &l, const Event &r)
-{
- return l.when() > r.when() ||
- (l.when() == r.when() && l.priority() > r.priority());
-}
+ public:
+ DelayEvent(T *o)
+ : object(o)
+ { this->setFlags(AutoDelete); }
+ void process() { (object->*F)(); }
+ const char *description() const { return "delay"; }
+ };
-inline bool
-operator<=(const Event &l, const Event &r)
-{
- return l.when() < r.when() ||
- (l.when() == r.when() && l.priority() <= r.priority());
-}
-inline bool
-operator>=(const Event &l, const Event &r)
-{
- return l.when() > r.when() ||
- (l.when() == r.when() && l.priority() >= r.priority());
+ eventq->schedule(new DelayEvent(object), when);
}
-inline bool
-operator==(const Event &l, const Event &r)
+template <class T, void (T::* F)()>
+class EventWrapper : public Event
{
- return l.when() == r.when() && l.priority() == r.priority();
-}
+ private:
+ T *object;
-inline bool
-operator!=(const Event &l, const Event &r)
-{
- return l.when() != r.when() || l.priority() != r.priority();
-}
+ public:
+ 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
+ name() const
+ {
+ return object->name() + ".wrapped_event";
+ }
+
+ const char *description() const { return "EventWrapped"; }
+};
#endif
#endif // __SIM_EVENTQ_HH__