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 --- 13 unchanged lines hidden (view full) --- 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 "base/logging.hh" |
33#include "systemc/core/object.hh" |
34#include "systemc/ext/core/sc_object.hh" 35 36namespace sc_core 37{ 38 |
39namespace 40{ 41 42std::vector<sc_object *> top_level_objects; 43 44} // anonymous namespace 45 |
46const char * 47sc_object::name() const 48{ |
49 return _gem5_object->name(); |
50} 51 52const char * 53sc_object::basename() const 54{ |
55 return _gem5_object->basename(); |
56} 57 |
58void 59sc_object::print(std::ostream &out) const 60{ |
61 _gem5_object->print(out); |
62} 63 64void 65sc_object::dump(std::ostream &out) const 66{ |
67 _gem5_object->dump(out); |
68} 69 70const std::vector<sc_object *> & 71sc_object::get_child_objects() const 72{ |
73 return _gem5_object->get_child_objects(); |
74} 75 76const std::vector<sc_event *> & 77sc_object::get_child_events() const 78{ |
79 return _gem5_object->get_child_events(); |
80} 81 82sc_object * 83sc_object::get_parent_object() const 84{ |
85 return _gem5_object->get_parent_object(); |
86} 87 88bool |
89sc_object::add_attribute(sc_attr_base &attr) |
90{ |
91 return _gem5_object->add_attribute(attr); |
92} 93 94sc_attr_base * |
95sc_object::get_attribute(const std::string &name) |
96{ |
97 return _gem5_object->get_attribute(name); |
98} 99 100sc_attr_base * |
101sc_object::remove_attribute(const std::string &name) |
102{ |
103 return _gem5_object->remove_attribute(name); |
104} 105 106void 107sc_object::remove_all_attributes() 108{ |
109 return _gem5_object->remove_all_attributes(); |
110} 111 112int 113sc_object::num_attributes() const 114{ |
115 return _gem5_object->num_attributes(); |
116} 117 118sc_attr_cltn & 119sc_object::attr_cltn() 120{ |
121 return _gem5_object->attr_cltn(); |
122} 123 124const sc_attr_cltn & 125sc_object::attr_cltn() const 126{ |
127 return _gem5_object->attr_cltn(); |
128} 129 130sc_simcontext * 131sc_object::simcontext() const 132{ |
133 return _gem5_object->simcontext(); |
134} 135 136sc_object::sc_object() 137{ |
138 _gem5_object = new sc_gem5::Object(this); |
139} 140 141sc_object::sc_object(const char *name) 142{ |
143 _gem5_object = new sc_gem5::Object(this, name); |
144} 145 |
146sc_object::sc_object(const sc_object &other) |
147{ |
148 _gem5_object = new sc_gem5::Object(this, *other._gem5_object); |
149} 150 151sc_object & |
152sc_object::operator = (const sc_object &other) |
153{ |
154 *_gem5_object = *other._gem5_object; |
155 return *this; 156} 157 158sc_object::~sc_object() 159{ |
160 delete _gem5_object; |
161} 162 163const std::vector<sc_object *> & 164sc_get_top_level_objects() 165{ |
166 return sc_gem5::topLevelObjects; |
167} 168 169sc_object * |
170sc_find_object(const char *name) |
171{ |
172 return sc_gem5::findObject(name); |
173} 174 175} // namespace sc_core |