Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r60286 - in sandbox/stm/branches/vbe/boost/stm: . non_tx tx
From: vicente.botet_at_[hidden]
Date: 2010-03-07 05:31:08


Author: viboes
Date: 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
New Revision: 60286
URL: http://svn.boost.org/trac/boost/changeset/60286

Log:
Boost.STM/vbe:
* Rename safe_polymorphic_downcast to smart_cast
* Rename safe_polymorphic_downcast_X to incomplete_smart_cast_X
* Rename mixin to proxy_cache
* cleanup

Added:
   sandbox/stm/branches/vbe/boost/stm/incomplete_smart_cast.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/non_tx/reference.hpp
      - copied, changed from r59704, /sandbox/stm/branches/vbe/boost/stm/non_tx/mixin.hpp
   sandbox/stm/branches/vbe/boost/stm/tx/proxy_cache.hpp (contents, props changed)
   sandbox/stm/branches/vbe/boost/stm/tx/reference.hpp
      - copied, changed from r59757, /sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp
Removed:
   sandbox/stm/branches/vbe/boost/stm/non_tx/mixin.hpp
   sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp
Text files modified:
   sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp | 4
   sandbox/stm/branches/vbe/boost/stm/non_tx.hpp | 2
   sandbox/stm/branches/vbe/boost/stm/non_tx/numeric.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/non_tx/object.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/non_tx/pointer.hpp | 10 +-
   sandbox/stm/branches/vbe/boost/stm/non_tx/reference.hpp | 12 +-
   sandbox/stm/branches/vbe/boost/stm/transaction.hpp | 18 ++--
   sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp | 125 ++++++++-------------------------------
   sandbox/stm/branches/vbe/boost/stm/tx.hpp | 2
   sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp | 64 +++----------------
   sandbox/stm/branches/vbe/boost/stm/tx/numeric.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/tx/object.hpp | 6
   sandbox/stm/branches/vbe/boost/stm/tx/pointer.hpp | 42 ++-----------
   sandbox/stm/branches/vbe/boost/stm/tx/reference.hpp | 54 +++++++++++-----
   sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp | 8 +-
   sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp | 8 +-
   16 files changed, 126 insertions(+), 247 deletions(-)

Modified: sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/base_transaction_object.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -24,7 +24,7 @@
 #include <boost/stm/detail/config.hpp>
 //-----------------------------------------------------------------------------
 #include <boost/stm/datatypes.hpp>
-#include <boost/stm/safe_downcast.hpp>
+#include <boost/stm/incomplete_smart_cast.hpp>
 
 //-----------------------------------------------------------------------------
 #include <boost/stm/detail/memory_pool.hpp>
@@ -63,7 +63,7 @@
     struct make_cache_aux<dyn_poly> {
         template <typename T>
         static T* apply(T & rhs, transaction& t) {
- return boost::safe_polymorphic_downcast<T*>(rhs.make_cache(t));
+ return boost::smart_cast<T*>(rhs.make_cache(t));
         };
     };
 }

Added: sandbox/stm/branches/vbe/boost/stm/incomplete_smart_cast.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/incomplete_smart_cast.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -0,0 +1,98 @@
+// boost cast.hpp header file ----------------------------------------------//
+
+// (C) Copyright Kevlin Henney and Dave Abrahams 1999.
+// Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
+// See http://www.boost.org/libs/conversion for Documentation.
+
+
+#ifndef BOOST_INCOMPLETE_SMART_CAST__HPP
+#define BOOST_INCOMPLETE_SMART_CAST__HPP
+
+# include <boost/config.hpp>
+# include <boost/assert.hpp>
+# include <typeinfo>
+# include <boost/type.hpp>
+# include <boost/limits.hpp>
+# include <boost/detail/select_type.hpp>
+# include <boost/type_traits/is_virtual_base_of.hpp>
+# include <boost/type_traits/remove_pointer.hpp>
+# include <boost/mpl/or.hpp>
+
+# include <boost/cast.hpp>
+# include <boost/serialization/smart_cast.hpp>
+
+
+
+// It has been demonstrated numerous times that MSVC 6.0 fails silently at link
+// time if you use a template function which has template parameters that don't
+// appear in the function's argument list.
+//
+// TODO: Add this to config.hpp?
+# if defined(BOOST_MSVC) && BOOST_MSVC < 1300
+# define BOOST_EXPLICIT_DEFAULT_TARGET , ::boost::type<Target>* = 0
+# else
+# define BOOST_EXPLICIT_DEFAULT_TARGET
+# endif
+
+namespace boost
+{
+
+// incomplete_smart_cast --------------------------------------------------------//
+
+// When the Base class is virtual inherited we need to use dynamic_cast to downcast.
+// Of course as most of the time the Derived class don't inherit virtualy from BASE a static_cast is enough
+
+ namespace detail {
+ template <typename IsVirtualBaseOf, class Target, class Source>
+ struct incomplete_smart_cast;
+
+ template <class Target, class Source>
+ struct incomplete_smart_cast<true_type, Target,Source> {
+ inline static Target apply(Source* x ) {
+ return dynamic_cast<Target>(x);
+ }
+ };
+ template <class Target, class Source>
+ struct incomplete_smart_cast<false_type, Target,Source> {
+ inline static Target apply(Source* x ) {
+ return static_cast<Target>(x);
+ //return polymorphic_downcast<Target>(x);
+ }
+ };
+
+ }
+ template <class Target, class Source>
+ inline Target smart_cast(Source* x BOOST_EXPLICIT_DEFAULT_TARGET)
+ {
+ #if 1
+ return serialization::smart_cast<Target, Source*>(x);
+ #else
+ typedef typename is_virtual_base_of<Source, typename remove_pointer<Target>::type >::type IsVirtualBaseOf;
+ return detail::incomplete_smart_cast<true_type,Target,Source>::apply(x);
+ #endif
+ }
+
+ template <class Target, class Inter, class Source>
+ inline Target incomplete_smart_cast_2(Source* x BOOST_EXPLICIT_DEFAULT_TARGET)
+ {
+ typedef typename is_virtual_base_of<Source, Inter >::type IsVirtualBaseOf;
+ return detail::incomplete_smart_cast<IsVirtualBaseOf,Target,Source>::apply(x);
+ }
+
+ template <class Target, class Inter1, class Inter2, class Source>
+ inline Target incomplete_smart_cast_3(Source* x BOOST_EXPLICIT_DEFAULT_TARGET)
+ {
+ typedef integral_constant<bool,
+ is_virtual_base_of<Source, Inter1>::type::value || is_virtual_base_of<Source, Inter2>::type::value
+ > IsVirtualBaseOf;
+ return detail::incomplete_smart_cast<IsVirtualBaseOf,Target,Source>::apply(x);
+ }
+
+# undef BOOST_EXPLICIT_DEFAULT_TARGET
+
+} // namespace boost
+
+#endif // BOOST_INCOMPLETE_SMART_CAST__HPP

