gem5  v20.1.0.0
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 <string>
32 #include <vector>
33 
36 
37 namespace sc_gem5
38 {
39 
40 class Object;
41 
44 typedef Objects::iterator ObjectsIt;
45 typedef Events::iterator EventsIt;
46 
47 class Object
48 {
49  public:
51  Object(sc_core::sc_object *_sc_obj, const char *);
53  Object &operator = (const Object &);
54 
55  virtual ~Object();
56 
57  /*
58  * sc_object methods.
59  */
60  const char *name() const;
61  const char *basename() const;
62 
63  void print(std::ostream & =std::cout) const;
64  void dump(std::ostream & =std::cout) const;
65 
69 
71  sc_core::sc_attr_base *get_attribute(const std::string &);
72  sc_core::sc_attr_base *remove_attribute(const std::string &);
73  void remove_all_attributes();
74  int num_attributes() const;
76  const sc_core::sc_attr_cltn &attr_cltn() const;
77 
79 
80  static Object *
82  {
83  return sc_obj->_gem5_object;
84  }
85 
87 
90 
91  std::string pickUniqueName(std::string name);
92 
93  private:
95 
96  std::string _basename;
97  std::string _name;
98 
102 
104 };
105 
106 std::string pickUniqueName(::sc_core::sc_object *parent, std::string name);
107 
108 extern Objects topLevelObjects;
109 extern Objects allObjects;
110 
112  const char *name, const Objects &objects=topLevelObjects);
113 
116 void popParentObj();
117 
118 } // namespace sc_gem5
119 
120 #endif //__SYSTEMC_CORE_OBJECT_HH__
sc_gem5::pickParentObj
sc_core::sc_object * pickParentObj()
Definition: object.cc:310
sc_gem5::Object::getFromScObject
static Object * getFromScObject(sc_core::sc_object *sc_obj)
Definition: object.hh:81
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_gem5::Object::Object
Object(sc_core::sc_object *_sc_obj)
Definition: object.cc:86
sc_gem5::Object::sc_obj
sc_core::sc_object * sc_obj()
Definition: object.hh:86
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_gem5::EventsIt
Events::iterator EventsIt
Definition: object.hh:45
sc_gem5::popParentObj
void popParentObj()
Definition: object.cc:323
sc_gem5::Object::basename
const char * basename() const
Definition: object.cc:164
std::vector< sc_core::sc_object * >
sc_gem5::pickUniqueName
std::string pickUniqueName(::sc_core::sc_object *parent, std::string base)
Definition: object.cc:273
sc_gem5::Object::_name
std::string _name
Definition: object.hh:97
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_gem5::Object::addChildEvent
EventsIt addChildEvent(sc_core::sc_event *e)
Definition: object.cc:248
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::_sc_obj
sc_core::sc_object * _sc_obj
Definition: object.hh:94
sc_gem5::Object::~Object
virtual ~Object()
Definition: object.cc:138
sc_core::sc_event
Definition: sc_event.hh:169
sc_gem5::Object::cltn
sc_core::sc_attr_cltn cltn
Definition: object.hh:103
sc_gem5::Object
Definition: object.hh:47
sc_core::sc_simcontext
Definition: sc_simcontext.hh:37
sc_gem5::Events
std::vector< sc_core::sc_event * > Events
Definition: event.hh:54
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_gem5::Object::delChildEvent
void delChildEvent(sc_core::sc_event *e)
Definition: object.cc:254
sc_gem5::Object::parent
sc_core::sc_object * parent
Definition: object.hh:101
ArmISA::e
Bitfield< 9 > e
Definition: miscregs_types.hh:61
sc_gem5::pushParentObj
void pushParentObj(sc_core::sc_object *obj)
Definition: object.cc:322
sc_gem5::findObject
sc_core::sc_object * findObject(const char *name, const Objects &objects)
Definition: object.cc:296
sc_gem5::Object::children
Objects children
Definition: object.hh:99
sc_gem5::Object::_basename
std::string _basename
Definition: object.hh:96
sc_gem5::Object::pickUniqueName
std::string pickUniqueName(std::string name)
Definition: object.cc:263
sc_gem5::Object::get_child_events
const std::vector< sc_core::sc_event * > & get_child_events() const
Definition: object.cc:189
sc_gem5::ObjectsIt
Objects::iterator ObjectsIt
Definition: object.hh:44
sc_object.hh
sc_gem5
Definition: sc_clock.cc:42
sc_gem5::Objects
std::vector< sc_core::sc_object * > Objects
Definition: object.hh:40
sc_gem5::Object::remove_all_attributes
void remove_all_attributes()
Definition: object.cc:218
sc_gem5::Object::operator=
Object & operator=(const Object &)
Definition: object.cc:133
sc_gem5::allObjects
Objects allObjects
Definition: object.cc:287
sc_gem5::Object::add_attribute
bool add_attribute(sc_core::sc_attr_base &)
Definition: object.cc:200
sc_gem5::Object::events
Events events
Definition: object.hh:100
sc_gem5::Object::get_parent_object
sc_core::sc_object * get_parent_object() const
Definition: object.cc:194
sc_attr.hh

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