gem5 v24.0.0.0
Loading...
Searching...
No Matches
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
34namespace 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
50
51 const std::string _name;
52};
53
54template <class T>
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 {}
63 sc_attr_base(other.name()), value(other.value)
64 {}
65 virtual ~sc_attribute() {}
67
68 private:
69 // Disabled
71 sc_attribute<T> &operator = (const sc_attribute<T> &) { return *this; }
72};
73
75{
76 public:
80
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:
93
94 // It's non-standard for this not to be disabled.
96
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__
const std::string _name
Definition sc_attr.hh:51
virtual ~sc_attr_base()
Definition sc_attr.cc:37
sc_attr_base & operator=(const sc_attr_base &)
const std::string & name() const
Definition sc_attr.cc:39
std::vector< elem_type >::iterator iterator
Definition sc_attr.hh:78
sc_attr_cltn & operator=(const sc_attr_cltn &)
sc_attr_base * elem_type
Definition sc_attr.hh:77
std::vector< elem_type >::const_iterator const_iterator
Definition sc_attr.hh:79
sc_attr_base * operator[](const std::string &name)
Definition sc_attr.cc:80
bool push_back(sc_attr_base *)
Definition sc_attr.cc:70
std::vector< sc_attr_base * > cltn
Definition sc_attr.hh:110
sc_attr_base * remove(const std::string &name)
Definition sc_attr.cc:98
sc_attribute(const sc_attribute< T > &other)
Definition sc_attr.hh:62
sc_attribute< T > & operator=(const sc_attribute< T > &)
Definition sc_attr.hh:71
virtual ~sc_attribute()
Definition sc_attr.hh:65
sc_attribute(const std::string &_name, const T &t)
Definition sc_attr.hh:59
sc_attribute(const std::string &_name)
Definition sc_attr.hh:58
STL vector class.
Definition stl.hh:37
const std::string & name()
Definition trace.cc:48

Generated on Tue Jun 18 2024 16:24:06 for gem5 by doxygen 1.11.0