gem5  v22.0.0.2
sc_attr.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_ATTR_HH__
29 #define __SYSTEMC_EXT_CORE_SC_ATTR_HH__
30 
31 #include <string>
32 #include <vector>
33 
34 namespace sc_core
35 {
36 
38 {
39  public:
40  sc_attr_base(const std::string &_name);
41  sc_attr_base(const sc_attr_base &other);
42  virtual ~sc_attr_base();
43 
44  const std::string &name() const;
45 
46  private:
47  // Disabled
48  sc_attr_base();
50 
51  const std::string _name;
52 };
53 
54 template <class T>
55 class sc_attribute : public sc_attr_base
56 {
57  public:
58  sc_attribute(const std::string &_name) : sc_attr_base(_name) {}
59  sc_attribute(const std::string &_name, const T &t) :
61  {}
62  sc_attribute(const sc_attribute<T> &other) :
63  sc_attr_base(other.name()), value(other.value)
64  {}
65  virtual ~sc_attribute() {}
66  T value;
67 
68  private:
69  // Disabled
71  sc_attribute<T> &operator = (const sc_attribute<T> &) { return *this; }
72 };
73 
75 {
76  public:
80 
81  iterator begin();
82  const_iterator begin() const;
83  iterator end();
84  const_iterator end() const;
85 
86  private:
87  // Disabled
89 
90  // "Impelemtation defined" members required by the regression tests.
91  public:
92  sc_attr_cltn();
93 
94  // It's non-standard for this not to be disabled.
95  sc_attr_cltn(const sc_attr_cltn &);
96 
97  ~sc_attr_cltn();
98 
99  bool push_back(sc_attr_base *);
100 
101  sc_attr_base *operator [] (const std::string &name);
102  const sc_attr_base *operator [] (const std::string &name) const;
103 
104  sc_attr_base *remove(const std::string &name);
105 
106  void remove_all();
107  int size() const;
108 
109  private:
111 };
112 
113 } // namespace sc_core
114 
115 #endif //__SYSTEMC_EXT_CORE_SC_ATTR_HH__
sc_core::sc_attribute::sc_attribute
sc_attribute(const sc_attribute< T > &other)
Definition: sc_attr.hh:62
sc_core::sc_attr_cltn::sc_attr_cltn
sc_attr_cltn()
Definition: sc_attr.cc:65
sc_core::sc_attr_base::sc_attr_base
sc_attr_base()
sc_core::sc_attr_cltn::end
iterator end()
Definition: sc_attr.cc:54
sc_core::sc_attr_cltn
Definition: sc_attr.hh:74
sc_core
Definition: messages.cc:31
sc_core::sc_attr_base::_name
const std::string _name
Definition: sc_attr.hh:51
sc_core::sc_attribute
Definition: sc_attr.hh:55
sc_core::sc_attr_cltn::iterator
std::vector< elem_type >::iterator iterator
Definition: sc_attr.hh:78
std::vector
STL vector class.
Definition: stl.hh:37
sc_core::sc_attribute::operator=
sc_attribute< T > & operator=(const sc_attribute< T > &)
Definition: sc_attr.hh:71
sc_core::sc_attr_base::name
const std::string & name() const
Definition: sc_attr.cc:39
sc_core::sc_attr_base
Definition: sc_attr.hh:37
sc_core::sc_attr_base::operator=
sc_attr_base & operator=(const sc_attr_base &)
gem5::VegaISA::t
Bitfield< 51 > t
Definition: pagetable.hh:56
sc_core::sc_attr_cltn::elem_type
sc_attr_base * elem_type
Definition: sc_attr.hh:77
sc_core::sc_attr_cltn::~sc_attr_cltn
~sc_attr_cltn()
Definition: sc_attr.cc:67
sc_core::sc_attr_cltn::begin
iterator begin()
Definition: sc_attr.cc:42
sc_core::sc_attr_cltn::const_iterator
std::vector< elem_type >::const_iterator const_iterator
Definition: sc_attr.hh:79
sc_core::sc_attribute::sc_attribute
sc_attribute()
Definition: sc_attr.hh:70
sc_core::sc_attr_cltn::remove
sc_attr_base * remove(const std::string &name)
Definition: sc_attr.cc:98
name
const std::string & name()
Definition: trace.cc:49
sc_core::sc_attribute::sc_attribute
sc_attribute(const std::string &_name, const T &t)
Definition: sc_attr.hh:59
sc_core::sc_attr_cltn::cltn
std::vector< sc_attr_base * > cltn
Definition: sc_attr.hh:110
sc_core::sc_attribute::~sc_attribute
virtual ~sc_attribute()
Definition: sc_attr.hh:65
sc_core::sc_attr_cltn::size
int size() const
Definition: sc_attr.cc:113
sc_core::sc_attr_cltn::operator=
sc_attr_cltn & operator=(const sc_attr_cltn &)
sc_core::sc_attribute::sc_attribute
sc_attribute(const std::string &_name)
Definition: sc_attr.hh:58
sc_core::sc_attribute::value
T value
Definition: sc_attr.hh:66
sc_core::sc_attr_cltn::operator[]
sc_attr_base * operator[](const std::string &name)
Definition: sc_attr.cc:80
sc_core::sc_attr_cltn::remove_all
void remove_all()
Definition: sc_attr.cc:111
sc_core::sc_attr_base::~sc_attr_base
virtual ~sc_attr_base()
Definition: sc_attr.cc:37
sc_core::sc_attr_cltn::push_back
bool push_back(sc_attr_base *)
Definition: sc_attr.cc:70

Generated on Thu Jul 28 2022 13:32:38 for gem5 by doxygen 1.8.17