32#include <shared_mutex>
49findObjectIn(
Objects &objects,
const std::string &
name)
52 for (it = objects.begin(); it != objects.end(); it++)
53 if (!strcmp((*it)->name(),
name.c_str()))
60addObject(
Objects *objects, sc_core::sc_object *
object)
62 objects->emplace(objects->end(),
object);
69 assert(it != objects->end());
70 std::swap(objects->back(), *it);
77 for (
auto obj: *objects)
78 if (!strcmp(obj->basename(),
name.c_str()))
80 for (
auto event: *events)
81 if (!strcmp(
event->basename(),
name.c_str()))
86std::shared_mutex globalObjectLock;
87std::stack<sc_core::sc_object *> objParentStack;
99 [[maybe_unused]] std::unique_lock lock(globalObjectLock);
123 std::string path =
"";
125 path = std::string(sc_p->
basename()) + std::string(
".") + path;
130 std::string message = path + original_name +
131 ". Latter declaration will be renamed to " +
150 [[maybe_unused]] std::unique_lock lock(globalObjectLock);
155 child->_gem5_object->parent =
nullptr;
172 return _name.c_str();
190 out <<
"name = " <<
name() <<
"\n";
191 out <<
"kind = " <<
_sc_obj->kind() <<
"\n";
214 return cltn.push_back(&attr);
226 return cltn.remove(attr);
262 [[maybe_unused]] std::unique_lock lock(
_lock);
270 [[maybe_unused]] std::unique_lock lock(
_lock);
273 assert(it !=
events.end());
274 std::swap(*it,
events.back());
281 [[maybe_unused]] std::shared_lock lock(
_lock);
282 std::string seed = base;
295 std::string seed = base;
311 [[maybe_unused]] std::shared_lock lock(globalObjectLock);
314 return it ==
allObjects.end() ? nullptr : *it;
320 if (!objParentStack.empty())
321 return objParentStack.top();
sc_object * get_parent_object() const
const char * basename() const
static Event * getFromScEvent(sc_core::sc_event *e)
sc_core::sc_attr_base * remove_attribute(const std::string &)
const char * name() const
EventsIt addChildEvent(sc_core::sc_event *e)
const std::vector< sc_core::sc_event * > & get_child_events() const
sc_core::sc_simcontext * simcontext() const
int num_attributes() const
Object & operator=(const Object &)
void delChildEvent(sc_core::sc_event *e)
const char * basename() const
sc_core::sc_object * get_parent_object() const
sc_core::sc_attr_cltn cltn
bool add_attribute(sc_core::sc_attr_base &)
sc_core::sc_object * _sc_obj
std::string pickUniqueName(std::string name)
void remove_all_attributes()
void dump(std::ostream &=std::cout) const
void print(std::ostream &=std::cout) const
sc_core::sc_object * parent
Object(sc_core::sc_object *_sc_obj)
const std::vector< sc_core::sc_object * > & get_child_objects() const
sc_core::sc_attr_cltn & attr_cltn()
static Object * getFromScObject(sc_core::sc_object *sc_obj)
sc_core::sc_attr_base * get_attribute(const std::string &)
const char SC_ID_INSTANCE_EXISTS_[]
sc_simcontext * sc_get_curr_simcontext()
const char * sc_gen_unique_name(const char *seed)
const std::vector< sc_core::sc_object * > & getTopLevelScObjects()
std::vector< sc_core::sc_event * > Events
std::string pickUniqueName(::sc_core::sc_object *parent, std::string base)
Events::iterator EventsIt
sc_core::sc_object * pickParentObj()
sc_core::sc_object * findObject(const char *name)
std::vector< sc_core::sc_object * > Objects
Objects::iterator ObjectsIt
void pushParentObj(sc_core::sc_object *obj)
#define SC_REPORT_WARNING(msg_type, msg)
const std::string & name()