gem5  v22.1.0.0
sc_object.cc
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 #include <vector>
29 
30 #include "systemc/core/object.hh"
32 
33 namespace sc_core
34 {
35 
36 namespace
37 {
38 
39 std::vector<sc_object *> top_level_objects;
40 
41 } // anonymous namespace
42 
43 const char *
45 {
46  return _gem5_object->name();
47 }
48 
49 const char *
51 {
52  return _gem5_object->basename();
53 }
54 
55 void
56 sc_object::print(std::ostream &out) const
57 {
58  _gem5_object->print(out);
59 }
60 
61 void
62 sc_object::dump(std::ostream &out) const
63 {
64  _gem5_object->dump(out);
65 }
66 
69 {
71 }
72 
75 {
77 }
78 
79 sc_object *
81 {
83 }
84 
85 bool
87 {
89 }
90 
92 sc_object::get_attribute(const std::string &name)
93 {
95 }
96 
98 sc_object::remove_attribute(const std::string &name)
99 {
101 }
102 
103 void
105 {
107 }
108 
109 int
111 {
112  return _gem5_object->num_attributes();
113 }
114 
115 sc_attr_cltn &
117 {
118  return _gem5_object->attr_cltn();
119 }
120 
121 const sc_attr_cltn &
123 {
124  return _gem5_object->attr_cltn();
125 }
126 
129 {
130  return _gem5_object->simcontext();
131 }
132 
134 {
135  _gem5_object = new sc_gem5::Object(this);
136 }
137 
139 {
140  _gem5_object = new sc_gem5::Object(this, name);
141 }
142 
144 {
145  _gem5_object = new sc_gem5::Object(this, *other._gem5_object);
146 }
147 
148 sc_object &
150 {
151  *_gem5_object = *other._gem5_object;
152  return *this;
153 }
154 
156 {
157  delete _gem5_object;
158 }
159 
162 {
164 }
165 
166 sc_object *
167 sc_find_object(const char *name)
168 {
169  return sc_gem5::findObject(name);
170 }
171 
172 } // namespace sc_core
sc_attr_base * get_attribute(const std::string &)
Definition: sc_object.cc:92
sc_object * get_parent_object() const
Definition: sc_object.cc:80
sc_object & operator=(const sc_object &)
Definition: sc_object.cc:149
virtual ~sc_object()
Definition: sc_object.cc:155
virtual const std::vector< sc_event * > & get_child_events() const
Definition: sc_object.cc:74
const char * name() const
Definition: sc_object.cc:44
const char * basename() const
Definition: sc_object.cc:50
int num_attributes() const
Definition: sc_object.cc:110
sc_gem5::Object * _gem5_object
Definition: sc_object.hh:85
bool add_attribute(sc_attr_base &)
Definition: sc_object.cc:86
sc_simcontext * simcontext() const
Definition: sc_object.cc:128
virtual const std::vector< sc_object * > & get_child_objects() const
Definition: sc_object.cc:68
void remove_all_attributes()
Definition: sc_object.cc:104
virtual void print(std::ostream &=std::cout) const
Definition: sc_object.cc:56
sc_attr_cltn & attr_cltn()
Definition: sc_object.cc:116
sc_attr_base * remove_attribute(const std::string &)
Definition: sc_object.cc:98
virtual void dump(std::ostream &=std::cout) const
Definition: sc_object.cc:62
sc_core::sc_attr_base * remove_attribute(const std::string &)
Definition: object.cc:212
const char * name() const
Definition: object.cc:158
const std::vector< sc_core::sc_event * > & get_child_events() const
Definition: object.cc:189
sc_core::sc_simcontext * simcontext() const
Definition: object.cc:242
int num_attributes() const
Definition: object.cc:224
const char * basename() const
Definition: object.cc:164
sc_core::sc_object * get_parent_object() const
Definition: object.cc:194
bool add_attribute(sc_core::sc_attr_base &)
Definition: object.cc:200
void remove_all_attributes()
Definition: object.cc:218
void dump(std::ostream &=std::cout) const
Definition: object.cc:176
void print(std::ostream &=std::cout) const
Definition: object.cc:170
const std::vector< sc_core::sc_object * > & get_child_objects() const
Definition: object.cc:183
sc_core::sc_attr_cltn & attr_cltn()
Definition: object.cc:230
sc_core::sc_attr_base * get_attribute(const std::string &)
Definition: object.cc:206
STL vector class.
Definition: stl.hh:37
sc_object * sc_find_object(const char *name)
Definition: sc_object.cc:167
const std::vector< sc_object * > & sc_get_top_level_objects()
Definition: sc_object.cc:161
sc_core::sc_object * findObject(const char *name, const Objects &objects)
Definition: object.cc:296
Objects topLevelObjects
Definition: object.cc:286
const std::string & name()
Definition: trace.cc:49

Generated on Wed Dec 21 2022 10:22:40 for gem5 by doxygen 1.9.1