aboutsummaryrefslogtreecommitdiff
path: root/odb/traits.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-08 16:09:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-08 16:09:07 +0200
commitbe97326d67365e16175cc599e23348feaf80e0fe (patch)
treeb38678104546ebd549824096683bd00f3f2be299 /odb/traits.hxx
parent0b583b575ec00c544759cbf8d6481d35c34c5f63 (diff)
Ground work for multi-database support
All generated code now includes database id. The database-specific database class interface has been updated to include all the database operations. The database-specific tests now use this interface.
Diffstat (limited to 'odb/traits.hxx')
-rw-r--r--odb/traits.hxx77
1 files changed, 57 insertions, 20 deletions
diff --git a/odb/traits.hxx b/odb/traits.hxx
index 0743dba..3711601 100644
--- a/odb/traits.hxx
+++ b/odb/traits.hxx
@@ -99,17 +99,16 @@ namespace odb
//
template <typename T>
+ //
+ // If a C++ compiler issues an error pointing to this struct and
+ // saying that it is incomplete, then you are most likely trying to
+ // perform a database operation on a C++ type that is not a persistent
+ // object. Or you forgot to include the corresponding -odb.hxx file.
+ //
struct object_traits:
access::object_traits<T>,
access::object_factory<T, typename access::object_traits<T>::pointer_type>
{
- //
- // If a C++ compiler issues an error pointing to this struct and
- // saying that it is incomplete, then you are most likely trying to
- // perform a database operation on a C++ type that is not a persistent
- // object. Or you forgot to include the corresponding -odb.hxx file.
- //
-
typedef
odb::pointer_traits<typename access::object_traits<T>::pointer_type>
pointer_traits;
@@ -160,45 +159,64 @@ namespace odb
};
template <typename T, template <typename> class P>
- struct object_traits< P<T> >
+ struct object_traits<P<T> >
{
struct id_type {};
};
template <typename T, typename A1, template <typename, typename> class P>
- struct object_traits< P<T, A1> >
+ struct object_traits<P<T, A1> >
{
struct id_type {};
};
template <typename T, template <typename> class P>
- struct object_traits< const P<T> >
+ struct object_traits<const P<T> >
{
struct id_type {};
};
template <typename T, typename A1, template <typename, typename> class P>
- struct object_traits< const P<T, A1> >
+ struct object_traits<const P<T, A1> >
{
struct id_type {};
};
+ template <typename T, database_id DB>
+ //
+ // If a C++ compiler issues an error pointing to this struct and
+ // saying that it is incomplete, then you are most likely trying to
+ // perform a database operation on a C++ type that is not a persistent
+ // object. Or you forgot to include the corresponding -odb.hxx file.
+ //
+ struct object_traits_impl:
+ access::object_traits_impl<T, DB>,
+ access::object_factory<T, typename access::object_traits<T>::pointer_type>
+ {
+ typedef
+ odb::pointer_traits<typename access::object_traits<T>::pointer_type>
+ pointer_traits;
+
+ typedef typename access::object_traits<T>::object_type object_type;
+ typedef typename access::object_traits<T>::pointer_type pointer_type;
+ typedef typename pointer_traits::const_pointer_type const_pointer_type;
+ };
+
//
// view_traits
//
template <typename T>
+ //
+ // If a C++ compiler issues an error pointing to this struct and
+ // saying that it is incomplete, then you are most likely trying to
+ // perform a database operation on a C++ type that is not a view
+ // Or you forgot to include the corresponding -odb.hxx file.
+ //
struct view_traits:
access::view_traits<T>,
access::view_factory<T, typename access::view_traits<T>::pointer_type>
{
- //
- // If a C++ compiler issues an error pointing to this struct and
- // saying that it is incomplete, then you are most likely trying to
- // perform a database operation on a C++ type that is not a view
- // Or you forgot to include the corresponding -odb.hxx file.
- //
-
typedef
odb::pointer_traits<typename access::view_traits<T>::pointer_type>
pointer_traits;
@@ -227,12 +245,31 @@ namespace odb
typedef const_pointer_type pointer_type;
};
+ template <typename T, database_id DB>
+ //
+ // If a C++ compiler issues an error pointing to this struct and
+ // saying that it is incomplete, then you are most likely trying to
+ // perform a database operation on a C++ type that is not a view
+ // Or you forgot to include the corresponding -odb.hxx file.
+ //
+ struct view_traits_impl:
+ access::view_traits_impl<T, DB>,
+ access::view_factory<T, typename access::view_traits<T>::pointer_type>
+ {
+ typedef
+ odb::pointer_traits<typename access::view_traits<T>::pointer_type>
+ pointer_traits;
+
+ typedef typename access::view_traits<T>::view_type view_type;
+ typedef typename access::view_traits<T>::pointer_type pointer_type;
+ };
+
//
// composite_value_traits
//
- template <typename T>
- struct composite_value_traits: access::composite_value_traits<T>
+ template <typename T, database_id DB>
+ struct composite_value_traits: access::composite_value_traits<T, DB>
{
};
}