gem5  v19.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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  * Authors: Gabe Black
28  */
29 
30 #include <vector>
31 
32 #include "systemc/core/object.hh"
34 
35 namespace sc_core
36 {
37 
38 namespace
39 {
40 
41 std::vector<sc_object *> top_level_objects;
42 
43 } // anonymous namespace
44 
45 const char *
47 {
48  return _gem5_object->name();
49 }
50 
51 const char *
53 {
54  return _gem5_object->basename();
55 }
56 
57 void
58 sc_object::print(std::ostream &out) const
59 {
60  _gem5_object->print(out);
61 }
62 
63 void
64 sc_object::dump(std::ostream &out) const
65 {
66  _gem5_object->dump(out);
67 }
68 
71 {
73 }
74 
77 {
79 }
80 
81 sc_object *
83 {
85 }
86 
87 bool
89 {
90  return _gem5_object->add_attribute(attr);
91 }
92 
94 sc_object::get_attribute(const std::string &name)
95 {
96  return _gem5_object->get_attribute(name);
97 }
98 
101 {
102  return _gem5_object->remove_attribute(name);
103 }
104 
105 void
107 {
109 }
110 
111 int
113 {
114  return _gem5_object->num_attributes();
115 }
116 
117 sc_attr_cltn &
119 {
120  return _gem5_object->attr_cltn();
121 }
122 
123 const sc_attr_cltn &
125 {
126  return _gem5_object->attr_cltn();
127 }
128 
131 {
132  return _gem5_object->simcontext();
133 }
134 
136 {
137  _gem5_object = new sc_gem5::Object(this);
138 }
139 
141 {
142  _gem5_object = new sc_gem5::Object(this, name);
143 }
144 
146 {
147  _gem5_object = new sc_gem5::Object(this, *other._gem5_object);
148 }
149 
150 sc_object &
152 {
153  *_gem5_object = *other._gem5_object;
154  return *this;
155 }
156 
158 {
159  delete _gem5_object;
160 }
161 
164 {
166 }
167 
168 sc_object *
169 sc_find_object(const char *name)
170 {
171  return sc_gem5::findObject(name);
172 }
173 
174 } // namespace sc_core
sc_attr_base * get_attribute(const std::string &)
Definition: sc_object.cc:94
virtual const std::vector< sc_event * > & get_child_events() const
Definition: sc_object.cc:76
sc_core::sc_simcontext * simcontext() const
Definition: object.cc:244
const std::vector< sc_object * > & sc_get_top_level_objects()
Definition: sc_object.cc:163
sc_object * sc_find_object(const char *name)
Definition: sc_object.cc:169
int num_attributes() const
Definition: object.cc:226
sc_core::sc_object * get_parent_object() const
Definition: object.cc:196
void remove_all_attributes()
Definition: sc_object.cc:106
sc_core::sc_attr_cltn & attr_cltn()
Definition: object.cc:232
void print(std::ostream &=std::cout) const
Definition: object.cc:172
const std::vector< sc_core::sc_object * > & get_child_objects() const
Definition: object.cc:185
sc_core::sc_attr_base * get_attribute(const std::string &)
Definition: object.cc:208
sc_object & operator=(const sc_object &)
Definition: sc_object.cc:151
sc_core::sc_object * findObject(const char *name, const Objects &objects)
Definition: object.cc:298
const char * name() const
Definition: sc_object.cc:46
sc_core::sc_attr_base * remove_attribute(const std::string &)
Definition: object.cc:214
STL vector class.
Definition: stl.hh:40
sc_simcontext * simcontext() const
Definition: sc_object.cc:130
int num_attributes() const
Definition: sc_object.cc:112
virtual const std::vector< sc_object * > & get_child_objects() const
Definition: sc_object.cc:70
sc_gem5::Object * _gem5_object
Definition: sc_object.hh:87
sc_object * get_parent_object() const
Definition: sc_object.cc:82
virtual void dump(std::ostream &=std::cout) const
Definition: sc_object.cc:64
sc_attr_cltn & attr_cltn()
Definition: sc_object.cc:118
sc_attr_base * remove_attribute(const std::string &)
Definition: sc_object.cc:100
bool add_attribute(sc_attr_base &)
Definition: sc_object.cc:88
Objects topLevelObjects
Definition: object.cc:288
const char * basename() const
Definition: sc_object.cc:52
const std::vector< sc_core::sc_event * > & get_child_events() const
Definition: object.cc:191
const char * basename() const
Definition: object.cc:166
virtual ~sc_object()
Definition: sc_object.cc:157
void dump(std::ostream &=std::cout) const
Definition: object.cc:178
virtual void print(std::ostream &=std::cout) const
Definition: sc_object.cc:58
void remove_all_attributes()
Definition: object.cc:220
const char * name() const
Definition: object.cc:160
bool add_attribute(sc_core::sc_attr_base &)
Definition: object.cc:202

Generated on Fri Feb 28 2020 16:27:03 for gem5 by doxygen 1.8.13