diff options
author | Josh Blum | 2012-11-03 16:22:56 -0700 |
---|---|---|
committer | Josh Blum | 2012-11-03 16:22:56 -0700 |
commit | 0b6be66da90cf18130891682969a1d74c0ba1c87 (patch) | |
tree | 844445925b9c6e17749e2d200b2dec6af3090497 /include/gras | |
parent | 69a0c4fb988181de3ea8caef71b480f794882c0f (diff) | |
download | sandhi-0b6be66da90cf18130891682969a1d74c0ba1c87.tar.gz sandhi-0b6be66da90cf18130891682969a1d74c0ba1c87.tar.bz2 sandhi-0b6be66da90cf18130891682969a1d74c0ba1c87.zip |
moved around the shared ptr logic in Element
Diffstat (limited to 'include/gras')
-rw-r--r-- | include/gras/element.hpp | 35 |
1 files changed, 19 insertions, 16 deletions
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 |