aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/lazy-ptr-impl.hxx30
-rw-r--r--odb/lazy-ptr-impl.ixx117
-rw-r--r--odb/lazy-ptr-impl.txx11
-rw-r--r--odb/lazy-ptr.hxx84
-rw-r--r--odb/lazy-ptr.ixx212
-rw-r--r--odb/tr1/lazy-ptr.hxx36
-rw-r--r--odb/tr1/lazy-ptr.ixx86
7 files changed, 334 insertions, 242 deletions
diff --git a/odb/lazy-ptr-impl.hxx b/odb/lazy-ptr-impl.hxx
index 257cef8..db4d5d6 100644
--- a/odb/lazy-ptr-impl.hxx
+++ b/odb/lazy-ptr-impl.hxx
@@ -21,6 +21,7 @@ namespace odb
{
void* id_;
database* db_;
+ void* loader_;
void (*free_) (void*);
void* (*copy_) (const void*);
};
@@ -57,11 +58,6 @@ namespace odb
void
reset ();
- // Reset the id and set the database to the new value.
- //
- void
- reset (database_type&);
-
// Reset the id.
//
void
@@ -88,7 +84,10 @@ namespace odb
// Makes a copy of id.
//
void
- reset_ (database_type*, const void* id, free_func, copy_func);
+ reset_ (database_type*,
+ void* loader,
+ const void* id,
+ free_func, copy_func);
template <typename T>
static void
@@ -98,9 +97,14 @@ namespace odb
static void*
copy (const void*);
+ template <typename T, typename DB>
+ static typename object_traits<T>::pointer_type
+ loader (database_type&, const typename object_traits<T>::id_type&);
+
protected:
void* id_;
database_type* db_;
+ void* loader_;
private:
free_func free_;
@@ -113,8 +117,8 @@ namespace odb
public:
lazy_ptr_impl ();
- template <typename ID>
- lazy_ptr_impl (database_type&, const ID&);
+ template <typename DB, typename ID>
+ lazy_ptr_impl (DB&, const ID&);
lazy_ptr_impl (const lazy_ptr_impl&);
@@ -154,9 +158,15 @@ namespace odb
using lazy_ptr_base::reset;
using lazy_ptr_base::reset_id;
- template <typename ID>
+ template <typename DB, typename ID>
+ void
+ reset (DB&, const ID&);
+
+ // Reset the id and set the database to the new value.
+ //
+ template <typename DB>
void
- reset (database_type&, const ID&);
+ reset_db (DB&);
template <typename ID>
void
diff --git a/odb/lazy-ptr-impl.ixx b/odb/lazy-ptr-impl.ixx
index cd49682..7cfa420 100644
--- a/odb/lazy-ptr-impl.ixx
+++ b/odb/lazy-ptr-impl.ixx
@@ -10,13 +10,14 @@ namespace odb
inline lazy_ptr_base::
lazy_ptr_base ()
- : id_ (0), db_ (0)
+ : id_ (0), db_ (0), loader_ (0)
{
}
inline lazy_ptr_base::
lazy_ptr_base (const lazy_ptr_base& r)
- : id_ (0), db_ (r.db_), free_ (r.free_), copy_ (r.copy_)
+ : id_ (0), db_ (r.db_), loader_ (r.loader_),
+ free_ (r.free_), copy_ (r.copy_)
{
if (r.id_)
id_ = copy_ (r.id_);
@@ -24,14 +25,16 @@ namespace odb
inline lazy_ptr_base::
lazy_ptr_base (const lazy_ptr_impl_ref& r)
- : id_ (r.id_), db_ (r.db_), free_ (r.free_), copy_ (r.copy_)
+ : id_ (r.id_), db_ (r.db_), loader_ (r.loader_),
+ free_ (r.free_), copy_ (r.copy_)
{
}
#ifdef ODB_CXX11
inline lazy_ptr_base::
lazy_ptr_base (lazy_ptr_base&& r)
- : id_ (r.id_), db_ (r.db_), free_ (r.free_), copy_ (r.copy_)
+ : id_ (r.id_), db_ (r.db_), loader_ (r.loader_),
+ free_ (r.free_), copy_ (r.copy_)
{
r.id_ = 0;
}
@@ -44,6 +47,7 @@ namespace odb
reset_id ();
id_ = r.id_;
db_ = r.db_;
+ loader_ = r.loader_;
free_ = r.free_;
copy_ = r.copy_;
@@ -55,16 +59,11 @@ namespace odb
#endif
inline void lazy_ptr_base::
- reset_id ()
- {
- if (id_)
- free_ (id_);
-
- id_ = 0;
- }
-
- inline void lazy_ptr_base::
- reset_ (database_type* db, const void* id, free_func free, copy_func copy)
+ reset_ (database_type* db,
+ void* loader,
+ const void* id,
+ free_func free,
+ copy_func copy)
{
void* idc (id ? copy (id) : 0);
@@ -76,6 +75,7 @@ namespace odb
id_ = idc;
db_ = db;
+ loader_ = loader;
}
inline void lazy_ptr_base::
@@ -83,22 +83,28 @@ namespace odb
{
reset_id ();
db_ = 0;
+ loader_ = 0;
}
inline void lazy_ptr_base::
- reset (database_type& db)
+ reset_id ()
{
- reset_id ();
- db_ = &db;
+ if (id_)
+ free_ (id_);
+
+ id_ = 0;
}
inline lazy_ptr_base& lazy_ptr_base::
operator= (const lazy_ptr_base& r)
{
if (id_ != r.id_)
- reset_ (r.db_, r.id_, r.free_, r.copy_);
+ reset_ (r.db_, r.loader_, r.id_, r.free_, r.copy_);
else
+ {
db_ = r.db_;
+ loader_ = r.loader_;
+ }
return *this;
}
@@ -115,6 +121,7 @@ namespace odb
}
db_ = r.db_;
+ loader_ = r.loader_;
return *this;
}
@@ -130,16 +137,19 @@ namespace odb
{
void* id (id_);
database_type* db (db_);
+ void* l (loader_);
free_func f (free_);
copy_func c (copy_);
id_ = r.id_;
db_ = r.db_;
+ loader_ = r.loader_;
free_ = r.free_;
copy_ = r.copy_;
r.id_ = id;
r.db_ = db;
+ r.loader_ = l;
r.free_ = f;
r.copy_ = c;
}
@@ -156,10 +166,12 @@ namespace odb
lazy_ptr_impl_ref r;
r.id_ = id_;
r.db_ = db_;
+ r.loader_ = loader_;
r.free_ = free_;
r.copy_ = copy_;
id_ = 0;
db_ = 0;
+ loader_ = 0;
return r;
}
@@ -174,11 +186,13 @@ namespace odb
}
template <typename T>
- template <typename ID>
+ template <typename DB, typename ID>
inline lazy_ptr_impl<T>::
- lazy_ptr_impl (database_type& db, const ID& id)
+ lazy_ptr_impl (DB& db, const ID& id)
{
typedef typename object_traits<T>::id_type id_type;
+ typedef typename object_traits<T>::pointer_type pointer_type;
+ typedef pointer_type (*loader_type) (database_type&, const id_type&);
// Make sure that ID and T's object id types are the same
// (or implicit-convertible). If you get a compile error
@@ -187,7 +201,21 @@ namespace odb
//
const id_type& r (id);
- reset_ (&db, &r, &free<id_type>, &copy<id_type>);
+ // Compiler error pointing here? Perhaps db is not an
+ // odb::<database>::database instance?
+ //
+ database_type& bdb (db);
+
+ // For some reason GCC needs this statically-typed pointer in
+ // order to instantiate the functions.
+ //
+ loader_type ldr (&loader<T, DB>);
+
+ reset_ (&bdb,
+ reinterpret_cast<void*> (ldr),
+ &r,
+ &free<id_type>,
+ &copy<id_type>);
}
template <typename T>
@@ -277,11 +305,13 @@ namespace odb
#endif
template <typename T>
- template <typename ID>
+ template <typename DB, typename ID>
inline void lazy_ptr_impl<T>::
- reset (database_type& db, const ID& id)
+ reset (DB& db, const ID& id)
{
typedef typename object_traits<T>::id_type id_type;
+ typedef typename object_traits<T>::pointer_type pointer_type;
+ typedef pointer_type (*loader_type) (database_type&, const id_type&);
// Make sure that ID and T's object id types are the same
// (or implicit-convertible). If you get a compile error
@@ -290,7 +320,44 @@ namespace odb
//
const id_type& r (id);
- reset_ (&db, &r, &free<id_type>, &copy<id_type>);
+ // Compiler error pointing here? Perhaps db is not an
+ // odb::<database>::database instance?
+ //
+ database_type& bdb (db);
+
+ // For some reason GCC needs this statically-typed pointer in
+ // order to instantiate the functions.
+ //
+ loader_type ldr (&loader<T, DB>);
+
+ reset_ (&bdb,
+ reinterpret_cast<void*> (ldr),
+ &r,
+ &free<id_type>,
+ &copy<id_type>);
+ }
+
+ template <typename T>
+ template <typename DB>
+ inline void lazy_ptr_impl<T>::
+ reset_db (DB& db)
+ {
+ typedef typename object_traits<T>::id_type id_type;
+ typedef typename object_traits<T>::pointer_type pointer_type;
+ typedef pointer_type (*loader_type) (database_type&, const id_type&);
+
+ reset_id ();
+
+ // Compiler error pointing here? Perhaps db is not an
+ // odb::<database>::database instance?
+ //
+ db_ = &db;
+
+ // For some reason GCC needs this statically-typed pointer in
+ // order to instantiate the functions.
+ //
+ loader_type ldr (&loader<T, DB>);
+ loader_ = reinterpret_cast<void*> (ldr);
}
template <typename T>
@@ -307,7 +374,7 @@ namespace odb
//
const id_type& r (id);
- reset_ (db_, &r, &free<id_type>, &copy<id_type>);
+ reset_ (db_, loader_, &r, &free<id_type>, &copy<id_type>);
}
template <typename T>
diff --git a/odb/lazy-ptr-impl.txx b/odb/lazy-ptr-impl.txx
index 91d51d9..c14f349 100644
--- a/odb/lazy-ptr-impl.txx
+++ b/odb/lazy-ptr-impl.txx
@@ -24,6 +24,13 @@ namespace odb
return new T (*static_cast<const T*> (p));
}
+ template <typename T, typename DB>
+ typename object_traits<T>::pointer_type lazy_ptr_base::
+ loader (database_type& db, const typename object_traits<T>::id_type& id)
+ {
+ return static_cast<DB&> (db).template load<T> (id);
+ }
+
//
// lazy_ptr_impl
//
@@ -35,9 +42,11 @@ namespace odb
{
typedef typename object_traits<T>::id_type id_type;
typedef typename object_traits<T>::pointer_type pointer_type;
+ typedef pointer_type (*loader_type) (database_type&, const id_type&);
+ loader_type loader (reinterpret_cast<loader_type> (loader_));
const id_type& id (*static_cast<const id_type*> (id_));
- pointer_type p (db_->load<T> (id));
+ pointer_type p (loader (*db_, id));
if (reset)
reset_id ();
diff --git a/odb/lazy-ptr.hxx b/odb/lazy-ptr.hxx
index 12acbb6..8df47b9 100644
--- a/odb/lazy-ptr.hxx
+++ b/odb/lazy-ptr.hxx
@@ -72,11 +72,11 @@ namespace odb
//
void unload () const;
- template <class ID> lazy_ptr (database_type&, const ID&);
- template <class Y> lazy_ptr (database_type&, Y*);
+ template <class DB, class ID> lazy_ptr (DB&, const ID&);
+ template <class DB, class Y> lazy_ptr (DB&, Y*);
- template <class ID> void reset (database_type&, const ID&);
- template <class Y> void reset (database_type&, Y*);
+ template <class DB, class ID> void reset (DB&, const ID&);
+ template <class DB, class Y> void reset (DB&, Y*);
#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
template <class O = T>
@@ -185,13 +185,13 @@ namespace odb
//
void unload () const;
- template <class ID> lazy_auto_ptr (database_type&, const ID&);
- lazy_auto_ptr (database_type&, T*);
- template <class Y> lazy_auto_ptr (database_type&, std::auto_ptr<Y>&);
+ template <class DB, class ID> lazy_auto_ptr (DB&, const ID&);
+ template <class DB> lazy_auto_ptr (DB&, T*);
+ template <class DB, class Y> lazy_auto_ptr (DB&, std::auto_ptr<Y>&);
- template <class ID> void reset (database_type&, const ID&);
- void reset (database_type&, T*);
- template <class Y> void reset (database_type&, std::auto_ptr<Y>&);
+ template <class DB, class ID> void reset (DB&, const ID&);
+ template <class DB> void reset (DB&, T*);
+ template <class DB, class Y> void reset (DB&, std::auto_ptr<Y>&);
#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
template <class O = T>
@@ -305,17 +305,17 @@ namespace odb
//
void unload () const;
- template <class ID> lazy_unique_ptr (database_type&, const ID&);
- lazy_unique_ptr (database_type&, pointer);
- lazy_unique_ptr (database_type&, pointer, const deleter_type&);
- lazy_unique_ptr (database_type&, pointer, deleter_type&&);
- template <class T1, class D1> lazy_unique_ptr (database_type&, std::unique_ptr<T1, D1>&&);
- template <class T1> lazy_unique_ptr (database_type&, std::auto_ptr<T1>&&);
+ template <class DB, class ID> lazy_unique_ptr (DB&, const ID&);
+ template <class DB> lazy_unique_ptr (DB&, pointer);
+ template <class DB> lazy_unique_ptr (DB&, pointer, const deleter_type&);
+ template <class DB> lazy_unique_ptr (DB&, pointer, deleter_type&&);
+ template <class DB, class T1, class D1> lazy_unique_ptr (DB&, std::unique_ptr<T1, D1>&&);
+ template <class DB, class T1> lazy_unique_ptr (DB&, std::auto_ptr<T1>&&);
- template <class ID> void reset (database_type&, const ID&);
- void reset (database_type&, pointer);
- template <class T1, class D1> void reset (database_type&, std::unique_ptr<T1, D1>&&);
- template <class T1> void reset (database_type&, std::auto_ptr<T1>&&);
+ template <class DB, class ID> void reset (DB&, const ID&);
+ template <class DB> void reset (DB&, pointer);
+ template <class DB, class T1, class D1> void reset (DB&, std::unique_ptr<T1, D1>&&);
+ template <class DB, class T1> void reset (DB&, std::auto_ptr<T1>&&);
#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
template <class O = T>
@@ -464,22 +464,22 @@ 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 std::shared_ptr<Y>&);
- template <class Y> lazy_shared_ptr (database_type&, std::shared_ptr<Y>&&);
- template <class Y> lazy_shared_ptr (database_type&, const std::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 std::shared_ptr<Y>&);
- template <class Y> void reset (database_type&, std::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 std::shared_ptr<Y>&);
+ template <class DB, class Y> lazy_shared_ptr (DB&, std::shared_ptr<Y>&&);
+ template <class DB, class Y> lazy_shared_ptr (DB&, const std::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 std::shared_ptr<Y>&);
+ template <class DB, class Y> void reset (DB&, std::shared_ptr<Y>&&);
#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
template <class O = T>
@@ -593,13 +593,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 std::shared_ptr<Y>&);
- template <class Y> lazy_weak_ptr (database_type&, const std::weak_ptr<Y>&);
+ template <class DB, class ID> lazy_weak_ptr (DB&, const ID&);
+ template <class DB, class Y> lazy_weak_ptr (DB&, const std::shared_ptr<Y>&);
+ template <class DB, class Y> lazy_weak_ptr (DB&, const std::weak_ptr<Y>&);
- template <class ID> void reset (database_type&, const ID&);
- template <class Y> void reset (database_type&, const std::shared_ptr<Y>&);
- template <class Y> void reset (database_type&, const std::weak_ptr<Y>&);
+ template <class DB, class ID> void reset (DB&, const ID&);
+ template <class DB, class Y> void reset (DB&, const std::shared_ptr<Y>&);
+ template <class DB, class Y> void reset (DB&, const std::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/lazy-ptr.ixx b/odb/lazy-ptr.ixx
index 08f3e5e..3318633 100644
--- a/odb/lazy-ptr.ixx
+++ b/odb/lazy-ptr.ixx
@@ -137,38 +137,38 @@ namespace odb
}
template <class T>
- template <class ID>
+ template <class DB, class ID>
inline lazy_ptr<T>::
- lazy_ptr (database_type& db, const ID& id): p_ (0), i_ (db, id) {}
+ lazy_ptr (DB& db, const ID& id): p_ (0), i_ (db, id) {}
template <class T>
- template <class Y>
+ template <class DB, class Y>
inline lazy_ptr<T>::
- lazy_ptr (database_type& db, Y* r)
+ lazy_ptr (DB& db, 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_ptr<T>::
- reset (database_type& db, const ID& id)
+ reset (DB& db, const ID& id)
{
p_ = 0;
i_.reset (db, id);
}
template <class T>
- template <class Y>
+ template <class DB, class Y>
inline void lazy_ptr<T>::
- reset (database_type& db, Y* r)
+ reset (DB& db, Y* r)
{
p_ = r;
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
else
i_.reset ();
}
@@ -396,59 +396,61 @@ namespace odb
}
template <class T>
- template <class ID>
+ template <class DB, class ID>
inline lazy_auto_ptr<T>::
- lazy_auto_ptr (database_type& db, const ID& id): i_ (db, id) {}
+ lazy_auto_ptr (DB& db, const ID& id): i_ (db, id) {}
template <class T>
+ template <class DB>
inline lazy_auto_ptr<T>::
- lazy_auto_ptr (database_type& db, T* p)
+ lazy_auto_ptr (DB& db, T* p)
: p_ (p)
{
if (p)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T>
- template <class Y>
+ template <class DB, class Y>
inline lazy_auto_ptr<T>::
- lazy_auto_ptr (database_type& db, std::auto_ptr<Y>& p)
+ lazy_auto_ptr (DB& db, std::auto_ptr<Y>& p)
: p_ (p)
{
if (p_.get () != 0)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T>
- template <class ID>
+ template <class DB, class ID>
inline void lazy_auto_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 DB>
inline void lazy_auto_ptr<T>::
- reset (database_type& db, T* p)
+ reset (DB& db, T* p)
{
p_.reset (p);
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_auto_ptr<T>::
- reset (database_type& db, std::auto_ptr<Y>& p)
+ reset (DB& db, std::auto_ptr<Y>& p)
{
p_ = p;
if (p_.get () != 0)
- i_.reset (db);
+ i_.reset_db (db);
else
i_.reset ();
}
@@ -665,100 +667,104 @@ namespace odb
}
template <class T, class D>
- template <class ID>
+ template <class DB, class ID>
inline lazy_unique_ptr<T, D>::
- lazy_unique_ptr (database_type& db, const ID& id): i_ (db, id) {}
+ lazy_unique_ptr (DB& db, const ID& id): i_ (db, id) {}
template <class T, class D>
+ template <class DB>
inline lazy_unique_ptr<T, D>::
- lazy_unique_ptr (database_type& db, T* p)
+ lazy_unique_ptr (DB& db, T* p)
: p_ (p)
{
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T, class D>
+ template <class DB>
inline lazy_unique_ptr<T, D>::
- lazy_unique_ptr (database_type& db, T* p, const deleter_type& d)
+ lazy_unique_ptr (DB& db, T* p, const deleter_type& d)
: p_ (p, d)
{
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T, class D>
+ template <class DB>
inline lazy_unique_ptr<T, D>::
- lazy_unique_ptr (database_type& db, T* p, deleter_type&& d)
+ lazy_unique_ptr (DB& db, T* p, deleter_type&& d)
: p_ (p, std::move (d))
{
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T, class D>
- template <class T1, class D1>
+ template <class DB, class T1, class D1>
inline lazy_unique_ptr<T, D>::
- lazy_unique_ptr (database_type& db, std::unique_ptr<T1, D1>&& p)
+ lazy_unique_ptr (DB& db, std::unique_ptr<T1, D1>&& p)
: p_ (std::move (p))
{
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T, class D>
- template <class T1>
+ template <class DB, class T1>
inline lazy_unique_ptr<T, D>::
- lazy_unique_ptr (database_type& db, std::auto_ptr<T1>&& p)
+ lazy_unique_ptr (DB& db, std::auto_ptr<T1>&& p)
: p_ (std::move (p))
{
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
}
template <class T, class D>
- template <class ID>
+ template <class DB, class ID>
inline void lazy_unique_ptr<T, D>::
- reset (database_type& db, const ID& id)
+ reset (DB& db, const ID& id)
{
p_.reset ();
i_.reset (db, id);
}
template <class T, class D>
+ template <class DB>
inline void lazy_unique_ptr<T, D>::
- reset (database_type& db, T* p)
+ reset (DB& db, T* p)
{
p_.reset (p);
if (p)
- i_.reset (db);
+ i_.reset_db (db);
else
i_.reset ();
}
template <class T, class D>
- template <class T1, class D1>
+ template <class DB, class T1, class D1>
inline void lazy_unique_ptr<T, D>::
- reset (database_type& db, std::unique_ptr<T1, D1>&& p)
+ reset (DB& db, std::unique_ptr<T1, D1>&& p)
{
p_ = std::move (p);
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
else
i_.reset ();
}
template <class T, class D>
- template <class T1>
+ template <class DB, class T1>
inline void lazy_unique_ptr<T, D>::
- reset (database_type& db, std::auto_ptr<T1>&& p)
+ reset (DB& db, std::auto_ptr<T1>&& p)
{
p_ = std::unique_ptr<T, D> (std::move (p));
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
else
i_.reset ();
}
@@ -1144,163 +1150,163 @@ 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_ (std::move (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 std::shared_ptr<Y>& r)
+ lazy_shared_ptr (DB& db, const std::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, std::shared_ptr<Y>&& r)
+ lazy_shared_ptr (DB& db, std::shared_ptr<Y>&& r)
: p_ (std::move (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 std::weak_ptr<Y>& r)
+ lazy_shared_ptr (DB& db, const std::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_ = std::move (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 std::shared_ptr<Y>& r)
+ reset (DB& db, const std::shared_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, std::shared_ptr<Y>&& r)
+ reset (DB& db, std::shared_ptr<Y>&& r)
{
p_ = std::move (r);
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
else
i_.reset ();
}
@@ -1529,14 +1535,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 std::shared_ptr<Y>& r)
+ lazy_weak_ptr (DB& db, const std::shared_ptr<Y>& r)
: p_ (r)
{
typedef typename object_traits<T>::object_type object_type;
@@ -1546,9 +1552,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 std::weak_ptr<Y>& r)
+ lazy_weak_ptr (DB& db, const std::weak_ptr<Y>& r)
: p_ (r)
{
typedef typename object_traits<T>::object_type object_type;
@@ -1560,18 +1566,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 std::shared_ptr<Y>& r)
+ reset (DB& db, const std::shared_ptr<Y>& r)
{
typedef typename object_traits<T>::object_type object_type;
@@ -1584,9 +1590,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 std::weak_ptr<Y>& r)
+ reset (DB& db, const std::weak_ptr<Y>& r)
{
typedef typename object_traits<T>::object_type object_type;
diff --git a/odb/tr1/lazy-ptr.hxx b/odb/tr1/lazy-ptr.hxx
index 01a7b36..85b43bf 100644
--- a/odb/tr1/lazy-ptr.hxx
+++ b/odb/tr1/lazy-ptr.hxx
@@ -98,18 +98,18 @@ 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> lazy_shared_ptr (database_type&, std::auto_ptr<Y>&);
- template <class Y> lazy_shared_ptr (database_type&, const std::tr1::shared_ptr<Y>&);
- template <class Y> lazy_shared_ptr (database_type&, const std::tr1::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> void reset (database_type&, std::auto_ptr<Y>&);
- template <class Y> void reset (database_type&, const std::tr1::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> lazy_shared_ptr (DB&, std::auto_ptr<Y>&);
+ template <class DB, class Y> lazy_shared_ptr (DB&, const std::tr1::shared_ptr<Y>&);
+ template <class DB, class Y> lazy_shared_ptr (DB&, const std::tr1::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> void reset (DB&, std::auto_ptr<Y>&);
+ template <class DB, class Y> void reset (DB&, const std::tr1::shared_ptr<Y>&);
#ifdef ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT
template <class O = T>
@@ -207,13 +207,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 std::tr1::shared_ptr<Y>&);
- template <class Y> lazy_weak_ptr (database_type&, const std::tr1::weak_ptr<Y>&);
+ template <class DB, class ID> lazy_weak_ptr (DB&, const ID&);
+ template <class DB, class Y> lazy_weak_ptr (DB&, const std::tr1::shared_ptr<Y>&);
+ template <class DB, class Y> lazy_weak_ptr (DB&, const std::tr1::weak_ptr<Y>&);
- template <class ID> void reset (database_type&, const ID&);
- template <class Y> void reset (database_type&, const std::tr1::shared_ptr<Y>&);
- template <class Y> void reset (database_type&, const std::tr1::weak_ptr<Y>&);
+ template <class DB, class ID> void reset (DB&, const ID&);
+ template <class DB, class Y> void reset (DB&, const std::tr1::shared_ptr<Y>&);
+ template <class DB, class Y> void reset (DB&, const std::tr1::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/tr1/lazy-ptr.ixx b/odb/tr1/lazy-ptr.ixx
index a29eaad..ad2d659 100644
--- a/odb/tr1/lazy-ptr.ixx
+++ b/odb/tr1/lazy-ptr.ixx
@@ -207,117 +207,117 @@ 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>
+ 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 std::tr1::shared_ptr<Y>& r)
+ lazy_shared_ptr (DB& db, const std::tr1::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 std::tr1::weak_ptr<Y>& r)
+ lazy_shared_ptr (DB& db, const std::tr1::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>
+ 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 std::tr1::shared_ptr<Y>& r)
+ reset (DB& db, const std::tr1::shared_ptr<Y>& r)
{
p_ = r;
if (p_)
- i_.reset (db);
+ i_.reset_db (db);
else
i_.reset ();
}
@@ -517,14 +517,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 std::tr1::shared_ptr<Y>& r)
+ lazy_weak_ptr (DB& db, const std::tr1::shared_ptr<Y>& r)
: p_ (r)
{
typedef typename object_traits<T>::object_type object_type;
@@ -534,9 +534,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 std::tr1::weak_ptr<Y>& r)
+ lazy_weak_ptr (DB& db, const std::tr1::weak_ptr<Y>& r)
: p_ (r)
{
typedef typename object_traits<T>::object_type object_type;
@@ -548,18 +548,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 std::tr1::shared_ptr<Y>& r)
+ reset (DB& db, const std::tr1::shared_ptr<Y>& r)
{
typedef typename object_traits<T>::object_type object_type;
@@ -572,9 +572,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 std::tr1::weak_ptr<Y>& r)
+ reset (DB& db, const std::tr1::weak_ptr<Y>& r)
{
typedef typename object_traits<T>::object_type object_type;