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 * Authors: Gabe Black 28 */ 29
| 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 * Authors: Gabe Black 28 */ 29
|
| 30#include <utility> 31
|
30#include "base/logging.hh" 31#include "systemc/ext/core/sc_attr.hh" 32 33namespace sc_core 34{ 35
| 32#include "base/logging.hh" 33#include "systemc/ext/core/sc_attr.hh" 34 35namespace sc_core 36{ 37
|
36sc_attr_base::sc_attr_base(const std::string &) 37{ 38 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 39}
| 38sc_attr_base::sc_attr_base(const std::string &_name) : _name(_name) {} 39sc_attr_base::sc_attr_base(const sc_attr_base &other) : _name(other._name) {} 40sc_attr_base::~sc_attr_base() {}
|
40
| 41
|
41sc_attr_base::sc_attr_base(const sc_attr_base &) 42{ 43 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 44}
| 42const std::string &sc_attr_base::name() const { return _name; }
|
45
| 43
|
46sc_attr_base::~sc_attr_base() 47{ 48 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 49} 50 51const std::string & 52sc_attr_base::name() const 53{ 54 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 55 return *(const std::string *)nullptr; 56} 57 58void 59sc_attr_base::warn_unimpl(const char *func) 60{ 61 warn("%s not implemented.\n", func); 62} 63
| |
64sc_attr_cltn::iterator 65sc_attr_cltn::begin() 66{
| 44sc_attr_cltn::iterator 45sc_attr_cltn::begin() 46{
|
67 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 68 return (iterator)nullptr;
| 47 return cltn.begin();
|
69} 70 71sc_attr_cltn::const_iterator 72sc_attr_cltn::begin() const 73{
| 48} 49 50sc_attr_cltn::const_iterator 51sc_attr_cltn::begin() const 52{
|
74 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 75 return (const_iterator)nullptr;
| 53 return cltn.begin();
|
76} 77 78sc_attr_cltn::iterator 79sc_attr_cltn::end() 80{
| 54} 55 56sc_attr_cltn::iterator 57sc_attr_cltn::end() 58{
|
81 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 82 return (iterator)nullptr;
| 59 return cltn.end();
|
83} 84 85sc_attr_cltn::const_iterator 86sc_attr_cltn::end() const 87{
| 60} 61 62sc_attr_cltn::const_iterator 63sc_attr_cltn::end() const 64{
|
88 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 89 return (const_iterator)nullptr;
| 65 return cltn.end();
|
90} 91
| 66} 67
|
92sc_attr_cltn::sc_attr_cltn() 93{ 94 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 95}
| 68sc_attr_cltn::sc_attr_cltn() {} 69sc_attr_cltn::sc_attr_cltn(const sc_attr_cltn &other) : cltn(other.cltn) {} 70sc_attr_cltn::~sc_attr_cltn() {}
|
96
| 71
|
97sc_attr_cltn::sc_attr_cltn(const sc_attr_cltn &)
| 72bool 73sc_attr_cltn::push_back(sc_attr_base *attr)
|
98{
| 74{
|
99 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 100}
| 75 if (!attr || (*this)[attr->name()]) 76 return false;
|
101
| 77
|
102sc_attr_cltn::~sc_attr_cltn() 103{ 104 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 78 cltn.push_back(attr); 79 return true;
|
105} 106
| 80} 81
|
107bool 108sc_attr_cltn::push_back(sc_attr_base *) 109{ 110 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 111 return false; 112} 113
| |
114sc_attr_base * 115sc_attr_cltn::operator [] (const std::string &name) 116{
| 82sc_attr_base * 83sc_attr_cltn::operator [] (const std::string &name) 84{
|
117 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 85 for (auto &attr: cltn) 86 if (attr->name() == name) 87 return attr;
|
118 return nullptr; 119} 120 121const sc_attr_base * 122sc_attr_cltn::operator [] (const std::string &name) const 123{
| 88 return nullptr; 89} 90 91const sc_attr_base * 92sc_attr_cltn::operator [] (const std::string &name) const 93{
|
124 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 94 for (auto &attr: cltn) 95 if (attr->name() == name) 96 return attr;
|
125 return nullptr; 126} 127 128sc_attr_base * 129sc_attr_cltn::remove(const std::string &name) 130{
| 97 return nullptr; 98} 99 100sc_attr_base * 101sc_attr_cltn::remove(const std::string &name) 102{
|
131 warn("%s not implemented.\n", __PRETTY_FUNCTION__);
| 103 for (auto &attr: cltn) { 104 if (attr->name() == name) { 105 sc_attr_base *ret = attr; 106 std::swap(attr, cltn.back()); 107 cltn.pop_back(); 108 return ret; 109 } 110 }
|
132 return nullptr; 133} 134
| 111 return nullptr; 112} 113
|
135void 136sc_attr_cltn::remove_all() 137{ 138 warn("%s not implemented.\n", __PRETTY_FUNCTION__); 139}
| 114void sc_attr_cltn::remove_all() { cltn.clear(); }
|
140
| 115
|
| 116int sc_attr_cltn::size() const { return cltn.size(); } 117
|
141} // namespace sc_core
| 118} // namespace sc_core
|