From 642fa515b822aca10839e0382e3a5d94eca20dd2 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 22 Jun 2018 14:14:47 -0700 Subject: systemc: Implement the sc_attr classes. Change-Id: Ibbe6da957b1b36687178f226e80718adc0f4ab81 Reviewed-on: https://gem5-review.googlesource.com/11609 Reviewed-by: Gabe Black Maintainer: Gabe Black --- src/systemc/ext/core/sc_attr.hh | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) (limited to 'src/systemc/ext/core/sc_attr.hh') diff --git a/src/systemc/ext/core/sc_attr.hh b/src/systemc/ext/core/sc_attr.hh index e1c5ae771..16b0b1bed 100644 --- a/src/systemc/ext/core/sc_attr.hh +++ b/src/systemc/ext/core/sc_attr.hh @@ -39,40 +39,32 @@ namespace sc_core class sc_attr_base { public: - sc_attr_base(const std::string &); - sc_attr_base(const sc_attr_base &); + sc_attr_base(const std::string &_name); + sc_attr_base(const sc_attr_base &other); virtual ~sc_attr_base(); const std::string &name() const; - protected: - void warn_unimpl(const char *func); - private: // Disabled sc_attr_base(); sc_attr_base &operator = (const sc_attr_base &); + + const std::string _name; }; template class sc_attribute : public sc_attr_base { public: - sc_attribute(const std::string &_name) : sc_attr_base(_name) - { - warn_unimpl(__PRETTY_FUNCTION__); - } + sc_attribute(const std::string &_name) : sc_attr_base(_name) {} sc_attribute(const std::string &_name, const T &t) : sc_attr_base(_name), value(t) - { - warn_unimpl(__PRETTY_FUNCTION__); - } + {} sc_attribute(const sc_attribute &other) : sc_attr_base(other.name()), value(other.value) - { - warn_unimpl(__PRETTY_FUNCTION__); - } - virtual ~sc_attribute() { warn_unimpl(__PRETTY_FUNCTION__); } + {} + virtual ~sc_attribute() {} T value; private: @@ -85,8 +77,8 @@ class sc_attr_cltn { public: typedef sc_attr_base *elem_type; - typedef elem_type *iterator; - typedef const elem_type *const_iterator; + typedef std::vector::iterator iterator; + typedef std::vector::const_iterator const_iterator; iterator begin(); const_iterator begin() const; @@ -114,8 +106,7 @@ class sc_attr_cltn sc_attr_base *remove(const std::string &name); void remove_all(); - - int size() const { return cltn.size(); } + int size() const; private: std::vector cltn; -- cgit v1.2.3