diff options
m--------- | PMC | 0 | ||||
m--------- | gnuradio | 0 | ||||
-rw-r--r-- | include/gras/element.hpp | 35 | ||||
-rw-r--r-- | lib/element.cpp | 2 |
4 files changed, 20 insertions, 17 deletions
diff --git a/PMC b/PMC -Subproject a945e88c23e2cd7057ab902b44a836231823aba +Subproject bb5a0cfac787111b1a0625c38faf227ba71d0c6 diff --git a/gnuradio b/gnuradio -Subproject 7e4976c00a417f06dcfda707a8e04c23b9fc85c +Subproject 06d587559fbb7bbaea0167535f3cde1bc13a355 diff --git a/include/gras/element.hpp b/include/gras/element.hpp index 3142510..34cdb45 100644 --- a/include/gras/element.hpp +++ b/include/gras/element.hpp @@ -36,22 +36,6 @@ struct GRAS_API Element : boost::shared_ptr<ElementImpl>, boost::enable_shared_f //! Creates a new element given the name Element(const std::string &name); - /*! - * Create an element from a shared pointer to an element. - * Good for that factory function/shared ptr paradigm. - */ - template <typename T> - Element(const boost::shared_ptr<T> &elem) - { - *this = elem->shared_to_element(); - } - - //! Convert a shared ptr of a derived class to an Element - Element &shared_to_element(void); - - //! for internal use only - boost::weak_ptr<Element> weak_self; - //! An integer ID that is unique across the process long unique_id(void) const; @@ -69,6 +53,25 @@ struct GRAS_API Element : boost::shared_ptr<ElementImpl>, boost::enable_shared_f const gras::IOSignature &output_signature(void) const; + /******************************************************************* + * Compatibility for dealing with shared ptrs of Elements + ******************************************************************/ + /*! + * Create an element from a shared pointer to an element. + * Good for that factory function/shared ptr paradigm. + */ + template <typename T> + Element(const boost::shared_ptr<T> &elem) + { + *this = elem->shared_to_element(); + } + + //! Convert a shared ptr of a derived class to an Element + Element &shared_to_element(void); + + //! for internal use only + boost::weak_ptr<Element> weak_self; + }; } //namespace gras diff --git a/lib/element.cpp b/lib/element.cpp index 83466c2..4ac52ea 100644 --- a/lib/element.cpp +++ b/lib/element.cpp @@ -57,7 +57,7 @@ Element &Element::shared_to_element(void) this->weak_self = this->shared_from_this(); } catch(...){} - return this->derived_to_element(); + return *this; } long Element::unique_id(void) const |