gem5  v20.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 &
122 sc_object::attr_cltn() const
123 {
124  return _gem5_object->attr_cltn();
125 }
126 
127 sc_simcontext *
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_core::sc_object::simcontext
sc_simcontext * simcontext() const
Definition: sc_object.cc:128
sc_core::sc_object::num_attributes
int num_attributes() const
Definition: sc_object.cc:110
sc_gem5::Object::print
void print(std::ostream &=std::cout) const
Definition: object.cc:170
sc_gem5::Object::get_attribute
sc_core::sc_attr_base * get_attribute(const std::string &)
Definition: object.cc:206
sc_core::sc_object::dump
virtual void dump(std::ostream &=std::cout) const
Definition: sc_object.cc:62
sc_core::sc_object::print
virtual void print(std::ostream &=std::cout) const
Definition: sc_object.cc:56
sc_core::sc_object::get_child_objects
virtual const std::vector< sc_object * > & get_child_objects() const
Definition: sc_object.cc:68
sc_gem5::topLevelObjects
Objects topLevelObjects
Definition: object.cc:286
sc_core::sc_attr_cltn
Definition: sc_attr.hh:74
sc_core::sc_object::_gem5_object
sc_gem5::Object * _gem5_object
Definition: sc_object.hh:85
sc_core
Definition: messages.cc:31
sc_core::sc_object::remove_attribute
sc_attr_base * remove_attribute(const std::string &)
Definition: sc_object.cc:98
sc_core::sc_get_top_level_objects
const std::vector< sc_object * > & sc_get_top_level_objects()
Definition: sc_object.cc:161
sc_gem5::Object::basename
const char * basename() const
Definition: object.cc:164
sc_core::sc_object::~sc_object
virtual ~sc_object()
Definition: sc_object.cc:155
std::vector
STL vector class.
Definition: stl.hh:37
sc_core::sc_object::add_attribute
bool add_attribute(sc_attr_base &)
Definition: sc_object.cc:86
sc_gem5::Object::get_child_objects
const std::vector< sc_core::sc_object * > & get_child_objects() const
Definition: object.cc:183
sc_gem5::Object::attr_cltn
sc_core::sc_attr_cltn & attr_cltn()
Definition: object.cc:230
sc_core::sc_attr_base
Definition: sc_attr.hh:37
sc_gem5::Object::remove_attribute
sc_core::sc_attr_base * remove_attribute(const std::string &)
Definition: object.cc:212
sc_gem5::Object::name
const char * name() const
Definition: object.cc:158
sc_gem5::Object
Definition: object.hh:47
ArmISA::attr
attr
Definition: miscregs_types.hh:649
sc_core::sc_object::get_child_events
virtual const std::vector< sc_event * > & get_child_events() const
Definition: sc_object.cc:74
sc_core::sc_object::attr_cltn
sc_attr_cltn & attr_cltn()
Definition: sc_object.cc:116
sc_core::sc_find_object
sc_object * sc_find_object(const char *name)
Definition: sc_object.cc:167
sc_gem5::Object::simcontext
sc_core::sc_simcontext * simcontext() const
Definition: object.cc:242
sc_core::sc_object
Definition: sc_object.hh:50
name
const std::string & name()
Definition: trace.cc:50
sc_gem5::Object::num_attributes
int num_attributes() const
Definition: object.cc:224
sc_gem5::Object::dump
void dump(std::ostream &=std::cout) const
Definition: object.cc:176
sc_core::sc_object::get_attribute
sc_attr_base * get_attribute(const std::string &)
Definition: sc_object.cc:92
sc_core::sc_object::remove_all_attributes
void remove_all_attributes()
Definition: sc_object.cc:104
sc_gem5::findObject
sc_core::sc_object * findObject(const char *name, const Objects &objects)
Definition: object.cc:296
sc_core::sc_object::operator=
sc_object & operator=(const sc_object &)
Definition: sc_object.cc:149
sc_gem5::Object::get_child_events
const std::vector< sc_core::sc_event * > & get_child_events() const
Definition: object.cc:189
sc_core::sc_object::name
const char * name() const
Definition: sc_object.cc:44
object.hh
sc_core::sc_object::sc_object
sc_object()
Definition: sc_object.cc:133
sc_object.hh
sc_gem5::Object::remove_all_attributes
void remove_all_attributes()
Definition: object.cc:218
sc_gem5::Object::add_attribute
bool add_attribute(sc_core::sc_attr_base &)
Definition: object.cc:200
sc_gem5::Object::get_parent_object
sc_core::sc_object * get_parent_object() const
Definition: object.cc:194
sc_core::sc_object::get_parent_object
sc_object * get_parent_object() const
Definition: sc_object.cc:80
sc_core::sc_object::basename
const char * basename() const
Definition: sc_object.cc:50

Generated on Wed Sep 30 2020 14:02:14 for gem5 by doxygen 1.8.17