#include "systemc/core/event.hh"
+#include <algorithm>
#include <cstring>
#include <utility>
parent = p->obj()->sc_obj();
else if (scheduler.current())
parent = scheduler.current();
+ else
+ parent = nullptr;
if (parent) {
Object *obj = Object::getFromScObject(parent);
- parentIt = obj->addChildEvent(_sc_event);
+ obj->addChildEvent(_sc_event);
} else {
- parentIt = topLevelEvents.emplace(topLevelEvents.end(), _sc_event);
+ topLevelEvents.emplace(topLevelEvents.end(), _sc_event);
}
if (parent)
{
if (parent) {
Object *obj = Object::getFromScObject(parent);
- obj->delChildEvent(parentIt);
+ obj->delChildEvent(_sc_event);
} else {
- std::swap(*parentIt, topLevelEvents.back());
+ EventsIt it = find(topLevelEvents.begin(), topLevelEvents.end(),
+ _sc_event);
+ assert(it != topLevelEvents.end());
+ std::swap(*it, topLevelEvents.back());
topLevelEvents.pop_back();
}
#include "systemc/core/object.hh"
+#include <algorithm>
+
#include "base/logging.hh"
#include "systemc/core/module.hh"
#include "systemc/core/scheduler.hh"
}
void
-Object::delChildEvent(EventsIt it)
+Object::delChildEvent(sc_core::sc_event *e)
{
+ EventsIt it = std::find(events.begin(), events.end(), e);
+ assert(it != events.end());
std::swap(*it, events.back());
events.pop_back();
}
sc_core::sc_object *sc_obj() { return _sc_obj; }
EventsIt addChildEvent(sc_core::sc_event *e);
- void delChildEvent(EventsIt it);
+ void delChildEvent(sc_core::sc_event *e);
private:
sc_core::sc_object *_sc_obj;