From be97326d67365e16175cc599e23348feaf80e0fe Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 8 Oct 2012 16:09:07 +0200 Subject: 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. --- odb/polymorphic-map.hxx | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'odb/polymorphic-map.hxx') diff --git a/odb/polymorphic-map.hxx b/odb/polymorphic-map.hxx index c3c1374..5d23e6f 100644 --- a/odb/polymorphic-map.hxx +++ b/odb/polymorphic-map.hxx @@ -66,11 +66,11 @@ namespace odb discriminator_map discriminator_map_; }; - template + template struct polymorphic_entry_impl { typedef R root_type; - typedef object_traits root_traits; + typedef object_traits_impl root_traits; typedef polymorphic_concrete_info info_type; static void @@ -103,18 +103,18 @@ namespace odb return r; } - template + template struct dispatch_load { static void call (database& db, T& obj, std::size_t d) { - object_traits::load_ (db, obj, d); + object_traits_impl::load_ (db, obj, d); } }; - template - struct dispatch_load + template + struct dispatch_load { static void call (database&, R&, std::size_t) @@ -123,7 +123,7 @@ namespace odb } }; - template + template struct dispatch_persist { static void @@ -131,23 +131,24 @@ namespace odb { // Top-level call, no dynamic type checking. // - object_traits::persist (db, obj, true, false); + object_traits_impl::persist (db, obj, true, false); } }; - template - struct dispatch_persist + template + struct dispatch_persist { static void call (database& db, const T& obj) { // Top-level call, no dynamic type checking. // - object_traits::persist (db, const_cast (obj), true, false); + object_traits_impl::persist ( + db, const_cast (obj), true, false); } }; - template + template bool dispatch_impl ( typename polymorphic_concrete_info< typename object_traits::root_type>::call_type c, @@ -155,9 +156,9 @@ namespace odb const typename object_traits::root_type* pobj, const void* arg) { - typedef object_traits derived_traits; + typedef object_traits_impl derived_traits; typedef typename derived_traits::root_type root_type; - typedef object_traits root_traits; + typedef object_traits_impl root_traits; typedef typename root_traits::id_type id_type; typedef polymorphic_concrete_info info_type; @@ -175,7 +176,7 @@ namespace odb } case info_type::call_persist: { - dispatch_persist::call ( + dispatch_persist::call ( db, *static_cast (pobj)); break; @@ -208,7 +209,7 @@ namespace odb } case info_type::call_load: { - dispatch_load::call ( + dispatch_load::call ( db, *const_cast (static_cast (pobj)), *static_cast (arg)); -- cgit v1.1