From 40267e1f40de8ea216688886ab1df1c7ec50e2b2 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 23 Apr 2012 16:48:02 +0200 Subject: Polymorphic inheritance support --- odb/pgsql/statement-cache.hxx | 45 ++++++++----------------------------------- 1 file changed, 8 insertions(+), 37 deletions(-) (limited to 'odb/pgsql/statement-cache.hxx') diff --git a/odb/pgsql/statement-cache.hxx b/odb/pgsql/statement-cache.hxx index dc9d171..90bc2f6 100644 --- a/odb/pgsql/statement-cache.hxx +++ b/odb/pgsql/statement-cache.hxx @@ -11,14 +11,14 @@ #include #include +#include #include #include #include +#include #include -#include -#include #include @@ -26,49 +26,18 @@ namespace odb { namespace pgsql { - class connection; - class LIBODB_PGSQL_EXPORT statement_cache { public: - statement_cache (connection& conn) - : conn_ (conn) - { - } + statement_cache (connection& conn): conn_ (conn) {} template - typename object_statements_selector::type& - find_object () - { - typedef typename object_statements_selector::type object_statements; - - map::iterator i (map_.find (&typeid (T))); - - if (i != map_.end ()) - return static_cast (*i->second); - - details::shared_ptr p ( - new (details::shared) object_statements (conn_)); - - map_.insert (map::value_type (&typeid (T), p)); - return *p; - } + typename object_traits::statements_type& + find_object (); template view_statements& - find_view () - { - map::iterator i (map_.find (&typeid (T))); - - if (i != map_.end ()) - return static_cast&> (*i->second); - - details::shared_ptr > p ( - new (details::shared) view_statements (conn_)); - - map_.insert (map::value_type (&typeid (T), p)); - return *p; - } + find_view (); private: typedef std::map + #include #endif // ODB_PGSQL_STATEMENT_CACHE_HXX -- cgit v1.1