gem5 [DEVELOP-FOR-25.1]
Loading...
Searching...
No Matches
object.hh
Go to the documentation of this file.
1/*
2 * Copyright 2018 Google, Inc.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are
6 * met: redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer;
8 * redistributions in binary form must reproduce the above copyright
9 * notice, this list of conditions and the following disclaimer in the
10 * documentation and/or other materials provided with the distribution;
11 * neither the name of the copyright holders nor the names of its
12 * contributors may be used to endorse or promote products derived from
13 * this software without specific prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef __SYSTEMC_CORE_OBJECT_HH__
29#define __SYSTEMC_CORE_OBJECT_HH__
30
31#include <shared_mutex>
32#include <string>
33#include <vector>
34
37
38namespace sc_gem5
39{
40
41class Object;
42
45typedef Objects::iterator ObjectsIt;
46typedef Events::iterator EventsIt;
47
48class Object
49{
50 public:
52 Object(sc_core::sc_object *_sc_obj, const char *);
54 Object &operator = (const Object &);
55
56 virtual ~Object();
57
58 /*
59 * sc_object methods.
60 */
61 const char *name() const;
62 const char *basename() const;
63
64 void print(std::ostream & =std::cout) const;
65 void dump(std::ostream & =std::cout) const;
66
70
72 sc_core::sc_attr_base *get_attribute(const std::string &);
73 sc_core::sc_attr_base *remove_attribute(const std::string &);
75 int num_attributes() const;
77 const sc_core::sc_attr_cltn &attr_cltn() const;
78
80
81 static Object *
83 {
84 return sc_obj->_gem5_object;
85 }
86
88
91
92 std::string pickUniqueName(std::string name);
93
94 private:
96
97 std::string _basename;
98 std::string _name;
99
102 std::shared_mutex _lock;
104
106};
107
108std::string pickUniqueName(::sc_core::sc_object *parent, std::string name);
109
111extern Objects allObjects;
112
114
117void popParentObj();
118
119} // namespace sc_gem5
120
121#endif //__SYSTEMC_CORE_OBJECT_HH__
sc_core::sc_attr_base * remove_attribute(const std::string &)
Definition object.cc:224
const char * name() const
Definition object.cc:170
EventsIt addChildEvent(sc_core::sc_event *e)
Definition object.cc:260
const std::vector< sc_core::sc_event * > & get_child_events() const
Definition object.cc:201
sc_core::sc_simcontext * simcontext() const
Definition object.cc:254
std::shared_mutex _lock
Definition object.hh:102
int num_attributes() const
Definition object.cc:236
Object & operator=(const Object &)
Definition object.cc:143
Objects children
Definition object.hh:100
std::string _name
Definition object.hh:98
void delChildEvent(sc_core::sc_event *e)
Definition object.cc:268
const char * basename() const
Definition object.cc:176
sc_core::sc_object * get_parent_object() const
Definition object.cc:206
sc_core::sc_attr_cltn cltn
Definition object.hh:105
sc_core::sc_object * sc_obj()
Definition object.hh:87
bool add_attribute(sc_core::sc_attr_base &)
Definition object.cc:212
sc_core::sc_object * _sc_obj
Definition object.hh:95
Events events
Definition object.hh:101
std::string pickUniqueName(std::string name)
Definition object.cc:279
void remove_all_attributes()
Definition object.cc:230
void dump(std::ostream &=std::cout) const
Definition object.cc:188
virtual ~Object()
Definition object.cc:148
void print(std::ostream &=std::cout) const
Definition object.cc:182
sc_core::sc_object * parent
Definition object.hh:103
Object(sc_core::sc_object *_sc_obj)
Definition object.cc:94
std::string _basename
Definition object.hh:97
const std::vector< sc_core::sc_object * > & get_child_objects() const
Definition object.cc:195
sc_core::sc_attr_cltn & attr_cltn()
Definition object.cc:242
static Object * getFromScObject(sc_core::sc_object *sc_obj)
Definition object.hh:82
sc_core::sc_attr_base * get_attribute(const std::string &)
Definition object.cc:218
STL vector class.
Definition stl.hh:37
void popParentObj()
Definition object.cc:331
std::vector< sc_core::sc_event * > Events
Definition event.hh:54
Objects allObjects
Definition object.cc:92
std::string pickUniqueName(::sc_core::sc_object *parent, std::string base)
Definition object.cc:290
Events::iterator EventsIt
Definition object.hh:46
sc_core::sc_object * pickParentObj()
Definition object.cc:318
sc_core::sc_object * findObject(const char *name)
Definition object.cc:309
std::vector< sc_core::sc_object * > Objects
Definition object.hh:43
Objects::iterator ObjectsIt
Definition object.hh:45
void pushParentObj(sc_core::sc_object *obj)
Definition object.cc:330
Objects topLevelObjects
Definition object.cc:91
const std::string & name()
Definition trace.cc:48

Generated on Mon Oct 27 2025 04:13:04 for gem5 by doxygen 1.14.0