gem5
v20.1.0.0
systemc
core
sc_attr.cc
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
#include <utility>
29
30
#include "
systemc/ext/core/sc_attr.hh
"
31
32
namespace
sc_core
33
{
34
35
sc_attr_base::sc_attr_base
(
const
std::string &_name) : _name(_name) {}
36
sc_attr_base::sc_attr_base
(
const
sc_attr_base
&other) : _name(other._name) {}
37
sc_attr_base::~sc_attr_base
() {}
38
39
const
std::string &
sc_attr_base::name
()
const
{
return
_name
; }
40
41
sc_attr_cltn::iterator
42
sc_attr_cltn::begin
()
43
{
44
return
cltn
.begin();
45
}
46
47
sc_attr_cltn::const_iterator
48
sc_attr_cltn::begin
()
const
49
{
50
return
cltn
.begin();
51
}
52
53
sc_attr_cltn::iterator
54
sc_attr_cltn::end
()
55
{
56
return
cltn
.end();
57
}
58
59
sc_attr_cltn::const_iterator
60
sc_attr_cltn::end
()
const
61
{
62
return
cltn
.end();
63
}
64
65
sc_attr_cltn::sc_attr_cltn
() {}
66
sc_attr_cltn::sc_attr_cltn
(
const
sc_attr_cltn
&other) : cltn(other.cltn) {}
67
sc_attr_cltn::~sc_attr_cltn
() {}
68
69
bool
70
sc_attr_cltn::push_back
(
sc_attr_base
*
attr
)
71
{
72
if
(!
attr
|| (*
this
)[
attr
->name()])
73
return
false
;
74
75
cltn
.push_back(
attr
);
76
return
true
;
77
}
78
79
sc_attr_base
*
80
sc_attr_cltn::operator []
(
const
std::string &
name
)
81
{
82
for
(
auto
&
attr
:
cltn
)
83
if
(
attr
->name() ==
name
)
84
return
attr
;
85
return
nullptr
;
86
}
87
88
const
sc_attr_base
*
89
sc_attr_cltn::operator []
(
const
std::string &
name
)
const
90
{
91
for
(
auto
&
attr
:
cltn
)
92
if
(
attr
->name() ==
name
)
93
return
attr
;
94
return
nullptr
;
95
}
96
97
sc_attr_base
*
98
sc_attr_cltn::remove
(
const
std::string &
name
)
99
{
100
for
(
auto
&
attr
:
cltn
) {
101
if
(
attr
->name() ==
name
) {
102
sc_attr_base
*ret =
attr
;
103
std::swap(
attr
,
cltn
.back());
104
cltn
.pop_back();
105
return
ret;
106
}
107
}
108
return
nullptr
;
109
}
110
111
void
sc_attr_cltn::remove_all
() {
cltn
.clear(); }
112
113
int
sc_attr_cltn::size
()
const
{
return
cltn
.size(); }
114
115
}
// namespace sc_core
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_attr_cltn::iterator
std::vector< elem_type >::iterator iterator
Definition:
sc_attr.hh:78
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_cltn::~sc_attr_cltn
~sc_attr_cltn()
Definition:
sc_attr.cc:67
ArmISA::attr
attr
Definition:
miscregs_types.hh:649
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_attr_cltn::remove
sc_attr_base * remove(const std::string &name)
Definition:
sc_attr.cc:98
name
const std::string & name()
Definition:
trace.cc:50
sc_core::sc_attr_cltn::cltn
std::vector< sc_attr_base * > cltn
Definition:
sc_attr.hh:110
sc_core::sc_attr_cltn::size
int size() const
Definition:
sc_attr.cc:113
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
sc_attr.hh
Generated on Wed Sep 30 2020 14:02:14 for gem5 by
doxygen
1.8.17