diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-29 10:08:30 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-29 10:08:30 +0200 |
commit | 4e7d12d30a3863f89f1deba05d1ae5fb52cb1a80 (patch) | |
tree | 03208e45b5a922e49a18c7f5a7d1d34ea2bd7202 | |
parent | cc73421f5a617c8c9e93dbddb6825a53a23d5a29 (diff) |
Add static multi-database support for lazy pointers
A lazy pointer must load the object using the static database interface
with which it was initialized.
-rw-r--r-- | odb/boost/smart-ptr/lazy-ptr.hxx | 40 | ||||
-rw-r--r-- | odb/boost/smart-ptr/lazy-ptr.ixx | 98 |
2 files changed, 69 insertions, 69 deletions
diff --git a/odb/boost/smart-ptr/lazy-ptr.hxx b/odb/boost/smart-ptr/lazy-ptr.hxx index 8e6c628..0d9cf56 100644 --- a/odb/boost/smart-ptr/lazy-ptr.hxx +++ b/odb/boost/smart-ptr/lazy-ptr.hxx @@ -98,20 +98,20 @@ namespace odb // void unload () const; - template <class ID> lazy_shared_ptr (database_type&, const ID&); - template <class Y> lazy_shared_ptr (database_type&, Y*); - template <class Y, class D> lazy_shared_ptr (database_type&, Y*, D); - template <class Y, class D, class A> lazy_shared_ptr (database_type&, Y*, D, A); - template <class Y> lazy_shared_ptr (database_type&, std::auto_ptr<Y>&); - template <class Y> lazy_shared_ptr (database_type&, const ::boost::shared_ptr<Y>&); - template <class Y> lazy_shared_ptr (database_type&, const ::boost::weak_ptr<Y>&); - - template <class ID> void reset (database_type&, const ID&); - template <class Y> void reset (database_type&, Y*); - template <class Y, class D> void reset (database_type&, Y*, D); - template <class Y, class D, class A> void reset (database_type&, Y*, D, A); - template <class Y> void reset (database_type&, std::auto_ptr<Y>&); - template <class Y> void reset (database_type&, const ::boost::shared_ptr<Y>&); + 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); + template <class DB, class Y, class D, class A> lazy_shared_ptr (DB&, Y*, D, A); + template <class DB, class Y> lazy_shared_ptr (DB&, std::auto_ptr<Y>&); + template <class DB, class Y> lazy_shared_ptr (DB&, const ::boost::shared_ptr<Y>&); + template <class DB, class Y> lazy_shared_ptr (DB&, const ::boost::weak_ptr<Y>&); + + template <class DB, class ID> void reset (DB&, const ID&); + template <class DB, class Y> void reset (DB&, Y*); + template <class DB, class Y, class D> void reset (DB&, Y*, D); + template <class DB, class Y, class D, class A> void reset (DB&, Y*, D, A); + template <class DB, class Y> void reset (DB&, std::auto_ptr<Y>&); + template <class DB, class Y> void reset (DB&, const ::boost::shared_ptr<Y>&); #ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT template <class O = T> @@ -209,13 +209,13 @@ namespace odb // void unload () const; - template <class ID> lazy_weak_ptr (database_type&, const ID&); - template <class Y> lazy_weak_ptr (database_type&, const ::boost::shared_ptr<Y>&); - template <class Y> lazy_weak_ptr (database_type&, const ::boost::weak_ptr<Y>&); + 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>&); - template <class ID> void reset (database_type&, const ID&); - template <class Y> void reset (database_type&, const ::boost::shared_ptr<Y>&); - template <class Y> void reset (database_type&, const ::boost::weak_ptr<Y>&); + template <class DB, class ID> void reset (DB&, const ID&); + template <class DB, class Y> void reset (DB&, const ::boost::shared_ptr<Y>&); + template <class DB, class Y> void reset (DB&, const ::boost::weak_ptr<Y>&); // The object_id() function can only be called when the object is // persistent, or: expired() XOR loaded() (can use != for XOR). diff --git a/odb/boost/smart-ptr/lazy-ptr.ixx b/odb/boost/smart-ptr/lazy-ptr.ixx index 4b9f761..a9d8e4d 100644 --- a/odb/boost/smart-ptr/lazy-ptr.ixx +++ b/odb/boost/smart-ptr/lazy-ptr.ixx @@ -221,140 +221,140 @@ namespace odb } template <class T> - template <class ID> + template <class DB, class ID> inline lazy_shared_ptr<T>:: - lazy_shared_ptr (database_type& db, const ID& id): i_ (db, id) {} + lazy_shared_ptr (DB& db, const ID& id): i_ (db, id) {} template <class T> - template <class Y> + template <class DB, class Y> inline lazy_shared_ptr<T>:: - lazy_shared_ptr (database_type& db, Y* p) + lazy_shared_ptr (DB& db, Y* p) : p_ (p) { if (p_) - i_.reset (db); + i_.reset_db (db); } template <class T> - template <class Y, class D> + template <class DB, class Y, class D> inline lazy_shared_ptr<T>:: - lazy_shared_ptr (database_type& db, Y* p, D d) + lazy_shared_ptr (DB& db, Y* p, D d) : p_ (p, d) { if (p_) - i_.reset (db); + i_.reset_db (db); } template <class T> - template <class Y, class D, class A> + template <class DB, class Y, class D, class A> inline lazy_shared_ptr<T>:: - lazy_shared_ptr (database_type& db, Y* p, D d, A a) + lazy_shared_ptr (DB& db, Y* p, D d, A a) : p_ (p, d, a) { if (p_) - i_.reset (db); + i_.reset_db (db); } template <class T> - template <class Y> + template <class DB, class Y> inline lazy_shared_ptr<T>:: - lazy_shared_ptr (database_type& db, std::auto_ptr<Y>& r) + lazy_shared_ptr (DB& db, std::auto_ptr<Y>& r) : p_ (r) { if (p_) - i_.reset (db); + i_.reset_db (db); } template <class T> - template <class Y> + template <class DB, class Y> inline lazy_shared_ptr<T>:: - lazy_shared_ptr (database_type& db, const ::boost::shared_ptr<Y>& r) + lazy_shared_ptr (DB& db, const ::boost::shared_ptr<Y>& r) : p_ (r) { if (p_) - i_.reset (db); + i_.reset_db (db); } template <class T> - template <class Y> + template <class DB, class Y> inline lazy_shared_ptr<T>:: - lazy_shared_ptr (database_type& db, const ::boost::weak_ptr<Y>& r) + lazy_shared_ptr (DB& db, const ::boost::weak_ptr<Y>& r) : p_ (r) { if (p_) - i_.reset (db); + i_.reset_db (db); } template <class T> - template <class ID> + template <class DB, class ID> inline void lazy_shared_ptr<T>:: - reset (database_type& db, const ID& id) + reset (DB& db, const ID& id) { p_.reset (); i_.reset (db, id); } template <class T> - template <class Y> + template <class DB, class Y> inline void lazy_shared_ptr<T>:: - reset (database_type& db, Y* p) + reset (DB& db, Y* p) { p_.reset (p); if (p_) - i_.reset (db); + i_.reset_db (db); else i_.reset (); } template <class T> - template <class Y, class D> + template <class DB, class Y, class D> inline void lazy_shared_ptr<T>:: - reset (database_type& db, Y* p, D d) + reset (DB& db, Y* p, D d) { p_.reset (p, d); if (p_) - i_.reset (db); + i_.reset_db (db); else i_.reset (); } template <class T> - template <class Y, class D, class A> + template <class DB, class Y, class D, class A> inline void lazy_shared_ptr<T>:: - reset (database_type& db, Y* p, D d, A a) + reset (DB& db, Y* p, D d, A a) { p_.reset (p, d, a); if (p_) - i_.reset (db); + i_.reset_db (db); else i_.reset (); } template <class T> - template <class Y> + template <class DB, class Y> inline void lazy_shared_ptr<T>:: - reset (database_type& db, std::auto_ptr<Y>& r) + reset (DB& db, std::auto_ptr<Y>& r) { p_ = r; if (p_) - i_.reset (db); + i_.reset_db (db); else i_.reset (); } template <class T> - template <class Y> + template <class DB, class Y> inline void lazy_shared_ptr<T>:: - reset (database_type& db, const ::boost::shared_ptr<Y>& r) + reset (DB& db, const ::boost::shared_ptr<Y>& r) { p_ = r; if (p_) - i_.reset (db); + i_.reset_db (db); else i_.reset (); } @@ -554,14 +554,14 @@ namespace odb } template <class T> - template <class ID> + template <class DB, class ID> inline lazy_weak_ptr<T>:: - lazy_weak_ptr (database_type& db, const ID& id): i_ (db, id) {} + lazy_weak_ptr (DB& db, const ID& id): i_ (db, id) {} template <class T> - template <class Y> + template <class DB, class Y> inline lazy_weak_ptr<T>:: - lazy_weak_ptr (database_type& db, const ::boost::shared_ptr<Y>& r) + lazy_weak_ptr (DB& db, const ::boost::shared_ptr<Y>& r) : p_ (r) { typedef typename object_traits<T>::object_type object_type; @@ -571,9 +571,9 @@ namespace odb } template <class T> - template <class Y> + template <class DB, class Y> inline lazy_weak_ptr<T>:: - lazy_weak_ptr (database_type& db, const ::boost::weak_ptr<Y>& r) + lazy_weak_ptr (DB& db, const ::boost::weak_ptr<Y>& r) : p_ (r) { typedef typename object_traits<T>::object_type object_type; @@ -585,18 +585,18 @@ namespace odb } template <class T> - template <class ID> + template <class DB, class ID> inline void lazy_weak_ptr<T>:: - reset (database_type& db, const ID& id) + reset (DB& db, const ID& id) { p_.reset (); i_.reset (db, id); } template <class T> - template <class Y> + template <class DB, class Y> inline void lazy_weak_ptr<T>:: - reset (database_type& db, const ::boost::shared_ptr<Y>& r) + reset (DB& db, const ::boost::shared_ptr<Y>& r) { typedef typename object_traits<T>::object_type object_type; @@ -609,9 +609,9 @@ namespace odb } template <class T> - template <class Y> + template <class DB, class Y> inline void lazy_weak_ptr<T>:: - reset (database_type& db, const ::boost::weak_ptr<Y>& r) + reset (DB& db, const ::boost::weak_ptr<Y>& r) { typedef typename object_traits<T>::object_type object_type; |