From 4c8de7a0e8fa65d60b4b54d525c0b5ba43ac265a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 18 Aug 2010 20:03:19 +0200 Subject: Move shared_ptr to the details namespace --- odb/mysql/connection-factory.hxx | 11 +++++------ odb/mysql/connection.hxx | 5 +++-- odb/mysql/database.hxx | 5 +++-- odb/mysql/database.ixx | 2 +- odb/mysql/query.cxx | 2 +- odb/mysql/query.hxx | 8 ++++---- odb/mysql/query.ixx | 8 ++++---- odb/mysql/result.hxx | 7 ++++--- odb/mysql/result.txx | 2 +- odb/mysql/statement.hxx | 29 +++++++++++++++-------------- odb/mysql/transaction-impl.hxx | 5 +++-- 11 files changed, 44 insertions(+), 40 deletions(-) diff --git a/odb/mysql/connection-factory.hxx b/odb/mysql/connection-factory.hxx index 50072b2..4d57d75 100644 --- a/odb/mysql/connection-factory.hxx +++ b/odb/mysql/connection-factory.hxx @@ -9,14 +9,13 @@ #include #include // std::size_t -#include - #include #include #include #include #include +#include namespace odb { @@ -25,7 +24,7 @@ namespace odb class connection_factory { public: - virtual shared_ptr + virtual details::shared_ptr connect () = 0; public: @@ -46,7 +45,7 @@ namespace odb { } - virtual shared_ptr + virtual details::shared_ptr connect (); virtual void @@ -88,7 +87,7 @@ namespace odb // @@ check min_ <= max_ } - virtual shared_ptr + virtual details::shared_ptr connect (); virtual void @@ -121,7 +120,7 @@ namespace odb }; friend class pooled_connection; - typedef std::vector > connections; + typedef std::vector > connections; private: void diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx index 8509790..cc5e5f0 100644 --- a/odb/mysql/connection.hxx +++ b/odb/mysql/connection.hxx @@ -11,16 +11,17 @@ #include #include -#include #include #include +#include + namespace odb { namespace mysql { - class connection: public shared_base + class connection: public details::shared_base { public: typedef mysql::statement_cache statement_cache_type; diff --git a/odb/mysql/database.hxx b/odb/mysql/database.hxx index fe9ed05..3272eda 100644 --- a/odb/mysql/database.hxx +++ b/odb/mysql/database.hxx @@ -11,7 +11,6 @@ #include #include // std::auto_ptr -#include #include #include @@ -20,6 +19,8 @@ #include #include +#include + namespace odb { namespace mysql @@ -131,7 +132,7 @@ namespace odb begin_transaction (); public: - shared_ptr + details::shared_ptr connection (); public: diff --git a/odb/mysql/database.ixx b/odb/mysql/database.ixx index 8d927b5..654b8f9 100644 --- a/odb/mysql/database.ixx +++ b/odb/mysql/database.ixx @@ -7,7 +7,7 @@ namespace odb { namespace mysql { - inline shared_ptr database:: + inline details::shared_ptr database:: connection () { return factory_->connect (); diff --git a/odb/mysql/query.cxx b/odb/mysql/query.cxx index 0caa214..3d7fb68 100644 --- a/odb/mysql/query.cxx +++ b/odb/mysql/query.cxx @@ -61,7 +61,7 @@ namespace odb } void query:: - add (shared_ptr p) + add (details::shared_ptr p) { size_t n (clause_.size ()); diff --git a/odb/mysql/query.hxx b/odb/mysql/query.hxx index dd7e0cb..b09442c 100644 --- a/odb/mysql/query.hxx +++ b/odb/mysql/query.hxx @@ -13,13 +13,13 @@ #include // std::size_t #include -#include #include #include #include #include +#include namespace odb { @@ -45,7 +45,7 @@ namespace odb const T& ref; }; - struct query_param: shared_base + struct query_param: details::shared_base { virtual ~query_param (); @@ -177,10 +177,10 @@ namespace odb private: void - add (shared_ptr); + add (details::shared_ptr); private: - typedef std::vector > parameters_type; + typedef std::vector > parameters_type; std::string clause_; parameters_type parameters_; diff --git a/odb/mysql/query.ixx b/odb/mysql/query.ixx index 9562bd1..ca4c60c 100644 --- a/odb/mysql/query.ixx +++ b/odb/mysql/query.ixx @@ -12,8 +12,8 @@ namespace odb append (val_bind v) { add ( - shared_ptr ( - new (shared) query_param_impl (v))); + details::shared_ptr ( + new (details::shared) query_param_impl (v))); } template @@ -21,8 +21,8 @@ namespace odb append (ref_bind r) { add ( - shared_ptr ( - new (shared) query_param_impl (r))); + details::shared_ptr ( + new (details::shared) query_param_impl (r))); } } } diff --git a/odb/mysql/result.hxx b/odb/mysql/result.hxx index 6153f59..f800f15 100644 --- a/odb/mysql/result.hxx +++ b/odb/mysql/result.hxx @@ -7,12 +7,13 @@ #define ODB_MYSQL_RESULT_HXX #include -#include #include #include #include +#include + namespace odb { namespace mysql @@ -28,7 +29,7 @@ namespace odb virtual ~result_impl (); - result_impl (shared_ptr statement, + result_impl (details::shared_ptr statement, object_statements& statements); virtual void @@ -43,7 +44,7 @@ namespace odb using odb::result_impl::current; private: - shared_ptr statement_; + details::shared_ptr statement_; object_statements& statements_; }; } diff --git a/odb/mysql/result.txx b/odb/mysql/result.txx index d81f058..9bbdf26 100644 --- a/odb/mysql/result.txx +++ b/odb/mysql/result.txx @@ -15,7 +15,7 @@ namespace odb template result_impl:: - result_impl (shared_ptr statement, + result_impl (details::shared_ptr statement, object_statements& statements) : statement_ (statement), statements_ (statements) { diff --git a/odb/mysql/statement.hxx b/odb/mysql/statement.hxx index 3dd4c28..342897c 100644 --- a/odb/mysql/statement.hxx +++ b/odb/mysql/statement.hxx @@ -15,10 +15,11 @@ #include #include -#include #include +#include + namespace odb { namespace mysql @@ -42,7 +43,7 @@ namespace odb binding& operator= (const binding&); }; - class statement: public shared_base + class statement: public details::shared_base { public: virtual @@ -221,7 +222,7 @@ namespace odb // Statement cache. // - class object_statements_base: public shared_base + class object_statements_base: public details::shared_base { public: virtual @@ -287,7 +288,7 @@ namespace odb { if (persist_ == 0) persist_.reset ( - new (shared) persist_statement_type ( + new (details::shared) persist_statement_type ( conn_, object_traits::persist_statement, image_binding_)); return *persist_; @@ -298,7 +299,7 @@ namespace odb { if (find_ == 0) find_.reset ( - new (shared) find_statement_type ( + new (details::shared) find_statement_type ( conn_, object_traits::find_statement, id_image_binding_, @@ -312,7 +313,7 @@ namespace odb { if (store_ == 0) store_.reset ( - new (shared) store_statement_type ( + new (details::shared) store_statement_type ( conn_, object_traits::store_statement, id_image_binding_, @@ -326,7 +327,7 @@ namespace odb { if (erase_ == 0) erase_.reset ( - new (shared) erase_statement_type ( + new (details::shared) erase_statement_type ( conn_, object_traits::erase_statement, id_image_binding_)); @@ -351,10 +352,10 @@ namespace odb id_image_type id_image_; binding id_image_binding_; - odb::shared_ptr persist_; - odb::shared_ptr find_; - odb::shared_ptr store_; - odb::shared_ptr erase_; + details::shared_ptr persist_; + details::shared_ptr find_; + details::shared_ptr store_; + details::shared_ptr erase_; }; struct type_info_comparator @@ -391,8 +392,8 @@ namespace odb if (i != map_.end ()) return static_cast&> (*i->second); - shared_ptr > p ( - new (shared) object_statements (conn_)); + details::shared_ptr > p ( + new (details::shared) object_statements (conn_)); map_.insert (map::value_type (&typeid (T), p)); return *p; @@ -400,7 +401,7 @@ namespace odb private: typedef std::map, + details::shared_ptr, type_info_comparator> map; connection& conn_; diff --git a/odb/mysql/transaction-impl.hxx b/odb/mysql/transaction-impl.hxx index 626ea11..b9df516 100644 --- a/odb/mysql/transaction-impl.hxx +++ b/odb/mysql/transaction-impl.hxx @@ -6,12 +6,13 @@ #ifndef ODB_MYSQL_TRANSACTION_IMPL_HXX #define ODB_MYSQL_TRANSACTION_IMPL_HXX -#include #include #include #include +#include + namespace odb { namespace mysql @@ -40,7 +41,7 @@ namespace odb connection (); private: - shared_ptr connection_; + details::shared_ptr connection_; }; } } -- cgit v1.1