diff options
-rw-r--r-- | odb/boost/smart-ptr/lazy-ptr.hxx | 10 | ||||
-rw-r--r-- | odb/boost/smart-ptr/lazy-ptr.ixx | 14 |
2 files changed, 24 insertions, 0 deletions
diff --git a/odb/boost/smart-ptr/lazy-ptr.hxx b/odb/boost/smart-ptr/lazy-ptr.hxx index 28dce8a..8f523ac 100644 --- a/odb/boost/smart-ptr/lazy-ptr.hxx +++ b/odb/boost/smart-ptr/lazy-ptr.hxx @@ -98,6 +98,11 @@ namespace odb // void unload () const; + // Get the underlying eager pointer. If this is an unloaded pointer + // to a persistent object, then the returned pointer will be NULL. + // + ::boost::shared_ptr<T> get_eager () const; + template <class DB, class ID> lazy_shared_ptr (DB&, const ID&); template <class DB, class Y> lazy_shared_ptr (DB&, Y*); template <class DB, class Y, class D> lazy_shared_ptr (DB&, Y*, D); @@ -209,6 +214,11 @@ namespace odb // void unload () const; + // Get the underlying eager pointer. If this is an unloaded pointer + // to a persistent object, then the returned pointer will be NULL. + // + ::boost::weak_ptr<T> get_eager () const; + template <class DB, class ID> lazy_weak_ptr (DB&, const ID&); template <class DB, class Y> lazy_weak_ptr (DB&, const ::boost::shared_ptr<Y>&); template <class DB, class Y> lazy_weak_ptr (DB&, const ::boost::weak_ptr<Y>&); diff --git a/odb/boost/smart-ptr/lazy-ptr.ixx b/odb/boost/smart-ptr/lazy-ptr.ixx index 0de602c..b695787 100644 --- a/odb/boost/smart-ptr/lazy-ptr.ixx +++ b/odb/boost/smart-ptr/lazy-ptr.ixx @@ -221,6 +221,13 @@ namespace odb } template <class T> + inline ::boost::shared_ptr<T> lazy_shared_ptr<T>:: + get_eager () const + { + return p_; + } + + template <class T> template <class DB, class ID> inline lazy_shared_ptr<T>:: lazy_shared_ptr (DB& db, const ID& id): i_ (db, id) {} @@ -555,6 +562,13 @@ namespace odb } template <class T> + inline ::boost::weak_ptr<T> lazy_weak_ptr<T>:: + get_eager () const + { + return p_; + } + + template <class T> template <class DB, class ID> inline lazy_weak_ptr<T>:: lazy_weak_ptr (DB& db, const ID& id): i_ (db, id) {} |