From 4e7d12d30a3863f89f1deba05d1ae5fb52cb1a80 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 29 Oct 2012 10:08:30 +0200 Subject: 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. --- odb/boost/smart-ptr/lazy-ptr.hxx | 40 ++++++++-------- 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 lazy_shared_ptr (database_type&, const ID&); - template lazy_shared_ptr (database_type&, Y*); - template lazy_shared_ptr (database_type&, Y*, D); - template lazy_shared_ptr (database_type&, Y*, D, A); - template lazy_shared_ptr (database_type&, std::auto_ptr&); - template lazy_shared_ptr (database_type&, const ::boost::shared_ptr&); - template lazy_shared_ptr (database_type&, const ::boost::weak_ptr&); - - template void reset (database_type&, const ID&); - template void reset (database_type&, Y*); - template void reset (database_type&, Y*, D); - template void reset (database_type&, Y*, D, A); - template void reset (database_type&, std::auto_ptr&); - template void reset (database_type&, const ::boost::shared_ptr&); + template lazy_shared_ptr (DB&, const ID&); + template lazy_shared_ptr (DB&, Y*); + template lazy_shared_ptr (DB&, Y*, D); + template lazy_shared_ptr (DB&, Y*, D, A); + template lazy_shared_ptr (DB&, std::auto_ptr&); + template lazy_shared_ptr (DB&, const ::boost::shared_ptr&); + template lazy_shared_ptr (DB&, const ::boost::weak_ptr&); + + template void reset (DB&, const ID&); + template void reset (DB&, Y*); + template void reset (DB&, Y*, D); + template void reset (DB&, Y*, D, A); + template void reset (DB&, std::auto_ptr&); + template void reset (DB&, const ::boost::shared_ptr&); #ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT template @@ -209,13 +209,13 @@ namespace odb // void unload () const; - template lazy_weak_ptr (database_type&, const ID&); - template lazy_weak_ptr (database_type&, const ::boost::shared_ptr&); - template lazy_weak_ptr (database_type&, const ::boost::weak_ptr&); + template lazy_weak_ptr (DB&, const ID&); + template lazy_weak_ptr (DB&, const ::boost::shared_ptr&); + template lazy_weak_ptr (DB&, const ::boost::weak_ptr&); - template void reset (database_type&, const ID&); - template void reset (database_type&, const ::boost::shared_ptr&); - template void reset (database_type&, const ::boost::weak_ptr&); + template void reset (DB&, const ID&); + template void reset (DB&, const ::boost::shared_ptr&); + template void reset (DB&, const ::boost::weak_ptr&); // 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 - template + template inline lazy_shared_ptr:: - lazy_shared_ptr (database_type& db, const ID& id): i_ (db, id) {} + lazy_shared_ptr (DB& db, const ID& id): i_ (db, id) {} template - template + template inline lazy_shared_ptr:: - 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 - template + template inline lazy_shared_ptr:: - 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 - template + template inline lazy_shared_ptr:: - 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 - template + template inline lazy_shared_ptr:: - lazy_shared_ptr (database_type& db, std::auto_ptr& r) + lazy_shared_ptr (DB& db, std::auto_ptr& r) : p_ (r) { if (p_) - i_.reset (db); + i_.reset_db (db); } template - template + template inline lazy_shared_ptr:: - lazy_shared_ptr (database_type& db, const ::boost::shared_ptr& r) + lazy_shared_ptr (DB& db, const ::boost::shared_ptr& r) : p_ (r) { if (p_) - i_.reset (db); + i_.reset_db (db); } template - template + template inline lazy_shared_ptr:: - lazy_shared_ptr (database_type& db, const ::boost::weak_ptr& r) + lazy_shared_ptr (DB& db, const ::boost::weak_ptr& r) : p_ (r) { if (p_) - i_.reset (db); + i_.reset_db (db); } template - template + template inline void lazy_shared_ptr:: - reset (database_type& db, const ID& id) + reset (DB& db, const ID& id) { p_.reset (); i_.reset (db, id); } template - template + template inline void lazy_shared_ptr:: - 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 - template + template inline void lazy_shared_ptr:: - 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 - template + template inline void lazy_shared_ptr:: - 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 - template + template inline void lazy_shared_ptr:: - reset (database_type& db, std::auto_ptr& r) + reset (DB& db, std::auto_ptr& r) { p_ = r; if (p_) - i_.reset (db); + i_.reset_db (db); else i_.reset (); } template - template + template inline void lazy_shared_ptr:: - reset (database_type& db, const ::boost::shared_ptr& r) + reset (DB& db, const ::boost::shared_ptr& r) { p_ = r; if (p_) - i_.reset (db); + i_.reset_db (db); else i_.reset (); } @@ -554,14 +554,14 @@ namespace odb } template - template + template inline lazy_weak_ptr:: - lazy_weak_ptr (database_type& db, const ID& id): i_ (db, id) {} + lazy_weak_ptr (DB& db, const ID& id): i_ (db, id) {} template - template + template inline lazy_weak_ptr:: - lazy_weak_ptr (database_type& db, const ::boost::shared_ptr& r) + lazy_weak_ptr (DB& db, const ::boost::shared_ptr& r) : p_ (r) { typedef typename object_traits::object_type object_type; @@ -571,9 +571,9 @@ namespace odb } template - template + template inline lazy_weak_ptr:: - lazy_weak_ptr (database_type& db, const ::boost::weak_ptr& r) + lazy_weak_ptr (DB& db, const ::boost::weak_ptr& r) : p_ (r) { typedef typename object_traits::object_type object_type; @@ -585,18 +585,18 @@ namespace odb } template - template + template inline void lazy_weak_ptr:: - reset (database_type& db, const ID& id) + reset (DB& db, const ID& id) { p_.reset (); i_.reset (db, id); } template - template + template inline void lazy_weak_ptr:: - reset (database_type& db, const ::boost::shared_ptr& r) + reset (DB& db, const ::boost::shared_ptr& r) { typedef typename object_traits::object_type object_type; @@ -609,9 +609,9 @@ namespace odb } template - template + template inline void lazy_weak_ptr:: - reset (database_type& db, const ::boost::weak_ptr& r) + reset (DB& db, const ::boost::weak_ptr& r) { typedef typename object_traits::object_type object_type; -- cgit v1.1