gem5  v20.1.0.0
sc_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_EXT_CORE_SC_OBJECT_HH__
29 #define __SYSTEMC_EXT_CORE_SC_OBJECT_HH__
30 
31 #include <iostream>
32 #include <string>
33 #include <vector>
34 
35 namespace sc_gem5
36 {
37 
38 class Object;
39 
40 } // namespace sc_gem5
41 
42 namespace sc_core
43 {
44 
45 class sc_event;
46 class sc_attr_base;
47 class sc_attr_cltn;
48 class sc_simcontext;
49 
50 class sc_object
51 {
52  public:
53  const char *name() const;
54  const char *basename() const;
55 
56  virtual const char *kind() const { return "sc_object"; }
57 
58  virtual void print(std::ostream & =std::cout) const;
59  virtual void dump(std::ostream & =std::cout) const;
60 
61  virtual const std::vector<sc_object *> &get_child_objects() const;
62  virtual const std::vector<sc_event *> &get_child_events() const;
64 
66  sc_attr_base *get_attribute(const std::string &);
67  sc_attr_base *remove_attribute(const std::string &);
68  void remove_all_attributes();
69  int num_attributes() const;
71  const sc_attr_cltn &attr_cltn() const;
72 
73  // Deprecated
74  sc_simcontext *simcontext() const;
75 
76  protected:
77  sc_object();
78  sc_object(const char *);
79  sc_object(const sc_object &);
81  virtual ~sc_object();
82 
83  private:
84  friend class sc_gem5::Object;
86 };
87 
89 sc_object *sc_find_object(const char *);
90 
91 } // namespace sc_core
92 
93 #endif //__SYSTEMC_EXT_CORE_SC_OBJECT_HH__
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_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_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_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_core::sc_attr_base
Definition: sc_attr.hh:37
sc_gem5::Object
Definition: object.hh:47
sc_core::sc_simcontext
Definition: sc_simcontext.hh:37
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_core::sc_object
Definition: sc_object.hh:50
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_core::sc_object::operator=
sc_object & operator=(const sc_object &)
Definition: sc_object.cc:149
sc_core::sc_object::name
const char * name() const
Definition: sc_object.cc:44
sc_core::sc_object::sc_object
sc_object()
Definition: sc_object.cc:133
sc_gem5
Definition: sc_clock.cc:42
sc_core::sc_object::kind
virtual const char * kind() const
Definition: sc_object.hh:56
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:15 for gem5 by doxygen 1.8.17