Modified: sandbox/stm/branches/vbe/boost/stm/non_tx.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/non_tx.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/non_tx.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -14,7 +14,7 @@
 #ifndef BOOST_STM_NON_TX__HPP
 #define BOOST_STM_NON_TX__HPP
 
-#include <boost/stm/non_tx/mixin.hpp>
+#include <boost/stm/non_tx/reference.hpp>
 #include <boost/stm/non_tx/object.hpp>
 #include <boost/stm/non_tx/numeric.hpp>
 #include <boost/stm/non_tx/pointer.hpp>

Deleted: sandbox/stm/branches/vbe/boost/stm/non_tx/mixin.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/non_tx/mixin.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
+++ (empty file)
@@ -1,86 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
-// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
-// copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/stm for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_STM_NON_TX_MIXIN__HPP
-#define BOOST_STM_NON_TX_MIXIN__HPP
-
-//-----------------------------------------------------------------------------
-#include <boost/stm/transaction.hpp>
-#include <boost/stm/non_tx/detail/cache_map.hpp>
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-namespace boost { namespace stm { namespace non_tx {
-
-//-----------------------------------------------------------------------------
-// class object wraps a non object type providing
-// a transactional view on a transactional context
-// a non-transactional view on a non-transactional context
-// Note: the sizeof(object<T>)==sizeof(T)
-//-----------------------------------------------------------------------------
-
-template <typename Final, typename T>
-class mixin {
-protected:
- T& val_;
-public:
- //-----------------------------------------------------------------------------
- mixin() : val_() {}
-
- // constructors
- template<typename F, typename U>
- mixin(mixin<F,U> const& r) : val_(r.value()) {}
-
- // contructor from a convertible to T
- template <typename U>
- mixin(U v) : val_(v) {}
-
- //-----------------------------------------------------------------------------
- // accessors
- operator T() const { return value(); }
- operator T&() { return ref(); }
-
- //-----------------------------------------------------------------------------
- T& ref() {
- transaction* tx=current_transaction();
- if (tx!=0) {
- if (tx->forced_to_abort()) {
- tx->lock_and_abort();
- throw aborted_transaction_exception("aborting transaction");
- }
-
- detail::cache<T>* r(tx->write_ptr(detail::cache_map::get(&val_)));
- return *(r->get());
- }
- return val_;
- }
-
- //-----------------------------------------------------------------------------
- T value() const {
- transaction* tx=current_transaction();
- if (tx!=0) {
- if (tx->forced_to_abort()) {
- tx->lock_and_abort();
- throw aborted_transaction_exception("aborting transaction");
- }
- detail::cache<T>* r(tx->read_ptr(detail::cache_map::get(&val_)));
- return *(r->get());
- }
- return val_;
- }
-};
-
-}}}
-#endif
-
-

Modified: sandbox/stm/branches/vbe/boost/stm/non_tx/numeric.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/non_tx/numeric.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/non_tx/numeric.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -15,7 +15,7 @@
 #define BOOST_STM_NON_TX_NUMERIC__HPP
 
 //-----------------------------------------------------------------------------
-#include <boost/stm/non_tx/mixin.hpp>
+#include <boost/stm/non_tx/reference.hpp>
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
@@ -29,9 +29,9 @@
 //-----------------------------------------------------------------------------
 
 template <typename T>
