Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60902 - in sandbox/transaction/boost/transact: . detail
From: strasser_at_[hidden]
Date: 2010-03-28 14:56:15


Author: stefans
Date: 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
New Revision: 60902
URL: http://svn.boost.org/trac/boost/changeset/60902

Log:
minor changes:
 - embedded_vector, olog_buffer bugfixes
 - unsupported_exception -> unsupported_operation
 - MSVC pragmas guarded by #ifdef BOOST_MSVC
 - removed template<...> from member template friends; standard C++, accepted by GCC, MSVC and comeau
 - null_mutex -> null_lockable

Added:
   sandbox/transaction/boost/transact/detail/file.hpp (contents, props changed)
Text files modified:
   sandbox/transaction/boost/transact/basic_transaction_manager.hpp | 26 ++++++++------------------
   sandbox/transaction/boost/transact/detail/embedded_vector.hpp | 2 +-
   sandbox/transaction/boost/transact/detail/filebuf_file.hpp | 6 +++++-
   sandbox/transaction/boost/transact/detail/mutex.hpp | 4 ++--
   sandbox/transaction/boost/transact/exception.hpp | 10 ++--------
   sandbox/transaction/boost/transact/log.hpp | 2 +-
   sandbox/transaction/boost/transact/simple_transaction_manager.hpp | 4 ++--
   7 files changed, 21 insertions(+), 33 deletions(-)

Modified: sandbox/transaction/boost/transact/basic_transaction_manager.hpp
==============================================================================
--- sandbox/transaction/boost/transact/basic_transaction_manager.hpp (original)
+++ sandbox/transaction/boost/transact/basic_transaction_manager.hpp 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
@@ -18,7 +18,6 @@
 #include <boost/fusion/include/count_if.hpp>
 #include <boost/fusion/include/at.hpp>
 #include <boost/fusion/include/vector.hpp>
-#include <boost/fusion/include/is_sequence.hpp>
 #include <boost/utility/in_place_factory.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/mpl/vector.hpp>
@@ -26,7 +25,6 @@
 #include <boost/mpl/size.hpp>
 #include <boost/mpl/if.hpp>
 #include <boost/mpl/at.hpp>
-#include <boost/mpl/is_sequence.hpp>
 #include <boost/mpl/map.hpp>
 #include <boost/mpl/range_c.hpp>
 #include <boost/mpl/for_each.hpp>
@@ -112,14 +110,8 @@
         BOOST_STATIC_ASSERT(Threads || !TThreads);
 private:
         struct detail{
- typedef typename mpl::if_<
- mpl::is_sequence<Resources>,
- Resources,
- mpl::vector1<Resources>
- >::type resource_types;
-
                 typedef typename mpl::transform<
- typename detail::resource_types,
+ Resources,
                         transact::detail::get_tag<mpl::_1>
>::type resource_tags;
 
@@ -128,7 +120,7 @@
                         typedef mpl::pair<typename Resource::tag,Resource> type;
                 };
                 typedef typename mpl::fold<
- resource_types,
+ Resources,
                         mpl::map0<>,
                         mpl::insert<mpl::_1,make_resource_pair<mpl::_2> >
>::type resource_types_by_tag;
@@ -146,7 +138,7 @@
                 struct default_resource{
                         typedef typename mpl::deref<
                                 typename mpl::find_if<
- resource_types,
+ Resources,
                                         mpl::contains<get_services<mpl::_1>,Service>
>::type
>::type::tag type;
@@ -156,7 +148,6 @@
                 class transaction_construct_t{
                         explicit transaction_construct_t(transaction *parent)
                                 : parent(parent){}
- template<class R,bool Th,bool TTh,class L>
                         friend class basic_transaction_manager;
                         transaction *parent;
                 };
@@ -167,7 +158,6 @@
                                 mpl::for_each<resource_tags>(beginner(*this));
                         }
                 private:
- template<class R,bool Th,bool TTh,class L>
                         friend class basic_transaction_manager;
         
                         template<class Resource>
@@ -176,7 +166,7 @@
                         };
                         typedef typename fusion::result_of::as_map<
                                 typename mpl::transform<
- resource_types,
+ Resources,
                                         make_resource_transaction_pair<mpl::_1>
>::type
>::type resource_transactions_type;
@@ -187,7 +177,7 @@
                         typedef typename mpl::if_c<
                                 TThreads,
                                 transact::detail::mutex_type,
- transact::detail::null_mutex
+ transact::detail::null_lockable
>::type mutex_type;
         
                         mutex_type mutex;
@@ -201,7 +191,7 @@
         /// \endcond
 public:
         typedef typename detail::transaction transaction;
- typedef typename detail::resource_types resource_types;
+ typedef Resources resource_types;
         template<class ServiceTag>
         struct default_resource{
                 typedef typename detail::template default_resource<ServiceTag>::type type;
@@ -434,7 +424,7 @@
                 void prepare(Resource &res,typename Resource::transaction &rtx,mpl::false_){
                         //a resource that does not support two-phase-commit was used
                         //together with other persistent resources
- throw unsupported_exception();
+ throw unsupported_operation();
                 }
                 transaction &tx;
         };
@@ -460,7 +450,7 @@
         };
         typedef typename fusion::result_of::as_map<
                 typename mpl::transform<
- resource_types,
+ Resources,
                         make_resource_ptr_pair<mpl::_1>
>::type
>::type resources_type;