-class numeric : public mixin< numeric<T>, T >
+class numeric : public reference< numeric<T>, T >
 {
- typedef mixin< numeric<T> ,T > base_type;
+ typedef reference< numeric<T> ,T > base_type;
 public:
     //-----------------------------------------------------------------------------
     numeric() : base_type(0) {}

Modified: sandbox/stm/branches/vbe/boost/stm/non_tx/object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/non_tx/object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/non_tx/object.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -15,7 +15,7 @@
 #define BOOST_STM_NON_TX_OBJECT__HPP
 
 //-----------------------------------------------------------------------------
-#include <boost/stm/non_tx/mixin.hpp>
+#include <boost/stm/non_tx/reference.hpp>
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
@@ -29,9 +29,9 @@
 //-----------------------------------------------------------------------------
 
 template <typename T>
-struct object : mixin< object<T>, T> {
+struct object : reference< object<T>, T> {
 public:
- typedef mixin< object<T>, T > base_type;
+ typedef reference< object<T>, T > base_type;
     //-----------------------------------------------------------------------------
     object() : base_type() {}
 

Modified: sandbox/stm/branches/vbe/boost/stm/non_tx/pointer.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/non_tx/pointer.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/non_tx/pointer.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -15,7 +15,7 @@
 #define BOOST_STM_NON_TX_POINTER__HPP
 
 //-----------------------------------------------------------------------------
-#include <boost/stm/non_tx/mixin.hpp>
+#include <boost/stm/non_tx/reference.hpp>
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
@@ -30,9 +30,9 @@
 //-----------------------------------------------------------------------------
 
 template <typename T>
-class pointer : public mixin< pointer<T> ,T* >
+class pointer : public reference< pointer<T> ,T* >
 {
- typedef mixin< pointer<T> , T* > base_type;
+ typedef reference< pointer<T> , T* > base_type;
     
 public:
     //-----------------------------------------------------------------------------
@@ -62,9 +62,9 @@
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 template <typename C, typename R>
-class pointer_to_member : public mixin< pointer_to_member<C,R>, R C::* >
+class pointer_to_member : public reference< pointer_to_member<C,R>, R C::* >
 {
- typedef mixin< pointer_to_member<C,R>, R C::*> base_type;
+ typedef reference< pointer_to_member<C,R>, R C::*> base_type;
 public:
     //-----------------------------------------------------------------------------
     pointer_to_member() : base_type(static_cast<R C::*>(0)) {}

Copied: sandbox/stm/branches/vbe/boost/stm/non_tx/reference.hpp (from r59704, /sandbox/stm/branches/vbe/boost/stm/non_tx/mixin.hpp)
==============================================================================
--- /sandbox/stm/branches/vbe/boost/stm/non_tx/mixin.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/non_tx/reference.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -11,8 +11,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_STM_NON_TX_MIXIN__HPP
-#define BOOST_STM_NON_TX_MIXIN__HPP
+#ifndef BOOST_STM_NON_TX_REFERENCE__HPP
+#define BOOST_STM_NON_TX_REFERENCE__HPP
 
 //-----------------------------------------------------------------------------
 #include <boost/stm/transaction.hpp>
@@ -30,20 +30,20 @@
 //-----------------------------------------------------------------------------
 
 template <typename Final, typename T>
-class mixin {
+class reference {
 protected:
     T& val_;
 public:
     //-----------------------------------------------------------------------------
- mixin() : val_() {}
+ reference() : val_() {}
 
     // constructors
     template<typename F, typename U>
- mixin(mixin<F,U> const& r) : val_(r.value()) {}
+ reference(reference<F,U> const& r) : val_(r.value()) {}
 
     // contructor from a convertible to T
     template <typename U>
- mixin(U v) : val_(v) {}
+ reference(U v) : val_(v) {}
 
     //-----------------------------------------------------------------------------
     // accessors

Modified: sandbox/stm/branches/vbe/boost/stm/transaction.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -51,7 +51,7 @@
 #include <boost/stm/detail/transactions_stack.hpp>
 #include <boost/stm/detail/vector_map.hpp>
 #include <boost/stm/detail/vector_set.hpp>
-#include <boost/stm/safe_downcast.hpp>
+#include <boost/stm/incomplete_smart_cast.hpp>
 
 //-----------------------------------------------------------------------------
 namespace boost { namespace stm {
@@ -433,7 +433,7 @@
       {
          if (i->second == &in)
          {
- return *boost::safe_polymorphic_downcast<T*>(i->first);
+ return *boost::smart_cast<T*>(i->first);
          }
       }
 
@@ -460,7 +460,7 @@
       {
          if (i->second == ptr)
          {
- return boost::safe_polymorphic_downcast<T*>(i->first);
+ return boost::smart_cast<T*>(i->first);
          }
       }
 
@@ -517,7 +517,7 @@
       {
          WriteContainer::iterator i = writeList().find(const_cast<T*>(&in));
          if (i == writeList().end()) return 0;
- else return boost::safe_polymorphic_downcast<T*>(i->second);
+ else return boost::smart_cast<T*>(i->second);
       }
    }
    template <typename T>
@@ -532,7 +532,7 @@
       {
          WriteContainer::iterator i = writeList().find(const_cast<T*>(ptr));
          if (i == writeList().end()) return 0;
- else return boost::safe_polymorphic_downcast<T*>(i->second);
+ else return boost::smart_cast<T*>(i->second);
       }
    }
 
@@ -997,7 +997,7 @@
             //unlock_tx();
 
             ++reads_;
- return *boost::safe_polymorphic_downcast<T*>(readMem->second);
+ return *boost::smart_cast<T*>(readMem->second);
          }
 
          // already have locked us above - in both if / else
@@ -1284,7 +1284,7 @@
       // possible to have already written to memory being read now
       //----------------------------------------------------------------
       if (i == writeList().end()) return insert_and_return_read_memory(in);
- else return *boost::safe_polymorphic_downcast<T*>(i->second);
+ else return *boost::smart_cast<T*>(i->second);
    }
 
 public:
@@ -1357,10 +1357,10 @@
          base_transaction_object* returnValue = detail::make_cache_aux<Poly>::apply(in, *this);
          returnValue->transaction_thread(threadId_);
          writeList().insert(tx_pair(&in, returnValue));
- return *boost::safe_polymorphic_downcast<T*>(returnValue);
+ return *boost::smart_cast<T*>(returnValue);
       }
       else {
- return *boost::safe_polymorphic_downcast<T*>(i->second);
+ return *boost::smart_cast<T*>(i->second);
       }
    }
 

Modified: sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/transaction_object.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -27,7 +27,7 @@
 #include <boost/stm/datatypes.hpp>
 #include <boost/stm/memory_managers/memory_manager.hpp>
 #include <boost/stm/tx/deep_transaction_object.hpp>
-#include <boost/stm/tx/trivial_transaction_object.hpp>
+//#include <boost/stm/tx/trivial_transaction_object.hpp>
 #include <boost/stm/tx/shallow_transaction_object.hpp>
 
 //-----------------------------------------------------------------------------
@@ -42,51 +42,52 @@
 
 namespace detail {
 template <class Final, class Base,
- bool hasShallowCopySemantics,
- bool hasTrivialCopySemantics>
+ bool hasShallowCopySemantics
+//, bool hasTrivialCopySemantics
+>
 class transaction_object_aux;
 
+//~ template <class F, class B>
+//~ class transaction_object_aux<F, B, true, true>:
+ //~ public trivial_transaction_object<F, B> {};
 template <class F, class B>
-class transaction_object_aux<F, B, true, true>:
- public trivial_transaction_object<F, B> {};
-template <class F, class B>
-class transaction_object_aux<F, B, true, false>:
+class transaction_object_aux<F, B, true>:
     public shallow_transaction_object<F, B> {};
+//~ template <class F, class B>
+//~ class transaction_object_aux<F, B, false, true>:
+ //~ public trivial_transaction_object<F, B> {};
 template <class F, class B>
-class transaction_object_aux<F, B, false, true>:
- public trivial_transaction_object<F, B> {};
-template <class F, class B>
-class transaction_object_aux<F, B, false, false>:
+class transaction_object_aux<F, B, false>:
     public deep_transaction_object<F, B> {};
 
 template <class Final, class Base1,class Base2,
- bool hasShallowCopySemantics,
- bool hasTrivialCopySemantics>
+ bool hasShallowCopySemantics
+//~ , bool hasTrivialCopySemantics
+>
 class transaction_object2_aux;
 
+//~ template <class F, class B1, class B2>
+//~ class transaction_object2_aux<F, B1, B2, true, true>:
+ //~ public trivial_transaction_object2<F, B1, B2> {};
 template <class F, class B1, class B2>
-class transaction_object2_aux<F, B1, B2, true, true>:
- public trivial_transaction_object2<F, B1, B2> {};
-template <class F, class B1, class B2>
-class transaction_object2_aux<F, B1, B2, true, false>:
+class transaction_object2_aux<F, B1, B2, true>:
     public shallow_transaction_object2<F, B1, B2> {};
+//~ template <class F, class B1, class B2>
+//~ class transaction_object2_aux<F, B1, B2, false, true>:
+ //~ public trivial_transaction_object2<F, B1,B2> {};
 template <class F, class B1, class B2>
-class transaction_object2_aux<F, B1, B2, false, true>:
- public trivial_transaction_object2<F, B1,B2> {};
-template <class F, class B1, class B2>
-class transaction_object2_aux<F, B1, B2, false, false>:
+class transaction_object2_aux<F, B1, B2, false>:
     public deep_transaction_object2<F, B1, B2> {};
 
 }
-#if 1
 
 template <
     class Final,
     class Base=base_transaction_object
>
 class transaction_object : public detail::transaction_object_aux<Final, Base,
- has_shallow_copy_semantics<Final>::value,
- has_trivial_copy_semantics<Final>::value
+ has_shallow_copy_semantics<Final>::value
+//~ , has_trivial_copy_semantics<Final>::value
>
 {};
 
@@ -96,83 +97,11 @@
     class Base2
>
 class transaction_object2 : public detail::transaction_object2_aux<Final, Base1, Base2,
- has_shallow_copy_semantics<Final>::value,
- has_trivial_copy_semantics<Final>::value
+ has_shallow_copy_semantics<Final>::value
+//~ , has_trivial_copy_semantics<Final>::value
>
 {};
 
- #else
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-//-----------------------------------------------------------------------------
-// transaction object mixin
-// Provides the definition of the virtual functions
-// make_cache: use copy constructor
-// copy_cache: use assignement
-// move_state and
-// delete_cache: use delete
-// Defines in addition the functions new and delete when USE_STM_MEMORY_MANAGER is defined
-
-// The parameter Base=base_transaction_object allows to mic transaction_object and polymorphism
-// class B : transaction_object<B> {}
-// class D : transaction_object<D, B> {}
-// the single issue is the forward constructors from transaction_object<D, B> to B
-//-----------------------------------------------------------------------------
-template <class Final, typename Base=base_transaction_object>
-class transaction_object : public
-#ifdef USE_STM_MEMORY_MANAGER
- memory_manager<Final, Base>
-#else
- Base
-#endif{
-public:
- typedef transaction_object<Final, Base> this_type;
-
- //--------------------------------------------------------------------------
-#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
- virtual base_transaction_object* make_cache(transaction* t) const {
- Final* p = cache_allocate<Final>(t);
- if (p==0) {
- throw std::bad_alloc();
- }
- ::new (p) Final(*static_cast<Final const*>(this));
- return p;
- }
-#else
- virtual base_transaction_object* make_cache(transaction*/*t*/) const {
- Final* tmp = new Final(*static_cast<Final const*>(this));
- return tmp;
- }
-#endif
-
- //--------------------------------------------------------------------------
-#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
- virtual void delete_cache() {
- static_cast<Final*>(this)->~Final();
- boost::stm::cache_deallocate(this);
- }
-#else
- virtual void delete_cache() {
- delete this;
- }
-#endif
-
- //--------------------------------------------------------------------------
- virtual void copy_cache(base_transaction_object const & rhs)
- {
- *static_cast<Final *>(this) = *static_cast<Final const *>(&rhs);
- }
-
-#if BUILD_MOVE_SEMANTICS
- virtual void move_state(base_transaction_object * rhs)
- {
- static_cast<Final &>(*this) = draco_move
- (*(static_cast<Final*>(rhs)));
- }
-#endif
-
-};
-#endif
 template <typename T> class native_trans :
 public transaction_object< native_trans<T> >
 {

Modified: sandbox/stm/branches/vbe/boost/stm/tx.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -21,7 +21,7 @@
 //#include <boost/stm/tx/trivial_transaction_object.hpp>
 //#include <boost/stm/tx/shallow_transaction_object.hpp>
 #include <boost/stm/tx_ptr.hpp>
-#include <boost/stm/tx/mixin.hpp>
+#include <boost/stm/tx/proxy_cache.hpp>
 #include <boost/stm/tx/object.hpp>
 #include <boost/stm/tx/numeric.hpp>
 #include <boost/stm/tx/pointer.hpp>

Modified: sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/deep_transaction_object.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -74,21 +74,15 @@
         ::new (p) Final(*rhs);
         return p;
     }
- virtual base_transaction_object* make_cache(transaction& t) const {
- return make_cache(final(), t);
- }
 #else
     static Final* make_cache(Final const* rhs, transaction& ) {
         Final* tmp = new Final(*rhs);
         return tmp;
     }
+#endif
     virtual base_transaction_object* make_cache(transaction& t) const {
- //~ Final* tmp = new Final(*boost::safe_polymorphic_downcast<Final const*>(this));
- //~ Final* tmp = new Final(*boost::safe_polymorphic_downcast_2<Final const*, Base const>(this));
- Final* tmp = new Final(*final());
- return tmp;
+ return make_cache(final(), t);
     }
-#endif
 
    //--------------------------------------------------------------------------
 #if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
@@ -106,54 +100,20 @@
    virtual void copy_cache(base_transaction_object const & rhs)
    {
        *final() =
- *boost::safe_polymorphic_downcast_2<Final const *, Base const>(&rhs);
+ *boost::incomplete_smart_cast_2<Final const *, Base const>(&rhs);
    }
 
 #if BUILD_MOVE_SEMANTICS
    virtual void move_state(base_transaction_object * rhs)
    {
       *final() = draco_move
- (*(boost::safe_polymorphic_downcast_2<Final*, Base>(rhs)));
+ (*(boost::incomplete_smart_cast_2<Final*, Base>(rhs)));
    }
 #endif
 
 };
 
-#if 0
 
-#if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
-template <class Final, typename Base>
-Final*
-deep_transaction_object<Final,Base>::
-make_cache(Final const* rhs, transaction& t) {
- Final* p = cache_allocate<Final>(t);
- ::new (p) Final(*rhs);
- return p;
- }
-template <class Final, typename Base>
-base_transaction_object*
-deep_transaction_object<Final,Base>::
-make_cache(transaction& t) const {
- Final const* f=boost::safe_polymorphic_downcast_2<Final const*, Base const>(this);
- return make_cache(f, t);
- }
-#else
-template <class Final, typename Base>
-Final*
-deep_transaction_object<Final,Base>::
-make_cache(Final const* rhs, transaction& ) {
- Final* tmp = new Final(*rhs);
- return tmp;
- }
-template <class Final, typename Base>
-base_transaction_object*
-deep_transaction_object<Final,Base>::
-make_cache(transaction& t) const {
- Final* tmp = new Final(*boost::safe_polymorphic_downcast_2<Final const*, Base const>(this));
- return tmp;
- }
-#endif
-#endif
 
 
 
@@ -171,20 +131,20 @@
 #if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
     static Final* make_cache(Final const& rhs, transaction& t) {
         Final* p = cache_allocate<Final>(t);
- ::new (p) Final(*boost::safe_polymorphic_downcast_3<Final const*, Base1 const, Base2 const>(&rhs));
+ ::new (p) Final(*boost::incomplete_smart_cast_3<Final const*, Base1 const, Base2 const>(&rhs));
         return p;
     };
     virtual base_transaction_object* make_cache(transaction& t) const {
- Final const& f=*boost::safe_polymorphic_downcast_3<Final const*, Base1 const, Base2 const>(this);
+ Final const& f=*boost::incomplete_smart_cast_3<Final const*, Base1 const, Base2 const>(this);
         return make_cache(f, t);
     }
 #else
     static Final* make_cache(Final const& rhs, transaction& ) {
- Final* tmp = new Final(*boost::safe_polymorphic_downcast_3<Final const*, Base1 const, Base2 const>(&rhs));
+ Final* tmp = new Final(*boost::incomplete_smart_cast_3<Final const*, Base1 const, Base2 const>(&rhs));
         return tmp;
     };
     virtual base_transaction_object* make_cache(transaction& t) const {
- Final* tmp = new Final(*boost::safe_polymorphic_downcast_3<Final const*, Base1 const, Base2 const>(this));
+ Final* tmp = new Final(*boost::incomplete_smart_cast_3<Final const*, Base1 const, Base2 const>(this));
         return tmp;
     }
 #endif
@@ -192,7 +152,7 @@
    //--------------------------------------------------------------------------
 #if BOOST_STM_USE_SPECIFIC_TRANSACTION_MEMORY_MANAGER
     virtual void delete_cache() {
- boost::safe_polymorphic_downcast_3<Final*, Base1, Base2>(this)->~Final();
+ boost::incomplete_smart_cast_3<Final*, Base1, Base2>(this)->~Final();
         boost::stm::cache_deallocate(this);
     }
 #else
@@ -204,14 +164,14 @@
    //--------------------------------------------------------------------------
    virtual void copy_cache(base_transaction_object const & rhs)
    {
- *boost::safe_polymorphic_downcast_3<Final *, Base1, Base2>(this) = *boost::safe_polymorphic_downcast_3<Final const *, Base1 const, Base2 const>(&rhs);
+ *boost::incomplete_smart_cast_3<Final *, Base1, Base2>(this) = *boost::incomplete_smart_cast_3<Final const *, Base1 const, Base2 const>(&rhs);
    }
 
 #if BUILD_MOVE_SEMANTICS
    virtual void move_state(base_transaction_object * rhs)
    {
- *boost::safe_polymorphic_downcast_3<Final *, Base1, Base2>(this) = draco_move
- (*(boost::safe_polymorphic_downcast_3<Final*, Base1, Base2>(rhs)));
+ *boost::incomplete_smart_cast_3<Final *, Base1, Base2>(this) = draco_move
+ (*(boost::incomplete_smart_cast_3<Final*, Base1, Base2>(rhs)));
    }
 #endif
 

Deleted: sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
+++ (empty file)
@@ -1,115 +0,0 @@
-//////////////////////////////////////////////////////////////////////////////
-//
-// (C) Copyright Justin E. Gottchlich 2009.
-// (C) Copyright Vicente J. Botet Escriba 2009.
-// Distributed under the Boost
-// Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or
-// copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-// See http://www.boost.org/libs/stm for documentation.
-//
-//////////////////////////////////////////////////////////////////////////////
-
-#ifndef BOOST_STM_TX_MIXIN__HPP
-#define BOOST_STM_TX_MIXIN__HPP
-
-//-----------------------------------------------------------------------------
-#include <boost/stm/transaction.hpp>
-#include <boost/stm/transaction_object.hpp>
-//-----------------------------------------------------------------------------
-
-//-----------------------------------------------------------------------------
-namespace boost { namespace stm { namespace tx {
-
-//-----------------------------------------------------------------------------
-// mixin transactional object class that wraps a object type providing
-// a transparent transactional view on a transactional context
-// a non-transactional view on a non-transactional context
-// Note: the sizeof(object<T>)>>>>=sizeof(T)
-//-----------------------------------------------------------------------------
-template <typename Final, typename T, typename Base=base_transaction_object>
-class mixin : public transaction_object< Final, Base >
-{
-protected:
-public:
- T val_;
-public:
- typedef mixin<Final, T, Base> this_type;
- typedef Final final_type;
- typedef T value_type;
- //-----------------------------------------------------------------------------
- mixin() : val_() {}
-
- mixin(mixin const& r) : val_(r.value()) {}
- template<typename F, typename U>
- mixin(mixin<F,U> const& r) : val_(r.value()) {}
- mixin(T v) : val_(v) {}
- mixin& operator=(mixin const& rhs) {
- if (this!=&rhs) {
- ref()=rhs.value();
- }
- return *this;
- }
-
- // contructor from a convertible to T
- template <typename U>
- mixin(U v) : val_(v) {}
-
- operator T() const { return value(); }
- operator T&() { return ref(); }
-
- //-----------------------------------------------------------------------------
- // accessors
- T& ref() {
- transaction* tx=current_transaction();
- if (tx!=0 && tx->in_flight()) {
- if (tx->forced_to_abort()) {
- tx->lock_and_abort();
- throw aborted_transaction_exception("aborting transaction");
- }
-
- return tx->write(*static_cast<Final*>(this)).val_;
- }
- return val_;
- }
-
- T* address_of() {
- return &val_;
- }
- //-----------------------------------------------------------------------------
- T value() const {
- transaction* tx=current_transaction();
- if (tx!=0 && tx->in_flight()) {
- if (tx->forced_to_abort()) {
- tx->lock_and_abort();
- throw aborted_transaction_exception("aborting transaction");
- }
- return tx->read(*static_cast<Final const*>(this)).val_;
- }
- return val_;
- }
- // shallow copy
- mixin(mixin const& rhs, stm::shallow_t)
- : val_(rhs.val_)
- {}
- // shallow assignment
- mixin& shallow_assign(mixin const& rhs)
- {
- val_=rhs.val_;
- return *this;
- }
-};
-
-
-
-}
-// shallow trait
-template <typename F, typename T, typename B>
-struct has_shallow_copy_semantics<tx::mixin<F,T,B> > : boost::mpl::true_
-{};
-
-}}
-#endif //BOOST_STM_TX_MIXIN__HPP
-
-

Modified: sandbox/stm/branches/vbe/boost/stm/tx/numeric.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/numeric.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/numeric.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -15,7 +15,7 @@
 #define BOOST_STM_TX_NUMERIC__HPP
 
 //-----------------------------------------------------------------------------
-#include <boost/stm/tx/mixin.hpp>
+#include <boost/stm/tx/proxy_cache.hpp>
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
@@ -29,9 +29,9 @@
 //-----------------------------------------------------------------------------
 
 template <typename T>
-class numeric : public mixin< numeric<T>, T >
+class numeric : public proxy_cache< numeric<T>, T >
 {
- typedef mixin< numeric<T> ,T > base_type;
+ typedef proxy_cache< numeric<T> ,T > base_type;
 public:
     //-----------------------------------------------------------------------------
     numeric() : base_type(0) {}

Modified: sandbox/stm/branches/vbe/boost/stm/tx/object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/object.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -15,7 +15,7 @@
 #define BOOST_STM_TX_OBJECT__HPP
 
 //-----------------------------------------------------------------------------
-#include <boost/stm/tx/mixin.hpp>
+#include <boost/stm/tx/proxy_cache.hpp>
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
@@ -28,10 +28,10 @@
 // Note: the sizeof(object<T>)>>>>=sizeof(T)
 //-----------------------------------------------------------------------------
 template <typename T>
-class object : public mixin< object<T>, T >
+class object : public proxy_cache< object<T>, T >
 {
 public:
- typedef mixin< object<T>, T > base_type;
+ typedef proxy_cache< object<T>, T > base_type;
     //-----------------------------------------------------------------------------
     object() : base_type() {}
     template<typename U>

Modified: sandbox/stm/branches/vbe/boost/stm/tx/pointer.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/pointer.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/pointer.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -15,7 +15,7 @@
 #define BOOST_STM_TX_POINTER__HPP
 
 //-----------------------------------------------------------------------------
-#include <boost/stm/tx/mixin.hpp>
+#include <boost/stm/tx/proxy_cache.hpp>
 //-----------------------------------------------------------------------------
 
 //-----------------------------------------------------------------------------
@@ -28,9 +28,9 @@
 // Note: the sizeof(pointer<T>)>>>>=sizeof(T*)
 //-----------------------------------------------------------------------------
 template <typename T>
-class pointer : public mixin< pointer<T>, T* >
+class pointer : public proxy_cache< pointer<T>, T* >
 {
- typedef mixin< pointer<T>, T* > base_type;
+ typedef proxy_cache< pointer<T>, T* > base_type;
 
 public:
     //-----------------------------------------------------------------------------
@@ -40,14 +40,14 @@
     pointer(pointer<U> const& r) : base_type(r) {}
 
     template<class U, class V, class B>
- pointer(mixin<U, V*, B> const& rhs) : base_type(rhs.value()) {}
+ pointer(proxy_cache<U, V*, B> const& rhs) : base_type(rhs.value()) {}
 
     pointer(T* v) : base_type(v) {}
     template <typename U>
     pointer(U* v) : base_type(v) {}
 
     template<class U, class V, class B>
- pointer& operator=(mixin<U, V*, B> const& rhs) {
+ pointer& operator=(proxy_cache<U, V*, B> const& rhs) {
         this->val_=rhs.value();
     };
 
@@ -93,9 +93,9 @@
 }
 
 template <typename C, typename R>
-class pointer_to_member : public mixin< pointer_to_member<C,R>, R C::*>
+class pointer_to_member : public proxy_cache< pointer_to_member<C,R>, R C::*>
 {
- typedef mixin< pointer_to_member<C,R>, R C::*> base_type;
+ typedef proxy_cache< pointer_to_member<C,R>, R C::*> base_type;
 public:
     //-----------------------------------------------------------------------------
     pointer_to_member() : base_type(static_cast<R C::*>(0)) {}
@@ -107,34 +107,6 @@
     //pointer_to_member(R C::* v) : base_type(v) {}
 };
 
-#if 0
-
-// two transactional pointers are equal if they point to the same cache on the current transaction.
-template <typename T, typename U>
-inline bool operator==(const pointer<T>& lhs, const pointer<U>& rhs) {
- return lhs.ref()==rhs.ref();
-}
-
-template <typename T, typename U>
-inline bool operator==(const T& lhs, const pointer<U>& rhs) {
- return lhs==rhs.ref();
-}
-
-template <typename T, typename U>
-inline bool operator==(const pointer<T>& lhs, const U& rhs) {
- return lhs.ref()==rhs;
-}
-
-template <typename T, typename U>
-inline bool operator!=(const pointer<T>& lhs, const pointer<U>& rhs) {
- return lhs.ref()!=rhs.ref();
-}
-
-template<class T> inline void swap(pointer<T> & a, pointer<T> & b) {
- a.swap(b);
-}
-#endif
-
 }}}
 #endif
 

Added: sandbox/stm/branches/vbe/boost/stm/tx/proxy_cache.hpp
==============================================================================
--- (empty file)
+++ sandbox/stm/branches/vbe/boost/stm/tx/proxy_cache.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -0,0 +1,129 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Justin E. Gottchlich 2009.
+// (C) Copyright Vicente J. Botet Escriba 2009.
+// Distributed under the Boost
+// Software License, Version 1.0.
+// (See accompanying file LICENSE_1_0.txt or
+// copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/stm for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_STM_TX_PROXY_CACHE__HPP
+#define BOOST_STM_TX_PROXY_CACHE__HPP
+
+//-----------------------------------------------------------------------------
+#include <boost/stm/transaction.hpp>
+#include <boost/stm/transaction_object.hpp>
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+namespace boost { namespace stm { namespace tx {
+
+//-----------------------------------------------------------------------------
+template <typename Final, typename T, typename Base=base_transaction_object>
+class proxy_cache : public transaction_object< Final, Base >
+{
+protected:
+public:
+ T val_;
+public:
+ typedef proxy_cache<Final, T, Base> this_type;
+ typedef Final final_type;
+ typedef T value_type;
+ //-----------------------------------------------------------------------------
+ proxy_cache() : val_() {}
+
+ proxy_cache(proxy_cache const& r) : val_(r.value()) {}
+ template<typename F, typename U>
+ proxy_cache(proxy_cache<F,U> const& r) : val_(r.value()) {}
+ proxy_cache(T v) : val_(v) {}
+ // contructor from a convertible to T
+ template <typename U>
+ proxy_cache(U v) : val_(v) {}
+
+ proxy_cache& operator=(proxy_cache const& rhs) {
+ if (this!=&rhs) {
+ ref()=rhs.value();
+ }
+ return *this;
+ }
+ template<typename F, typename U>
+ proxy_cache& operator=(proxy_cache<F,U> const& rhs) {
+ ref()=rhs.value();
+ return *this;
+ }
+
+ operator T() const { return value(); }
+ operator T&() { return ref(); }
+
+ //-----------------------------------------------------------------------------
+ // accessors
+ T& ref() {
+ transaction* tx=current_transaction();
+ if (tx!=0 && tx->in_flight()) {
+ if (tx->forced_to_abort()) {
+ tx->lock_and_abort();
+ throw aborted_transaction_exception("aborting transaction");
+ }
+
+ return tx->write(*static_cast<Final*>(this)).val_;
+ }
+ return val_;
+ }
+
+ T* address_of() {
+ return &val_;
+ }
+ //-----------------------------------------------------------------------------
+ T value() const {
+ transaction* tx=current_transaction();
+ if (tx!=0 && tx->in_flight()) {
+ if (tx->forced_to_abort()) {
+ tx->lock_and_abort();
+ throw aborted_transaction_exception("aborting transaction");
+ }
+ return tx->read(*static_cast<Final const*>(this)).val_;
+ }
+ return val_;
+ }
+ // shallow copy
+ proxy_cache(proxy_cache const& rhs, stm::shallow_t)
+ : val_(rhs.val_)
+ {}
+ // shallow assignment
+ proxy_cache& shallow_assign(proxy_cache const& rhs)
+ {
+ val_=rhs.val_;
+ return *this;
+ }
+ // TODO add case has_shallow_copy_semansics<T> is true
+};
+
+//~ template <typename OSTREAM, typename F, typename T, typename B>
+//~ OSTREAM& operator<<(OSTREAM& os, proxy_cache<F, T, B> const& r) {
+ //~ os << r.value();
+ //~ return os;
+//~ }
+//~ template <typename ISTREAM, typename F, typename T, typename B>
+//~ ISTREAM& operator>>(ISTREAM& is, proxy_cache<F, T, B> & r) {
+ //~ T v;
+ //~ is >> v;
+ //~ r=v;
+ //~ return is;
+//~ }
+
+
+}
+// shallow trait
+template <typename F, typename T, typename B>
+struct has_shallow_copy_semantics<tx::proxy_cache<F,T,B> > : boost::mpl::true_
+{};
+
+
+}}
+#endif //BOOST_STM_TX_PROXY_CACHE__HPP
+
+

Copied: sandbox/stm/branches/vbe/boost/stm/tx/reference.hpp (from r59757, /sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp)
==============================================================================
--- /sandbox/stm/branches/vbe/boost/stm/tx/mixin.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/reference.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -11,8 +11,8 @@
 //
 //////////////////////////////////////////////////////////////////////////////
 
-#ifndef BOOST_STM_TX_MIXIN__HPP
-#define BOOST_STM_TX_MIXIN__HPP
+#ifndef BOOST_STM_TX_REFERENCE__HPP
+#define BOOST_STM_TX_REFERENCE__HPP
 
 //-----------------------------------------------------------------------------
 #include <boost/stm/transaction.hpp>
@@ -29,33 +29,38 @@
 // Note: the sizeof(object<T>)>>>>=sizeof(T)
 //-----------------------------------------------------------------------------
 template <typename Final, typename T, typename Base=base_transaction_object>
-class mixin : public transaction_object< Final, Base >
+class reference : public transaction_object< Final, Base >
 {
 protected:
 public:
     T val_;
 public:
- typedef mixin<Final, T, Base> this_type;
+ typedef reference<Final, T, Base> this_type;
     typedef Final final_type;
     typedef T value_type;
     //-----------------------------------------------------------------------------
- mixin() : val_() {}
+ reference() : val_() {}
 
- mixin(mixin const& r) : val_(r.value()) {}
+ reference(reference const& r) : val_(r.value()) {}
     template<typename F, typename U>
- mixin(mixin<F,U> const& r) : val_(r.value()) {}
- mixin(T v) : val_(v) {}
- mixin& operator=(mixin const& rhs) {
+ reference(reference<F,U> const& r) : val_(r.value()) {}
+ reference(T v) : val_(v) {}
+ // contructor from a convertible to T
+ template <typename U>
+ reference(U v) : val_(v) {}
+
+ reference& operator=(reference const& rhs) {
         if (this!=&rhs) {
             ref()=rhs.value();
         }
         return *this;
     }
-
- // contructor from a convertible to T
- template <typename U>
- mixin(U v) : val_(v) {}
-
+ template<typename F, typename U>
+ reference& operator=(reference<F,U> const& rhs) {
+ ref()=rhs.value();
+ return *this;
+ }
+
     operator T() const { return value(); }
     operator T&() { return ref(); }
 
@@ -90,26 +95,39 @@
         return val_;
     }
     // shallow copy
- mixin(mixin const& rhs, stm::shallow_t)
+ reference(reference const& rhs, stm::shallow_t)
     : val_(rhs.val_)
     {}
     // shallow assignment
- mixin& shallow_assign(mixin const& rhs)
+ reference& shallow_assign(reference const& rhs)
     {
         val_=rhs.val_;
         return *this;
     }
 };
 
+//~ template <typename OSTREAM, typename F, typename T, typename B>
+//~ OSTREAM& operator<<(OSTREAM& os, reference<F, T, B> const& r) {
+ //~ os << r.value();
+ //~ return os;
+//~ }
+//~ template <typename ISTREAM, typename F, typename T, typename B>
+//~ ISTREAM& operator>>(ISTREAM& is, reference<F, T, B> & r) {
+ //~ T v;
+ //~ is >> v;
+ //~ r=v;
+ //~ return is;
+//~ }
 
 
 }
 // shallow trait
 template <typename F, typename T, typename B>
-struct has_shallow_copy_semantics<tx::mixin<F,T,B> > : boost::mpl::true_
+struct has_shallow_copy_semantics<tx::reference<F,T,B> > : boost::mpl::true_
 {};
 
+
 }}
-#endif //BOOST_STM_TX_MIXIN__HPP
+#endif //BOOST_STM_TX_REFERENCE__HPP
 
 

Modified: sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/shallow_transaction_object.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -87,13 +87,13 @@
    //--------------------------------------------------------------------------
    virtual void copy_cache(base_transaction_object const &rhs)
    {
- final()->shallow_assign(*boost::safe_polymorphic_downcast_2<Final const *, Base const>(&rhs));
+ final()->shallow_assign(*boost::incomplete_smart_cast_2<Final const *, Base const>(&rhs));
    }
 
 #if BUILD_MOVE_SEMANTICS
    virtual void move_state(base_transaction_object * rhs)
    {
- *final() = draco_move(*(boost::safe_polymorphic_downcast_2<Final*, Base>(rhs)));
+ *final() = draco_move(*(boost::incomplete_smart_cast_2<Final*, Base>(rhs)));
    }
 #endif
 
@@ -130,13 +130,13 @@
    //--------------------------------------------------------------------------
    virtual void copy_cache(base_transaction_object const &rhs)
    {
- final()->shallow_assign(*boost::safe_polymorphic_downcast_3<Final const *, Base1 const , Base2 const>(&rhs));
+ final()->shallow_assign(*boost::incomplete_smart_cast_3<Final const *, Base1 const , Base2 const>(&rhs));
    }
 
 #if BUILD_MOVE_SEMANTICS
    virtual void move_state(base_transaction_object * rhs)
    {
- *final() = draco_move(*(boost::safe_polymorphic_downcast_3<Final*, Base1, Base2>(rhs)));
+ *final() = draco_move(*(boost::incomplete_smart_cast_3<Final*, Base1, Base2>(rhs)));
    }
 #endif
 

Modified: sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp
==============================================================================
--- sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp (original)
+++ sandbox/stm/branches/vbe/boost/stm/tx/trivial_transaction_object.hpp 2010-03-07 05:31:05 EST (Sun, 07 Mar 2010)
@@ -97,13 +97,13 @@
     //--------------------------------------------------------------------------
     virtual void copy_cache(base_transaction_object const &rhs)
     {
- std::memcpy(final(), boost::safe_polymorphic_downcast_2<Final const *, Base const>(&rhs), sizeof(Final));
+ std::memcpy(final(), boost::incomplete_smart_cast_2<Final const *, Base const>(&rhs), sizeof(Final));
     }
 
 #if BUILD_MOVE_SEMANTICS
     virtual void move_state(base_transaction_object * rhs)
     {
- *final() = draco_move(*(boost::safe_polymorphic_downcast_2<Final*, Base>(rhs)));
+ *final() = draco_move(*(boost::incomplete_smart_cast_2<Final*, Base>(rhs)));
     }
 #endif
 
@@ -141,13 +141,13 @@
    //--------------------------------------------------------------------------
    virtual void copy_cache(base_transaction_object const &rhs)
    {
- std::memcpy(final(), boost::safe_polymorphic_downcast_3<Final const *, Base1 const, Base2 const>(&rhs), sizeof(Final));
+ std::memcpy(final(), boost::incomplete_smart_cast_3<Final const *, Base1 const, Base2 const>(&rhs), sizeof(Final));
    }
 
 #if BUILD_MOVE_SEMANTICS
    virtual void move_state(base_transaction_object * rhs)
    {
- *final() = draco_move(*(boost::safe_polymorphic_downcast_3<Final*, Base1, Base2>(rhs)));
+ *final() = draco_move(*(boost::incomplete_smart_cast_3<Final*, Base1, Base2>(rhs)));
    }
 #endif
 


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