Modified: sandbox/transaction/boost/transact/detail/embedded_vector.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/embedded_vector.hpp (original)
+++ sandbox/transaction/boost/transact/detail/embedded_vector.hpp 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
@@ -217,7 +217,7 @@
                 }catch(...){ ::operator delete(newdata); throw; }
                 this->end_=newbegin + this->size();
                 this->end_storage=newbegin + newcap;
- ::operator delete(this->begin_);
+ if(this->begin() != this->emb_data()) ::operator delete(this->begin_);
                 this->begin_=newbegin;
         }
         T *emb_data(){

Added: sandbox/transaction/boost/transact/detail/file.hpp
==============================================================================
--- (empty file)
+++ sandbox/transaction/boost/transact/detail/file.hpp 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
@@ -0,0 +1,17 @@
+#ifndef BOOST_TRANSACT_DETAIL_FILE_HPP
+#define BOOST_TRANSACT_DETAIL_FILE_HPP
+
+#include <boost/transact/exception.hpp>
+
+namespace boost{
+namespace transact{
+namespace detail{
+
+struct eof_exception : io_failure{};
+
+}
+}
+}
+
+
+#endif

Modified: sandbox/transaction/boost/transact/detail/filebuf_file.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/filebuf_file.hpp (original)
+++ sandbox/transaction/boost/transact/detail/filebuf_file.hpp 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
@@ -12,8 +12,10 @@
 #include <boost/mpl/size_t.hpp>
 #include <boost/transact/exception.hpp>
 
+#ifdef BOOST_MSVC
 #pragma warning(push)
 #pragma warning(disable:4996)
+#endif
 
 namespace boost{
 namespace transact{
@@ -43,7 +45,7 @@
                 if(this->buf.pubsync() != 0) throw io_failure();
         }
         void sync(){
- throw unsupported_exception();
+ throw unsupported_operation();
         }
 private:
         std::filebuf buf;
@@ -87,6 +89,8 @@
 }
 }
 
+#ifdef BOOST_MSVC
 #pragma warning(pop)
+#endif
 
 #endif

Modified: sandbox/transaction/boost/transact/detail/mutex.hpp
==============================================================================
--- sandbox/transaction/boost/transact/detail/mutex.hpp (original)
+++ sandbox/transaction/boost/transact/detail/mutex.hpp 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
@@ -12,7 +12,7 @@
 namespace transact{
 namespace detail{
 
-struct null_mutex{
+struct null_lockable{
         void lock(){}
         bool try_lock(){ return true; }
         void unlock(){}
@@ -49,7 +49,7 @@
                 }
         }
         void unlock(){
- unsigned int old=this->count.fetch_sub(1,boost::memory_order_release);
+ int old=this->count.fetch_sub(1,boost::memory_order_release);
                 BOOST_ASSERT(old >= 0);
                 if(old > 0) this->smutex.unlock();
         }

Modified: sandbox/transaction/boost/transact/exception.hpp
==============================================================================
--- sandbox/transaction/boost/transact/exception.hpp (original)
+++ sandbox/transaction/boost/transact/exception.hpp 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
@@ -27,12 +27,6 @@
 ///\brief Indicates that an internal operation reading from/writing to files failed.
 struct io_failure : transact::exception{};
 
-namespace detail{
-
-struct eof_exception : io_failure{};
-
-}
-
 ///\brief Indicates that this operation required an active transaction but there was no active transaction bound for this thread.
 struct no_active_transaction : transact::exception{};
 
@@ -43,7 +37,7 @@
 struct no_transaction_manager : transact::exception{};
 
 ///\brief Indicates that this operation is not supported by this implementation
-struct unsupported_exception : transact::exception{};
+struct unsupported_operation : transact::exception{};
 
 struct isolation_exception;
 template<class ResMgr>
@@ -96,7 +90,7 @@
 };
 
 
-///´\brief Indicates that the operation conflicted with another transaction.
+///\brief Indicates that the operation conflicted with another transaction.
 ///
 ///The base class \c isolation_exception should be used to catch this exception,
 ///in order to catch isolation exceptions of all resource managers.

Modified: sandbox/transaction/boost/transact/log.hpp
==============================================================================
--- sandbox/transaction/boost/transact/log.hpp (original)
+++ sandbox/transaction/boost/transact/log.hpp 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
@@ -361,7 +361,7 @@
         olog_buffer(Log &log,Lockable &lockable)
                 : log(log), lockable(lockable){}
         template<class T>
- olog &operator<<(T const &t){
+ olog_buffer &operator<<(T const &t){
                 static std::size_t const size=sizeof(id_type) + sizeof(T);
                 BOOST_STATIC_ASSERT(size <= Size);
                 id_type const id=this->log.template id<T>();

Modified: sandbox/transaction/boost/transact/simple_transaction_manager.hpp
==============================================================================
--- sandbox/transaction/boost/transact/simple_transaction_manager.hpp (original)
+++ sandbox/transaction/boost/transact/simple_transaction_manager.hpp 2010-03-28 14:56:14 EDT (Sun, 28 Mar 2010)
@@ -33,7 +33,7 @@
                 class transaction_construct_t{
                         explicit transaction_construct_t(transaction *parent)
                                 : parent(parent){}
- template <class R, bool Th> friend class simple_transaction_manager;
+ friend class simple_transaction_manager;
                         friend class transaction;
                         transaction *parent;
                 };
@@ -51,7 +51,7 @@
                                 }
                         }
                 private:
- template <class R, bool Th> friend class simple_transaction_manager;
+ friend class simple_transaction_manager;
                         optional<typename Resource::transaction> rtx;
                         transaction * const parent;
                 };


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk