You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2011/06/27 08:08:39 UTC
svn commit: r1140024 [12/15] - in /incubator/mesos/trunk: ./ ec2/
ec2/deploy.karmic64/ ec2/deploy.solaris/ frameworks/torque/nexus-hpl/
include/mesos/ src/ src/common/ src/configurator/ src/detector/
src/examples/ src/examples/java/ src/examples/python...
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/make_shared.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/make_shared.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/make_shared.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/make_shared.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,508 @@
+#ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED
+#define BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED
+
+// make_shared.hpp
+//
+// Copyright (c) 2007, 2008 Peter Dimov
+//
+// 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/smart_ptr/make_shared.html
+// for documentation.
+
+#include <boost/config.hpp>
+#include <boost/smart_ptr/shared_ptr.hpp>
+#include <boost/type_traits/type_with_alignment.hpp>
+#include <boost/type_traits/alignment_of.hpp>
+#include <cstddef>
+#include <new>
+
+namespace boost
+{
+
+namespace detail
+{
+
+template< std::size_t N, std::size_t A > struct sp_aligned_storage
+{
+ union type
+ {
+ char data_[ N ];
+ typename boost::type_with_alignment< A >::type align_;
+ };
+};
+
+template< class T > class sp_ms_deleter
+{
+private:
+
+ typedef typename sp_aligned_storage< sizeof( T ), ::boost::alignment_of< T >::value >::type storage_type;
+
+ bool initialized_;
+ storage_type storage_;
+
+private:
+
+ void destroy()
+ {
+ if( initialized_ )
+ {
+ reinterpret_cast< T* >( storage_.data_ )->~T();
+ initialized_ = false;
+ }
+ }
+
+public:
+
+ sp_ms_deleter(): initialized_( false )
+ {
+ }
+
+ // optimization: do not copy storage_
+ sp_ms_deleter( sp_ms_deleter const & ): initialized_( false )
+ {
+ }
+
+ ~sp_ms_deleter()
+ {
+ destroy();
+ }
+
+ void operator()( T * )
+ {
+ destroy();
+ }
+
+ void * address()
+ {
+ return storage_.data_;
+ }
+
+ void set_initialized()
+ {
+ initialized_ = true;
+ }
+};
+
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+template< class T > T&& sp_forward( T & t )
+{
+ return static_cast< T&& >( t );
+}
+
+#endif
+
+} // namespace detail
+
+// Zero-argument versions
+//
+// Used even when variadic templates are available because of the new T() vs new T issue
+
+template< class T > boost::shared_ptr< T > make_shared()
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T();
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T();
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+#if defined( BOOST_HAS_VARIADIC_TMPL ) && defined( BOOST_HAS_RVALUE_REFS )
+
+// Variadic templates, rvalue reference
+
+template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_shared( Arg1 && arg1, Args && ... args )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ), boost::detail::sp_forward<Args>( args )... );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Arg1 && arg1, Args && ... args )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( boost::detail::sp_forward<Arg1>( arg1 ), boost::detail::sp_forward<Args>( args )... );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+#else
+
+// C++03 version
+
+template< class T, class A1 >
+boost::shared_ptr< T > make_shared( A1 const & a1 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A1, class A2 >
+boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1, class A2 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A1, class A2, class A3 >
+boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1, class A2, class A3 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A1, class A2, class A3, class A4 >
+boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1, class A2, class A3, class A4 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A1, class A2, class A3, class A4, class A5 >
+boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1, class A2, class A3, class A4, class A5 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A1, class A2, class A3, class A4, class A5, class A6 >
+boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5, a6 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5, a6 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 >
+boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 >
+boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 >
+boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 >
+boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 )
+{
+ boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a );
+
+ boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt );
+
+ void * pv = pd->address();
+
+ ::new( pv ) T( a1, a2, a3, a4, a5, a6, a7, a8, a9 );
+ pd->set_initialized();
+
+ T * pt2 = static_cast< T* >( pv );
+
+ boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 );
+ return boost::shared_ptr< T >( pt, pt2 );
+}
+
+#endif
+
+} // namespace boost
+
+#endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_array.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_array.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_array.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_array.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,107 @@
+#ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
+#define BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// 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)
+//
+// http://www.boost.org/libs/smart_ptr/scoped_array.htm
+//
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/config.hpp> // in case ptrdiff_t not in std
+
+#include <boost/detail/workaround.hpp>
+
+#include <cstddef> // for std::ptrdiff_t
+
+namespace boost
+{
+
+// Debug hooks
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+void sp_array_constructor_hook(void * p);
+void sp_array_destructor_hook(void * p);
+
+#endif
+
+// scoped_array extends scoped_ptr to arrays. Deletion of the array pointed to
+// is guaranteed, either on destruction of the scoped_array or via an explicit
+// reset(). Use shared_array or std::vector if your needs are more complex.
+
+template<class T> class scoped_array // noncopyable
+{
+private:
+
+ T * px;
+
+ scoped_array(scoped_array const &);
+ scoped_array & operator=(scoped_array const &);
+
+ typedef scoped_array<T> this_type;
+
+ void operator==( scoped_array const& ) const;
+ void operator!=( scoped_array const& ) const;
+
+public:
+
+ typedef T element_type;
+
+ explicit scoped_array( T * p = 0 ) : px( p ) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_array_constructor_hook( px );
+#endif
+ }
+
+ ~scoped_array() // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_array_destructor_hook( px );
+#endif
+ boost::checked_array_delete( px );
+ }
+
+ void reset(T * p = 0) // never throws
+ {
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
+ this_type(p).swap(*this);
+ }
+
+ T & operator[](std::ptrdiff_t i) const // never throws
+ {
+ BOOST_ASSERT( px != 0 );
+ BOOST_ASSERT( i >= 0 );
+ return px[i];
+ }
+
+ T * get() const // never throws
+ {
+ return px;
+ }
+
+// implicit conversion to "bool"
+#include <boost/smart_ptr/detail/operator_bool.hpp>
+
+ void swap(scoped_array & b) // never throws
+ {
+ T * tmp = b.px;
+ b.px = px;
+ px = tmp;
+ }
+};
+
+template<class T> inline void swap(scoped_array<T> & a, scoped_array<T> & b) // never throws
+{
+ a.swap(b);
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_SMART_PTR_SCOPED_ARRAY_HPP_INCLUDED
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_ptr.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_ptr.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_ptr.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/scoped_ptr.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,131 @@
+#ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
+#define BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
+
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// 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)
+//
+// http://www.boost.org/libs/smart_ptr/scoped_ptr.htm
+//
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/detail/workaround.hpp>
+
+#ifndef BOOST_NO_AUTO_PTR
+# include <memory> // for std::auto_ptr
+#endif
+
+namespace boost
+{
+
+// Debug hooks
+
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+
+void sp_scalar_constructor_hook(void * p);
+void sp_scalar_destructor_hook(void * p);
+
+#endif
+
+// scoped_ptr mimics a built-in pointer except that it guarantees deletion
+// of the object pointed to, either on destruction of the scoped_ptr or via
+// an explicit reset(). scoped_ptr is a simple solution for simple needs;
+// use shared_ptr or std::auto_ptr if your needs are more complex.
+
+template<class T> class scoped_ptr // noncopyable
+{
+private:
+
+ T * px;
+
+ scoped_ptr(scoped_ptr const &);
+ scoped_ptr & operator=(scoped_ptr const &);
+
+ typedef scoped_ptr<T> this_type;
+
+ void operator==( scoped_ptr const& ) const;
+ void operator!=( scoped_ptr const& ) const;
+
+public:
+
+ typedef T element_type;
+
+ explicit scoped_ptr( T * p = 0 ): px( p ) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_constructor_hook( px );
+#endif
+ }
+
+#ifndef BOOST_NO_AUTO_PTR
+
+ explicit scoped_ptr( std::auto_ptr<T> p ): px( p.release() ) // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_constructor_hook( px );
+#endif
+ }
+
+#endif
+
+ ~scoped_ptr() // never throws
+ {
+#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
+ boost::sp_scalar_destructor_hook( px );
+#endif
+ boost::checked_delete( px );
+ }
+
+ void reset(T * p = 0) // never throws
+ {
+ BOOST_ASSERT( p == 0 || p != px ); // catch self-reset errors
+ this_type(p).swap(*this);
+ }
+
+ T & operator*() const // never throws
+ {
+ BOOST_ASSERT( px != 0 );
+ return *px;
+ }
+
+ T * operator->() const // never throws
+ {
+ BOOST_ASSERT( px != 0 );
+ return px;
+ }
+
+ T * get() const // never throws
+ {
+ return px;
+ }
+
+// implicit conversion to "bool"
+#include <boost/smart_ptr/detail/operator_bool.hpp>
+
+ void swap(scoped_ptr & b) // never throws
+ {
+ T * tmp = b.px;
+ b.px = px;
+ px = tmp;
+ }
+};
+
+template<class T> inline void swap(scoped_ptr<T> & a, scoped_ptr<T> & b) // never throws
+{
+ a.swap(b);
+}
+
+// get_pointer(p) is a generic way to say p.get()
+
+template<class T> inline T * get_pointer(scoped_ptr<T> const & p)
+{
+ return p.get();
+}
+
+} // namespace boost
+
+#endif // #ifndef BOOST_SMART_PTR_SCOPED_PTR_HPP_INCLUDED
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_array.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_array.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_array.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_array.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,147 @@
+#ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED
+#define BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED
+
+//
+// shared_array.hpp
+//
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001, 2002 Peter Dimov
+//
+// 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/smart_ptr/shared_array.htm for documentation.
+//
+
+#include <boost/config.hpp> // for broken compiler workarounds
+
+#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+#include <boost/smart_ptr/detail/shared_array_nmt.hpp>
+#else
+
+#include <memory> // TR1 cyclic inclusion fix
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+
+#include <boost/smart_ptr/detail/shared_count.hpp>
+#include <boost/detail/workaround.hpp>
+
+#include <cstddef> // for std::ptrdiff_t
+#include <algorithm> // for std::swap
+#include <functional> // for std::less
+
+namespace boost
+{
+
+//
+// shared_array
+//
+// shared_array extends shared_ptr to arrays.
+// The array pointed to is deleted when the last shared_array pointing to it
+// is destroyed or reset.
+//
+
+template<class T> class shared_array
+{
+private:
+
+ // Borland 5.5.1 specific workarounds
+ typedef checked_array_deleter<T> deleter;
+ typedef shared_array<T> this_type;
+
+public:
+
+ typedef T element_type;
+
+ explicit shared_array(T * p = 0): px(p), pn(p, deleter())
+ {
+ }
+
+ //
+ // Requirements: D's copy constructor must not throw
+ //
+ // shared_array will release p by calling d(p)
+ //
+
+ template<class D> shared_array(T * p, D d): px(p), pn(p, d)
+ {
+ }
+
+// generated copy constructor, assignment, destructor are fine
+
+ void reset(T * p = 0)
+ {
+ BOOST_ASSERT(p == 0 || p != px);
+ this_type(p).swap(*this);
+ }
+
+ template <class D> void reset(T * p, D d)
+ {
+ this_type(p, d).swap(*this);
+ }
+
+ T & operator[] (std::ptrdiff_t i) const // never throws
+ {
+ BOOST_ASSERT(px != 0);
+ BOOST_ASSERT(i >= 0);
+ return px[i];
+ }
+
+ T * get() const // never throws
+ {
+ return px;
+ }
+
+// implicit conversion to "bool"
+#include <boost/smart_ptr/detail/operator_bool.hpp>
+
+ bool unique() const // never throws
+ {
+ return pn.unique();
+ }
+
+ long use_count() const // never throws
+ {
+ return pn.use_count();
+ }
+
+ void swap(shared_array<T> & other) // never throws
+ {
+ std::swap(px, other.px);
+ pn.swap(other.pn);
+ }
+
+private:
+
+ T * px; // contained pointer
+ detail::shared_count pn; // reference counter
+
+}; // shared_array
+
+template<class T> inline bool operator==(shared_array<T> const & a, shared_array<T> const & b) // never throws
+{
+ return a.get() == b.get();
+}
+
+template<class T> inline bool operator!=(shared_array<T> const & a, shared_array<T> const & b) // never throws
+{
+ return a.get() != b.get();
+}
+
+template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b) // never throws
+{
+ return std::less<T*>()(a.get(), b.get());
+}
+
+template<class T> void swap(shared_array<T> & a, shared_array<T> & b) // never throws
+{
+ a.swap(b);
+}
+
+} // namespace boost
+
+#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+
+#endif // #ifndef BOOST_SMART_PTR_SHARED_ARRAY_HPP_INCLUDED
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_ptr.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_ptr.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_ptr.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/shared_ptr.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,701 @@
+#ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
+#define BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
+
+//
+// shared_ptr.hpp
+//
+// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
+// Copyright (c) 2001-2008 Peter Dimov
+//
+// 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/smart_ptr/shared_ptr.htm for documentation.
+//
+
+#include <boost/config.hpp> // for broken compiler workarounds
+
+#if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+#include <boost/smart_ptr/detail/shared_ptr_nmt.hpp>
+#else
+
+// In order to avoid circular dependencies with Boost.TR1
+// we make sure that our include of <memory> doesn't try to
+// pull in the TR1 headers: that's why we use this header
+// rather than including <memory> directly:
+#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr
+
+#include <boost/assert.hpp>
+#include <boost/checked_delete.hpp>
+#include <boost/throw_exception.hpp>
+#include <boost/smart_ptr/detail/shared_count.hpp>
+#include <boost/detail/workaround.hpp>
+#include <boost/smart_ptr/detail/sp_convertible.hpp>
+
+#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
+#include <boost/smart_ptr/detail/spinlock_pool.hpp>
+#include <boost/memory_order.hpp>
+#endif
+
+#include <algorithm> // for std::swap
+#include <functional> // for std::less
+#include <typeinfo> // for std::bad_cast
+
+#if !defined(BOOST_NO_IOSTREAM)
+#if !defined(BOOST_NO_IOSFWD)
+#include <iosfwd> // for std::basic_ostream
+#else
+#include <ostream>
+#endif
+#endif
+
+#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
+# pragma warning(push)
+# pragma warning(disable:4284) // odd return type for operator->
+#endif
+
+namespace boost
+{
+
+template<class T> class shared_ptr;
+template<class T> class weak_ptr;
+template<class T> class enable_shared_from_this;
+template<class T> class enable_shared_from_this2;
+
+namespace detail
+{
+
+struct static_cast_tag {};
+struct const_cast_tag {};
+struct dynamic_cast_tag {};
+struct polymorphic_cast_tag {};
+
+template<class T> struct shared_ptr_traits
+{
+ typedef T & reference;
+};
+
+template<> struct shared_ptr_traits<void>
+{
+ typedef void reference;
+};
+
+#if !defined(BOOST_NO_CV_VOID_SPECIALIZATIONS)
+
+template<> struct shared_ptr_traits<void const>
+{
+ typedef void reference;
+};
+
+template<> struct shared_ptr_traits<void volatile>
+{
+ typedef void reference;
+};
+
+template<> struct shared_ptr_traits<void const volatile>
+{
+ typedef void reference;
+};
+
+#endif
+
+// enable_shared_from_this support
+
+template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> const * ppx, Y const * py, boost::enable_shared_from_this< T > const * pe )
+{
+ if( pe != 0 )
+ {
+ pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) );
+ }
+}
+
+template< class X, class Y, class T > inline void sp_enable_shared_from_this( boost::shared_ptr<X> * ppx, Y const * py, boost::enable_shared_from_this2< T > const * pe )
+{
+ if( pe != 0 )
+ {
+ pe->_internal_accept_owner( ppx, const_cast< Y* >( py ) );
+ }
+}
+
+#ifdef _MANAGED
+
+// Avoid C4793, ... causes native code generation
+
+struct sp_any_pointer
+{
+ template<class T> sp_any_pointer( T* ) {}
+};
+
+inline void sp_enable_shared_from_this( sp_any_pointer, sp_any_pointer, sp_any_pointer )
+{
+}
+
+#else // _MANAGED
+
+inline void sp_enable_shared_from_this( ... )
+{
+}
+
+#endif // _MANAGED
+
+#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION ) && !defined( BOOST_NO_AUTO_PTR )
+
+// rvalue auto_ptr support based on a technique by Dave Abrahams
+
+template< class T, class R > struct sp_enable_if_auto_ptr
+{
+};
+
+template< class T, class R > struct sp_enable_if_auto_ptr< std::auto_ptr< T >, R >
+{
+ typedef R type;
+};
+
+#endif
+
+} // namespace detail
+
+
+//
+// shared_ptr
+//
+// An enhanced relative of scoped_ptr with reference counted copy semantics.
+// The object pointed to is deleted when the last shared_ptr pointing to it
+// is destroyed or reset.
+//
+
+template<class T> class shared_ptr
+{
+private:
+
+ // Borland 5.5.1 specific workaround
+ typedef shared_ptr<T> this_type;
+
+public:
+
+ typedef T element_type;
+ typedef T value_type;
+ typedef T * pointer;
+ typedef typename boost::detail::shared_ptr_traits<T>::reference reference;
+
+ shared_ptr(): px(0), pn() // never throws in 1.30+
+ {
+ }
+
+ template<class Y>
+ explicit shared_ptr( Y * p ): px( p ), pn( p ) // Y must be complete
+ {
+ boost::detail::sp_enable_shared_from_this( this, p, p );
+ }
+
+ //
+ // Requirements: D's copy constructor must not throw
+ //
+ // shared_ptr will release p by calling d(p)
+ //
+
+ template<class Y, class D> shared_ptr(Y * p, D d): px(p), pn(p, d)
+ {
+ boost::detail::sp_enable_shared_from_this( this, p, p );
+ }
+
+ // As above, but with allocator. A's copy constructor shall not throw.
+
+ template<class Y, class D, class A> shared_ptr( Y * p, D d, A a ): px( p ), pn( p, d, a )
+ {
+ boost::detail::sp_enable_shared_from_this( this, p, p );
+ }
+
+// generated copy constructor, destructor are fine
+
+ template<class Y>
+ explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw
+ {
+ // it is now safe to copy r.px, as pn(r.pn) did not throw
+ px = r.px;
+ }
+
+ template<class Y>
+ shared_ptr( weak_ptr<Y> const & r, boost::detail::sp_nothrow_tag ): px( 0 ), pn( r.pn, boost::detail::sp_nothrow_tag() ) // never throws
+ {
+ if( !pn.empty() )
+ {
+ px = r.px;
+ }
+ }
+
+ template<class Y>
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
+
+ shared_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
+
+#else
+
+ shared_ptr( shared_ptr<Y> const & r )
+
+#endif
+ : px( r.px ), pn( r.pn ) // never throws
+ {
+ }
+
+ // aliasing
+ template< class Y >
+ shared_ptr( shared_ptr<Y> const & r, T * p ): px( p ), pn( r.pn ) // never throws
+ {
+ }
+
+ template<class Y>
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::static_cast_tag): px(static_cast<element_type *>(r.px)), pn(r.pn)
+ {
+ }
+
+ template<class Y>
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::const_cast_tag): px(const_cast<element_type *>(r.px)), pn(r.pn)
+ {
+ }
+
+ template<class Y>
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::dynamic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
+ {
+ if(px == 0) // need to allocate new counter -- the cast failed
+ {
+ pn = boost::detail::shared_count();
+ }
+ }
+
+ template<class Y>
+ shared_ptr(shared_ptr<Y> const & r, boost::detail::polymorphic_cast_tag): px(dynamic_cast<element_type *>(r.px)), pn(r.pn)
+ {
+ if(px == 0)
+ {
+ boost::throw_exception(std::bad_cast());
+ }
+ }
+
+#ifndef BOOST_NO_AUTO_PTR
+
+ template<class Y>
+ explicit shared_ptr(std::auto_ptr<Y> & r): px(r.get()), pn()
+ {
+ Y * tmp = r.get();
+ pn = boost::detail::shared_count(r);
+ boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
+ }
+
+#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+ template<class Ap>
+ explicit shared_ptr( Ap r, typename boost::detail::sp_enable_if_auto_ptr<Ap, int>::type = 0 ): px( r.get() ), pn()
+ {
+ typename Ap::element_type * tmp = r.get();
+ pn = boost::detail::shared_count( r );
+ boost::detail::sp_enable_shared_from_this( this, tmp, tmp );
+ }
+
+
+#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#endif // BOOST_NO_AUTO_PTR
+
+ // assignment
+
+ shared_ptr & operator=( shared_ptr const & r ) // never throws
+ {
+ this_type(r).swap(*this);
+ return *this;
+ }
+
+#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1400)
+
+ template<class Y>
+ shared_ptr & operator=(shared_ptr<Y> const & r) // never throws
+ {
+ this_type(r).swap(*this);
+ return *this;
+ }
+
+#endif
+
+#ifndef BOOST_NO_AUTO_PTR
+
+ template<class Y>
+ shared_ptr & operator=( std::auto_ptr<Y> & r )
+ {
+ this_type(r).swap(*this);
+ return *this;
+ }
+
+#if !defined( BOOST_NO_SFINAE ) && !defined( BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION )
+
+ template<class Ap>
+ typename boost::detail::sp_enable_if_auto_ptr< Ap, shared_ptr & >::type operator=( Ap r )
+ {
+ this_type( r ).swap( *this );
+ return *this;
+ }
+
+
+#endif // BOOST_NO_SFINAE, BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
+
+#endif // BOOST_NO_AUTO_PTR
+
+// Move support
+
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+ shared_ptr( shared_ptr && r ): px( r.px ), pn() // never throws
+ {
+ pn.swap( r.pn );
+ r.px = 0;
+ }
+
+ template<class Y>
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
+
+ shared_ptr( shared_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
+
+#else
+
+ shared_ptr( shared_ptr<Y> && r )
+
+#endif
+ : px( r.px ), pn() // never throws
+ {
+ pn.swap( r.pn );
+ r.px = 0;
+ }
+
+ shared_ptr & operator=( shared_ptr && r ) // never throws
+ {
+ this_type( static_cast< shared_ptr && >( r ) ).swap( *this );
+ return *this;
+ }
+
+ template<class Y>
+ shared_ptr & operator=( shared_ptr<Y> && r ) // never throws
+ {
+ this_type( static_cast< shared_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+
+#endif
+
+ void reset() // never throws in 1.30+
+ {
+ this_type().swap(*this);
+ }
+
+ template<class Y> void reset(Y * p) // Y must be complete
+ {
+ BOOST_ASSERT(p == 0 || p != px); // catch self-reset errors
+ this_type(p).swap(*this);
+ }
+
+ template<class Y, class D> void reset( Y * p, D d )
+ {
+ this_type( p, d ).swap( *this );
+ }
+
+ template<class Y, class D, class A> void reset( Y * p, D d, A a )
+ {
+ this_type( p, d, a ).swap( *this );
+ }
+
+ template<class Y> void reset( shared_ptr<Y> const & r, T * p )
+ {
+ this_type( r, p ).swap( *this );
+ }
+
+ reference operator* () const // never throws
+ {
+ BOOST_ASSERT(px != 0);
+ return *px;
+ }
+
+ T * operator-> () const // never throws
+ {
+ BOOST_ASSERT(px != 0);
+ return px;
+ }
+
+ T * get() const // never throws
+ {
+ return px;
+ }
+
+// implicit conversion to "bool"
+#include <boost/smart_ptr/detail/operator_bool.hpp>
+
+ bool unique() const // never throws
+ {
+ return pn.unique();
+ }
+
+ long use_count() const // never throws
+ {
+ return pn.use_count();
+ }
+
+ void swap(shared_ptr<T> & other) // never throws
+ {
+ std::swap(px, other.px);
+ pn.swap(other.pn);
+ }
+
+ template<class Y> bool _internal_less(shared_ptr<Y> const & rhs) const
+ {
+ return pn < rhs.pn;
+ }
+
+ void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const
+ {
+ return pn.get_deleter( ti );
+ }
+
+ bool _internal_equiv( shared_ptr const & r ) const
+ {
+ return px == r.px && pn == r.pn;
+ }
+
+// Tasteless as this may seem, making all members public allows member templates
+// to work in the absence of member template friends. (Matthew Langston)
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+
+private:
+
+ template<class Y> friend class shared_ptr;
+ template<class Y> friend class weak_ptr;
+
+
+#endif
+
+ T * px; // contained pointer
+ boost::detail::shared_count pn; // reference counter
+
+}; // shared_ptr
+
+template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b)
+{
+ return a.get() == b.get();
+}
+
+template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b)
+{
+ return a.get() != b.get();
+}
+
+#if __GNUC__ == 2 && __GNUC_MINOR__ <= 96
+
+// Resolve the ambiguity between our op!= and the one in rel_ops
+
+template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> const & b)
+{
+ return a.get() != b.get();
+}
+
+#endif
+
+template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b)
+{
+ return a._internal_less(b);
+}
+
+template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b)
+{
+ a.swap(b);
+}
+
+template<class T, class U> shared_ptr<T> static_pointer_cast(shared_ptr<U> const & r)
+{
+ return shared_ptr<T>(r, boost::detail::static_cast_tag());
+}
+
+template<class T, class U> shared_ptr<T> const_pointer_cast(shared_ptr<U> const & r)
+{
+ return shared_ptr<T>(r, boost::detail::const_cast_tag());
+}
+
+template<class T, class U> shared_ptr<T> dynamic_pointer_cast(shared_ptr<U> const & r)
+{
+ return shared_ptr<T>(r, boost::detail::dynamic_cast_tag());
+}
+
+// shared_*_cast names are deprecated. Use *_pointer_cast instead.
+
+template<class T, class U> shared_ptr<T> shared_static_cast(shared_ptr<U> const & r)
+{
+ return shared_ptr<T>(r, boost::detail::static_cast_tag());
+}
+
+template<class T, class U> shared_ptr<T> shared_dynamic_cast(shared_ptr<U> const & r)
+{
+ return shared_ptr<T>(r, boost::detail::dynamic_cast_tag());
+}
+
+template<class T, class U> shared_ptr<T> shared_polymorphic_cast(shared_ptr<U> const & r)
+{
+ return shared_ptr<T>(r, boost::detail::polymorphic_cast_tag());
+}
+
+template<class T, class U> shared_ptr<T> shared_polymorphic_downcast(shared_ptr<U> const & r)
+{
+ BOOST_ASSERT(dynamic_cast<T *>(r.get()) == r.get());
+ return shared_static_cast<T>(r);
+}
+
+// get_pointer() enables boost::mem_fn to recognize shared_ptr
+
+template<class T> inline T * get_pointer(shared_ptr<T> const & p)
+{
+ return p.get();
+}
+
+// operator<<
+
+#if !defined(BOOST_NO_IOSTREAM)
+
+#if defined(BOOST_NO_TEMPLATED_IOSTREAMS) || ( defined(__GNUC__) && (__GNUC__ < 3) )
+
+template<class Y> std::ostream & operator<< (std::ostream & os, shared_ptr<Y> const & p)
+{
+ os << p.get();
+ return os;
+}
+
+#else
+
+// in STLport's no-iostreams mode no iostream symbols can be used
+#ifndef _STLP_NO_IOSTREAMS
+
+# if defined(BOOST_MSVC) && BOOST_WORKAROUND(BOOST_MSVC, < 1300 && __SGI_STL_PORT)
+// MSVC6 has problems finding std::basic_ostream through the using declaration in namespace _STL
+using std::basic_ostream;
+template<class E, class T, class Y> basic_ostream<E, T> & operator<< (basic_ostream<E, T> & os, shared_ptr<Y> const & p)
+# else
+template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std::basic_ostream<E, T> & os, shared_ptr<Y> const & p)
+# endif
+{
+ os << p.get();
+ return os;
+}
+
+#endif // _STLP_NO_IOSTREAMS
+
+#endif // __GNUC__ < 3
+
+#endif // !defined(BOOST_NO_IOSTREAM)
+
+// get_deleter
+
+#if ( defined(__GNUC__) && BOOST_WORKAROUND(__GNUC__, < 3) ) || \
+ ( defined(__EDG_VERSION__) && BOOST_WORKAROUND(__EDG_VERSION__, <= 238) ) || \
+ ( defined(__HP_aCC) && BOOST_WORKAROUND(__HP_aCC, <= 33500) )
+
+// g++ 2.9x doesn't allow static_cast<X const *>(void *)
+// apparently EDG 2.38 and HP aCC A.03.35 also don't accept it
+
+template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
+{
+ void const * q = p._internal_get_deleter(BOOST_SP_TYPEID(D));
+ return const_cast<D *>(static_cast<D const *>(q));
+}
+
+#else
+
+template<class D, class T> D * get_deleter(shared_ptr<T> const & p)
+{
+ return static_cast<D *>(p._internal_get_deleter(BOOST_SP_TYPEID(D)));
+}
+
+#endif
+
+// atomic access
+
+#if !defined(BOOST_SP_NO_ATOMIC_ACCESS)
+
+template<class T> inline bool atomic_is_lock_free( shared_ptr<T> const * /*p*/ )
+{
+ return false;
+}
+
+template<class T> shared_ptr<T> atomic_load( shared_ptr<T> const * p )
+{
+ boost::detail::spinlock_pool<2>::scoped_lock lock( p );
+ return *p;
+}
+
+template<class T> inline shared_ptr<T> atomic_load_explicit( shared_ptr<T> const * p, memory_order /*mo*/ )
+{
+ return atomic_load( p );
+}
+
+template<class T> void atomic_store( shared_ptr<T> * p, shared_ptr<T> r )
+{
+ boost::detail::spinlock_pool<2>::scoped_lock lock( p );
+ p->swap( r );
+}
+
+template<class T> inline void atomic_store_explicit( shared_ptr<T> * p, shared_ptr<T> r, memory_order /*mo*/ )
+{
+ atomic_store( p, r ); // std::move( r )
+}
+
+template<class T> shared_ptr<T> atomic_exchange( shared_ptr<T> * p, shared_ptr<T> r )
+{
+ boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p );
+
+ sp.lock();
+ p->swap( r );
+ sp.unlock();
+
+ return r; // return std::move( r )
+}
+
+template<class T> shared_ptr<T> atomic_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> r, memory_order /*mo*/ )
+{
+ return atomic_exchange( p, r ); // std::move( r )
+}
+
+template<class T> bool atomic_compare_exchange( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w )
+{
+ boost::detail::spinlock & sp = boost::detail::spinlock_pool<2>::spinlock_for( p );
+
+ sp.lock();
+
+ if( p->_internal_equiv( *v ) )
+ {
+ p->swap( w );
+
+ sp.unlock();
+
+ return true;
+ }
+ else
+ {
+ shared_ptr<T> tmp( *p );
+
+ sp.unlock();
+
+ tmp.swap( *v );
+ return false;
+ }
+}
+
+template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * p, shared_ptr<T> * v, shared_ptr<T> w, memory_order /*success*/, memory_order /*failure*/ )
+{
+ return atomic_compare_exchange( p, v, w ); // std::move( w )
+}
+
+#endif
+
+} // namespace boost
+
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
+#endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES)
+
+#endif // #ifndef BOOST_SMART_PTR_SHARED_PTR_HPP_INCLUDED
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/weak_ptr.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/weak_ptr.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/weak_ptr.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/smart_ptr/weak_ptr.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,230 @@
+#ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED
+#define BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED
+
+//
+// weak_ptr.hpp
+//
+// Copyright (c) 2001, 2002, 2003 Peter Dimov
+//
+// 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/smart_ptr/weak_ptr.htm for documentation.
+//
+
+#include <memory> // boost.TR1 include order fix
+#include <boost/smart_ptr/detail/shared_count.hpp>
+#include <boost/smart_ptr/shared_ptr.hpp>
+
+#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash
+# pragma warning(push)
+# pragma warning(disable:4284) // odd return type for operator->
+#endif
+
+namespace boost
+{
+
+template<class T> class weak_ptr
+{
+private:
+
+ // Borland 5.5.1 specific workarounds
+ typedef weak_ptr<T> this_type;
+
+public:
+
+ typedef T element_type;
+
+ weak_ptr(): px(0), pn() // never throws in 1.30+
+ {
+ }
+
+// generated copy constructor, assignment, destructor are fine
+
+
+//
+// The "obvious" converting constructor implementation:
+//
+// template<class Y>
+// weak_ptr(weak_ptr<Y> const & r): px(r.px), pn(r.pn) // never throws
+// {
+// }
+//
+// has a serious problem.
+//
+// r.px may already have been invalidated. The px(r.px)
+// conversion may require access to *r.px (virtual inheritance).
+//
+// It is not possible to avoid spurious access violations since
+// in multithreaded programs r.px may be invalidated at any point.
+//
+
+ template<class Y>
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
+
+ weak_ptr( weak_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
+
+#else
+
+ weak_ptr( weak_ptr<Y> const & r )
+
+#endif
+ : px(r.lock().get()), pn(r.pn) // never throws
+ {
+ }
+
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+ template<class Y>
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
+
+ weak_ptr( weak_ptr<Y> && r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
+
+#else
+
+ weak_ptr( weak_ptr<Y> && r )
+
+#endif
+ : px( r.lock().get() ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
+ {
+ r.px = 0;
+ }
+
+ // for better efficiency in the T == Y case
+ weak_ptr( weak_ptr && r ): px( r.px ), pn( static_cast< boost::detail::weak_count && >( r.pn ) ) // never throws
+ {
+ r.px = 0;
+ }
+
+ // for better efficiency in the T == Y case
+ weak_ptr & operator=( weak_ptr && r ) // never throws
+ {
+ this_type( static_cast< weak_ptr && >( r ) ).swap( *this );
+ return *this;
+ }
+
+
+#endif
+
+ template<class Y>
+#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
+
+ weak_ptr( shared_ptr<Y> const & r, typename boost::detail::sp_enable_if_convertible<Y,T>::type = boost::detail::sp_empty() )
+
+#else
+
+ weak_ptr( shared_ptr<Y> const & r )
+
+#endif
+ : px( r.px ), pn( r.pn ) // never throws
+ {
+ }
+
+#if !defined(BOOST_MSVC) || (BOOST_MSVC >= 1300)
+
+ template<class Y>
+ weak_ptr & operator=(weak_ptr<Y> const & r) // never throws
+ {
+ px = r.lock().get();
+ pn = r.pn;
+ return *this;
+ }
+
+#if defined( BOOST_HAS_RVALUE_REFS )
+
+ template<class Y>
+ weak_ptr & operator=( weak_ptr<Y> && r )
+ {
+ this_type( static_cast< weak_ptr<Y> && >( r ) ).swap( *this );
+ return *this;
+ }
+
+#endif
+
+ template<class Y>
+ weak_ptr & operator=(shared_ptr<Y> const & r) // never throws
+ {
+ px = r.px;
+ pn = r.pn;
+ return *this;
+ }
+
+#endif
+
+ shared_ptr<T> lock() const // never throws
+ {
+ return shared_ptr<element_type>( *this, boost::detail::sp_nothrow_tag() );
+ }
+
+ long use_count() const // never throws
+ {
+ return pn.use_count();
+ }
+
+ bool expired() const // never throws
+ {
+ return pn.use_count() == 0;
+ }
+
+ bool _empty() const // extension, not in std::weak_ptr
+ {
+ return pn.empty();
+ }
+
+ void reset() // never throws in 1.30+
+ {
+ this_type().swap(*this);
+ }
+
+ void swap(this_type & other) // never throws
+ {
+ std::swap(px, other.px);
+ pn.swap(other.pn);
+ }
+
+ void _internal_assign(T * px2, boost::detail::shared_count const & pn2)
+ {
+ px = px2;
+ pn = pn2;
+ }
+
+ template<class Y> bool _internal_less(weak_ptr<Y> const & rhs) const
+ {
+ return pn < rhs.pn;
+ }
+
+// Tasteless as this may seem, making all members public allows member templates
+// to work in the absence of member template friends. (Matthew Langston)
+
+#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+
+private:
+
+ template<class Y> friend class weak_ptr;
+ template<class Y> friend class shared_ptr;
+
+#endif
+
+ T * px; // contained pointer
+ boost::detail::weak_count pn; // reference counter
+
+}; // weak_ptr
+
+template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b)
+{
+ return a._internal_less(b);
+}
+
+template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b)
+{
+ a.swap(b);
+}
+
+} // namespace boost
+
+#ifdef BOOST_MSVC
+# pragma warning(pop)
+#endif
+
+#endif // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/name_generator.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/name_generator.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/name_generator.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/name_generator.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,125 @@
+// Boost name_generator.hpp header file ----------------------------------------------//
+
+// Copyright 2010 Andy Tompkins.
+// 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)
+
+#ifndef BOOST_UUID_NAME_GENERATOR_HPP
+#define BOOST_UUID_NAME_GENERATOR_HPP
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/sha1.hpp>
+#include <boost/assert.hpp>
+#include <string>
+#include <cstring> // for strlen, wcslen
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+ using ::strlen;
+ using ::wcslen;
+} //namespace std
+#endif //BOOST_NO_STDC_NAMESPACE
+
+namespace boost {
+namespace uuids {
+
+// generate a name-based uuid
+// TODO: add in common namesspace uuids
+class name_generator {
+public:
+ typedef uuid result_type;
+
+ explicit name_generator(uuid const& namespace_uuid)
+ : namespace_uuid(namespace_uuid)
+ {}
+
+ uuid operator()(const char* name) {
+ reset();
+ process_characters(name, std::strlen(name));
+ return sha_to_uuid();
+ }
+
+ uuid operator()(const wchar_t* name) {
+ reset();
+ process_characters(name, std::wcslen(name));
+ return sha_to_uuid();
+ }
+
+ template <typename ch, typename char_traits, typename alloc>
+ uuid operator()(std::basic_string<ch, char_traits, alloc> const& name) {
+ reset();
+ process_characters(name.c_str(), name.length());
+ return sha_to_uuid();
+ }
+
+ uuid operator()(void const* buffer, std::size_t byte_count) {
+ reset();
+ sha.process_bytes(buffer, byte_count);
+ return sha_to_uuid();
+ };
+
+private:
+ // we convert all characters to uint32_t so that each
+ // character is 4 bytes reguardless of sizeof(char) or
+ // sizeof(wchar_t). We want the name string on any
+ // platform / compiler to generate the same uuid
+ // except for char
+ template <typename char_type>
+ void process_characters(char_type const*const characters, size_t count) {
+ BOOST_ASSERT(sizeof(uint32_t) >= sizeof(char_type));
+
+ for (size_t i=0; i<count; i++) {
+ uint32_t c = characters[i];
+ sha.process_byte( (c >> 0) && 0xFF );
+ sha.process_byte( (c >> 8) && 0xFF );
+ sha.process_byte( (c >> 16) && 0xFF );
+ sha.process_byte( (c >> 24) && 0xFF );
+ }
+ }
+
+ void process_characters(char const*const characters, size_t count) {
+ sha.process_bytes(characters, count);
+ }
+
+ void reset()
+ {
+ sha.reset();
+ sha.process_bytes(namespace_uuid.begin(), namespace_uuid.size());
+ }
+
+ uuid sha_to_uuid()
+ {
+ unsigned int digest[5];
+
+ sha.get_digest(digest);
+
+ uuid u;
+ for (int i=0; i<4; ++i) {
+ *(u.begin() + i*4+0) = ((digest[i] >> 24) & 0xFF);
+ *(u.begin() + i*4+1) = ((digest[i] >> 16) & 0xFF);
+ *(u.begin() + i*4+2) = ((digest[i] >> 8) & 0xFF);
+ *(u.begin() + i*4+3) = ((digest[i] >> 0) & 0xFF);
+ }
+
+ // set variant
+ // must be 0b10xxxxxx
+ *(u.begin()+8) &= 0xBF;
+ *(u.begin()+8) |= 0x80;
+
+ // set version
+ // must be 0b0101xxxx
+ *(u.begin()+6) &= 0x5F; //0b01011111
+ *(u.begin()+6) |= 0x50; //0b01010000
+
+ return u;
+ }
+
+private:
+ uuid namespace_uuid;
+ detail::sha1 sha;
+};
+
+}} // namespace boost::uuids
+
+#endif // BOOST_UUID_NAME_GENERATOR_HPP
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/nil_generator.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/nil_generator.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/nil_generator.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/nil_generator.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,34 @@
+// Boost nil_generator.hpp header file ----------------------------------------------//
+
+// Copyright 2010 Andy Tompkins.
+// 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)
+
+#ifndef BOOST_UUID_NIL_GENERATOR_HPP
+#define BOOST_UUID_NIL_GENERATOR_HPP
+
+#include <boost/uuid/uuid.hpp>
+
+namespace boost {
+namespace uuids {
+
+// generate a nil uuid
+struct nil_generator {
+ typedef uuid result_type;
+
+ uuid operator()() const {
+ // initialize to all zeros
+ uuid u = {{0}};
+ return u;
+ }
+};
+
+inline uuid nil_uuid() {
+ return nil_generator()();
+}
+
+}} // namespace boost::uuids
+
+#endif // BOOST_UUID_NIL_GENERATOR_HPP
+
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/random_generator.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/random_generator.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/random_generator.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/random_generator.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,118 @@
+// Boost random_generator.hpp header file ----------------------------------------------//
+
+// Copyright 2010 Andy Tompkins.
+// 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)
+
+#ifndef BOOST_UUID_RANDOM_GENERATOR_HPP
+#define BOOST_UUID_RANDOM_GENERATOR_HPP
+
+#include <boost/uuid/uuid.hpp>
+#include <boost/uuid/seed_rng.hpp>
+#include <boost/random/uniform_int.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/random/mersenne_twister.hpp>
+#include <boost/assert.hpp>
+#include <boost/shared_ptr.hpp>
+#include <limits>
+
+namespace boost {
+namespace uuids {
+
+// generate a random-based uuid
+template <typename UniformRandomNumberGenerator>
+class basic_random_generator {
+private:
+ typedef uniform_int<unsigned long> distribution_type;
+ typedef variate_generator<UniformRandomNumberGenerator*, distribution_type> generator_type;
+
+ struct null_deleter
+ {
+ void operator()(void const *) const {}
+ };
+
+public:
+ typedef uuid result_type;
+
+ // default constructor creates the random number generator
+ basic_random_generator()
+ : pURNG(new UniformRandomNumberGenerator)
+ , generator
+ ( pURNG.get()
+ , distribution_type
+ ( (std::numeric_limits<unsigned long>::min)()
+ , (std::numeric_limits<unsigned long>::max)()
+ )
+ )
+ {
+ // seed the random number generator
+ detail::seed(*pURNG);
+ }
+
+ // keep a reference to a random number generator
+ // don't seed a given random number generator
+ explicit basic_random_generator(UniformRandomNumberGenerator& gen)
+ : pURNG(&gen, null_deleter())
+ , generator
+ ( pURNG.get()
+ , distribution_type
+ ( (std::numeric_limits<unsigned long>::min)()
+ , (std::numeric_limits<unsigned long>::max)()
+ )
+ )
+ {}
+
+ // keep a pointer to a random number generator
+ // don't seed a given random number generator
+ explicit basic_random_generator(UniformRandomNumberGenerator* pGen)
+ : pURNG(pGen, null_deleter())
+ , generator
+ ( pURNG.get()
+ , distribution_type
+ ( (std::numeric_limits<unsigned long>::min)()
+ , (std::numeric_limits<unsigned long>::max)()
+ )
+ )
+ {
+ BOOST_ASSERT(pURNG);
+ }
+
+ uuid operator()()
+ {
+ uuid u;
+
+ int i=0;
+ unsigned long random_value = generator();
+ for (uuid::iterator it=u.begin(); it!=u.end(); ++it, ++i) {
+ if (i==sizeof(unsigned long)) {
+ random_value = generator();
+ i = 0;
+ }
+
+ *it = ((random_value >> (i*8)) & 0xFF);
+ }
+
+ // set variant
+ // must be 0b10xxxxxx
+ *(u.begin()+8) &= 0xBF;
+ *(u.begin()+8) |= 0x80;
+
+ // set version
+ // must be 0b0100xxxx
+ *(u.begin()+6) &= 0x4F; //0b01001111
+ *(u.begin()+6) |= 0x40; //0b01000000
+
+ return u;
+ }
+
+private:
+ shared_ptr<UniformRandomNumberGenerator> pURNG;
+ generator_type generator;
+};
+
+typedef basic_random_generator<mt19937> random_generator;
+
+}} // namespace boost::uuids
+
+#endif //BOOST_UUID_RANDOM_GENERATOR_HPP
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/seed_rng.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/seed_rng.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/seed_rng.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/seed_rng.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,262 @@
+// Boost seed_rng.hpp header file ----------------------------------------------//
+
+// Copyright 2007 Andy Tompkins.
+// 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)
+
+// Revision History
+// 09 Nov 2007 - Initial Revision
+// 25 Feb 2008 - moved to namespace boost::uuids::detail
+// 28 Nov 2009 - disabled deprecated warnings for MSVC
+
+// seed_rng models a UniformRandomNumberGenerator (see Boost.Random).
+// Random number generators are hard to seed well. This is intended to provide
+// good seed values for random number generators.
+// It creates random numbers from a sha1 hash of data from a variary of sources,
+// all of which are standard function calls. It produces random numbers slowly.
+// Peter Dimov provided the details of sha1_random_digest_().
+// see http://archives.free.net.ph/message/20070507.175609.4c4f503a.en.html
+
+#ifndef BOOST_UUID_SEED_RNG_HPP
+#define BOOST_UUID_SEED_RNG_HPP
+
+#include <boost/config.hpp>
+#include <cstring> // for memcpy
+#include <limits>
+#include <memory.h>
+#include <ctime> // for time_t, time, clock_t, clock
+#include <cstdlib> // for rand
+#include <cstdio> // for FILE, fopen, fread, fclose
+#include <boost/uuid/sha1.hpp>
+//#include <boost/nondet_random.hpp> //forward declare boost::random_device
+
+// can't use boost::generator_iterator since boost::random number seed(Iter&, Iter)
+// functions need a last iterator
+//#include <boost/generator_iterator.hpp>
+# include <boost/iterator/iterator_facade.hpp>
+
+#if defined(_MSC_VER)
+#pragma warning(push) // Save warning settings.
+#pragma warning(disable : 4996) // Disable deprecated std::fopen
+#endif
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+ using ::memcpy;
+ using ::time_t;
+ using ::time;
+ using ::clock_t;
+ using ::clock;
+ using ::rand;
+ using ::FILE;
+ using ::fopen;
+ using ::fread;
+ using ::fclose;
+} //namespace std
+#endif
+
+// forward declare random number generators
+namespace boost {
+class random_device;
+} //namespace boost
+
+namespace boost {
+namespace uuids {
+namespace detail {
+
+// should this be part of Boost.Random?
+class seed_rng
+{
+public:
+ typedef unsigned int result_type;
+ BOOST_STATIC_CONSTANT(bool, has_fixed_range = false);
+ //BOOST_STATIC_CONSTANT(unsigned int, min_value = 0);
+ //BOOST_STATIC_CONSTANT(unsigned int, max_value = UINT_MAX);
+
+public:
+ // note: rd_ intentionally left uninitialized
+ seed_rng()
+ : rd_index_(5)
+ , random_(std::fopen( "/dev/urandom", "rb" ))
+ {}
+
+ ~seed_rng()
+ {
+ if (random_) {
+ std::fclose(random_);
+ }
+ }
+
+ result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const
+ {
+ return (std::numeric_limits<result_type>::min)();
+ }
+ result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const
+ {
+ return (std::numeric_limits<result_type>::max)();
+ }
+
+ result_type operator()()
+ {
+ if (rd_index_ >= 5) {
+ //get new digest
+ sha1_random_digest_();
+
+ rd_index_ = 0;
+ }
+
+ return rd_[rd_index_++];
+ }
+
+private:
+ static unsigned int * sha1_random_digest_state_()
+ {
+ // intentionally left uninitialized
+ static unsigned int state[ 5 ];
+ return state;
+ }
+
+ void sha1_random_digest_()
+ {
+ boost::uuids::detail::sha1 sha;
+
+ unsigned int * ps = sha1_random_digest_state_();
+
+ unsigned int state[ 5 ];
+ std::memcpy( state, ps, sizeof( state ) ); // harmless data race
+
+ sha.process_bytes( (unsigned char const*)state, sizeof( state ) );
+ sha.process_bytes( (unsigned char const*)&ps, sizeof( ps ) );
+
+ {
+ std::time_t tm = std::time( 0 );
+ sha.process_bytes( (unsigned char const*)&tm, sizeof( tm ) );
+ }
+
+ {
+ std::clock_t ck = std::clock();
+ sha.process_bytes( (unsigned char const*)&ck, sizeof( ck ) );
+ }
+
+ {
+ unsigned int rn[] = { std::rand(), std::rand(), std::rand() };
+ sha.process_bytes( (unsigned char const*)rn, sizeof( rn ) );
+ }
+
+ {
+ // intentionally left uninitialized
+ unsigned char buffer[ 20 ];
+
+ if(random_)
+ {
+ std::fread( buffer, 1, 20, random_ );
+ }
+
+ // using an uninitialized buffer[] if fopen fails
+ // intentional, we rely on its contents being random
+ sha.process_bytes( buffer, sizeof( buffer ) );
+ }
+
+ {
+ // *p is intentionally left uninitialized
+ unsigned int * p = new unsigned int;
+
+ sha.process_bytes( (unsigned char const*)p, sizeof( *p ) );
+ sha.process_bytes( (unsigned char const*)&p, sizeof( p ) );
+
+ delete p;
+ }
+
+ sha.process_bytes( (unsigned char const*)rd_, sizeof( rd_ ) );
+
+ unsigned int digest[ 5 ];
+ sha.get_digest( digest );
+
+ for( int i = 0; i < 5; ++i )
+ {
+ // harmless data race
+ ps[ i ] ^= digest[ i ];
+ rd_[ i ] ^= digest[ i ];
+ }
+ }
+
+private:
+ unsigned int rd_[5];
+ int rd_index_;
+ std::FILE * random_;
+
+private: // make seed_rng noncopyable
+ seed_rng(seed_rng const&);
+ seed_rng& operator=(seed_rng const&);
+};
+
+// almost a copy of boost::generator_iterator
+// but default constructor sets m_g to NULL
+template <class Generator>
+class generator_iterator
+ : public iterator_facade<
+ generator_iterator<Generator>
+ , typename Generator::result_type
+ , single_pass_traversal_tag
+ , typename Generator::result_type const&
+ >
+{
+ typedef iterator_facade<
+ generator_iterator<Generator>
+ , typename Generator::result_type
+ , single_pass_traversal_tag
+ , typename Generator::result_type const&
+ > super_t;
+
+ public:
+ generator_iterator() : m_g(NULL) {}
+ generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {}
+
+ void increment()
+ {
+ m_value = (*m_g)();
+ }
+
+ const typename Generator::result_type&
+ dereference() const
+ {
+ return m_value;
+ }
+
+ bool equal(generator_iterator const& y) const
+ {
+ return this->m_g == y.m_g && this->m_value == y.m_value;
+ }
+
+ private:
+ Generator* m_g;
+ typename Generator::result_type m_value;
+};
+
+// seed() seeds a random number generator with good seed values
+
+template <typename UniformRandomNumberGenerator>
+inline void seed(UniformRandomNumberGenerator& rng)
+{
+ seed_rng seed_gen;
+ generator_iterator<seed_rng> begin(&seed_gen);
+ generator_iterator<seed_rng> end;
+ rng.seed(begin, end);
+}
+
+// random_device does not / can not be seeded
+template <>
+inline void seed<boost::random_device>(boost::random_device&) {}
+
+// random_device does not / can not be seeded
+template <>
+inline void seed<seed_rng>(seed_rng&) {}
+
+}}} //namespace boost::uuids::detail
+
+#if defined(_MSC_VER)
+#pragma warning(pop) // Restore warnings to previous state.
+#endif
+
+#endif
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/sha1.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/sha1.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/sha1.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/sha1.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,208 @@
+// boost/uuid/sha1.hpp header file ----------------------------------------------//
+
+// Copyright 2007 Andy Tompkins.
+// 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)
+
+// Revision History
+// 29 May 2007 - Initial Revision
+// 25 Feb 2008 - moved to namespace boost::uuids::detail
+
+// This is a byte oriented implementation
+// Note: this implementation does not handle message longer than
+// 2^32 bytes.
+
+#ifndef BOOST_UUID_SHA1_H
+#define BOOST_UUID_SHA1_H
+
+#include <boost/static_assert.hpp>
+#include <cstddef>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+ using ::size_t;
+} // namespace std
+#endif
+
+namespace boost {
+namespace uuids {
+namespace detail {
+
+BOOST_STATIC_ASSERT(sizeof(unsigned char)*8 == 8);
+BOOST_STATIC_ASSERT(sizeof(unsigned int)*8 == 32);
+
+inline unsigned int left_rotate(unsigned int x, std::size_t n)
+{
+ return (x<<n) ^ (x>> (32-n));
+}
+
+class sha1
+{
+public:
+ typedef unsigned int(&digest_type)[5];
+public:
+ sha1();
+
+ void reset();
+
+ void process_byte(unsigned char byte);
+ void process_block(void const* bytes_begin, void const* bytes_end);
+ void process_bytes(void const* buffer, std::size_t byte_count);
+
+ void get_digest(digest_type digest);
+
+private:
+ void process_block();
+
+private:
+ unsigned int h_[5];
+
+ unsigned char block_[64];
+
+ std::size_t block_byte_index_;
+ std::size_t byte_count_;
+};
+
+inline sha1::sha1()
+{
+ reset();
+}
+
+inline void sha1::reset()
+{
+ h_[0] = 0x67452301;
+ h_[1] = 0xEFCDAB89;
+ h_[2] = 0x98BADCFE;
+ h_[3] = 0x10325476;
+ h_[4] = 0xC3D2E1F0;
+
+ block_byte_index_ = 0;
+ byte_count_ = 0;
+}
+
+inline void sha1::process_byte(unsigned char byte)
+{
+ block_[block_byte_index_++] = byte;
+ ++byte_count_;
+ if (block_byte_index_ == 64) {
+ block_byte_index_ = 0;
+ process_block();
+ }
+}
+
+inline void sha1::process_block(void const* bytes_begin, void const* bytes_end)
+{
+ unsigned char const* begin = static_cast<unsigned char const*>(bytes_begin);
+ unsigned char const* end = static_cast<unsigned char const*>(bytes_end);
+ for(; begin != end; ++begin) {
+ process_byte(*begin);
+ }
+}
+
+inline void sha1::process_bytes(void const* buffer, std::size_t byte_count)
+{
+ unsigned char const* b = static_cast<unsigned char const*>(buffer);
+ process_block(b, b+byte_count);
+}
+
+inline void sha1::process_block()
+{
+ unsigned int w[80];
+ for (std::size_t i=0; i<16; ++i) {
+ w[i] = (block_[i*4 + 0] << 24);
+ w[i] |= (block_[i*4 + 1] << 16);
+ w[i] |= (block_[i*4 + 2] << 8);
+ w[i] |= (block_[i*4 + 3]);
+ }
+ for (std::size_t i=16; i<80; ++i) {
+ w[i] = left_rotate((w[i-3] ^ w[i-8] ^ w[i-14] ^ w[i-16]), 1);
+ }
+
+ unsigned int a = h_[0];
+ unsigned int b = h_[1];
+ unsigned int c = h_[2];
+ unsigned int d = h_[3];
+ unsigned int e = h_[4];
+
+ for (std::size_t i=0; i<80; ++i) {
+ unsigned int f;
+ unsigned int k;
+
+ if (i<20) {
+ f = (b & c) | (~b & d);
+ k = 0x5A827999;
+ } else if (i<40) {
+ f = b ^ c ^ d;
+ k = 0x6ED9EBA1;
+ } else if (i<60) {
+ f = (b & c) | (b & d) | (c & d);
+ k = 0x8F1BBCDC;
+ } else {
+ f = b ^ c ^ d;
+ k = 0xCA62C1D6;
+ }
+
+ unsigned temp = left_rotate(a, 5) + f + e + k + w[i];
+ e = d;
+ d = c;
+ c = left_rotate(b, 30);
+ b = a;
+ a = temp;
+ }
+
+ h_[0] += a;
+ h_[1] += b;
+ h_[2] += c;
+ h_[3] += d;
+ h_[4] += e;
+}
+
+inline void sha1::get_digest(digest_type digest)
+{
+ std::size_t bit_count = byte_count_*8;
+
+ // append the bit '1' to the message
+ process_byte(0x80);
+
+ // append k bits '0', where k is the minimum number >= 0
+ // such that the resulting message length is congruent to 56 (mod 64)
+ // check if there is enough space for padding and bit_count
+ if (block_byte_index_ > 56) {
+ // finish this block
+ while (block_byte_index_ != 0) {
+ process_byte(0);
+ }
+
+ // one more block
+ while (block_byte_index_ < 56) {
+ process_byte(0);
+ }
+ } else {
+ while (block_byte_index_ < 56) {
+ process_byte(0);
+ }
+ }
+
+ // append length of message (before pre-processing)
+ // as a 64-bit big-endian integer
+ process_byte(0);
+ process_byte(0);
+ process_byte(0);
+ process_byte(0);
+ process_byte( static_cast<unsigned char>((bit_count>>24) & 0xFF));
+ process_byte( static_cast<unsigned char>((bit_count>>16) & 0xFF));
+ process_byte( static_cast<unsigned char>((bit_count>>8 ) & 0xFF));
+ process_byte( static_cast<unsigned char>((bit_count) & 0xFF));
+
+ // get final digest
+ digest[0] = h_[0];
+ digest[1] = h_[1];
+ digest[2] = h_[2];
+ digest[3] = h_[3];
+ digest[4] = h_[4];
+}
+
+}}} // namespace boost::uuids::detail
+
+#endif
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/string_generator.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/string_generator.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/string_generator.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/string_generator.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,184 @@
+// Boost string_generator.hpp header file ----------------------------------------------//
+
+// Copyright 2010 Andy Tompkins.
+// 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)
+
+#ifndef BOOST_UUID_STRING_GENERATOR_HPP
+#define BOOST_UUID_STRING_GENERATOR_HPP
+
+#include <boost/uuid/uuid.hpp>
+#include <string>
+#include <cstring> // for strlen, wcslen
+#include <iterator>
+#include <algorithm> // for find
+#include <stdexcept>
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+ using ::strlen;
+ using ::wcslen;
+} //namespace std
+#endif //BOOST_NO_STDC_NAMESPACE
+
+namespace boost {
+namespace uuids {
+
+// generate a uuid from a string
+// lexical_cast works fine using uuid_io.hpp
+// but this generator should accept more forms
+// and be more efficient
+// would like to accept the following forms:
+// 0123456789abcdef0123456789abcdef
+// 01234567-89ab-cdef-0123456789abcdef
+// {01234567-89ab-cdef-0123456789abcdef}
+// {0123456789abcdef0123456789abcdef}
+// others?
+struct string_generator {
+ typedef uuid result_type;
+
+ template <typename ch, typename char_traits, typename alloc>
+ uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const {
+ return operator()(s.begin(), s.end());
+ };
+
+ uuid operator()(char const*const s) const {
+ return operator()(s, s+std::strlen(s));
+ }
+
+ uuid operator()(wchar_t const*const s) const {
+ return operator()(s, s+std::wcslen(s));
+ }
+
+ template <typename CharIterator>
+ uuid operator()(CharIterator begin, CharIterator end) const
+ {
+ typedef typename std::iterator_traits<CharIterator>::value_type char_type;
+
+ // check open brace
+ char_type c = get_next_char(begin, end);
+ bool has_open_brace = is_open_brace(c);
+ char_type open_brace_char = c;
+ if (has_open_brace) {
+ c = get_next_char(begin, end);
+ }
+
+ bool has_dashes = false;
+
+ uuid u;
+ int i=0;
+ for (uuid::iterator it_byte=u.begin(); it_byte!=u.end(); ++it_byte, ++i) {
+ if (it_byte != u.begin()) {
+ c = get_next_char(begin, end);
+ }
+
+ if (i == 4) {
+ has_dashes = is_dash(c);
+ if (has_dashes) {
+ c = get_next_char(begin, end);
+ }
+ }
+
+ if (has_dashes) {
+ if (i == 6 || i == 8 || i == 10) {
+ if (is_dash(c)) {
+ c = get_next_char(begin, end);
+ } else {
+ throw_invalid();
+ }
+ }
+ }
+
+ *it_byte = get_value(c);
+
+ c = get_next_char(begin, end);
+ *it_byte <<= 4;
+ *it_byte |= get_value(c);
+ }
+
+ // check close brace
+ if (has_open_brace) {
+ c = get_next_char(begin, end);
+ check_close_brace(c, open_brace_char);
+ }
+
+ return u;
+ }
+
+private:
+ template <typename CharIterator>
+ typename std::iterator_traits<CharIterator>::value_type
+ get_next_char(CharIterator& begin, CharIterator end) const {
+ if (begin == end) {
+ throw_invalid();
+ }
+ return *begin++;
+ }
+
+ unsigned char get_value(char c) const {
+ static char const*const digits_begin = "0123456789abcdefABCDEF";
+ static char const*const digits_end = digits_begin + 22;
+
+ static unsigned char const values[] =
+ { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,10,11,12,13,14,15
+ , static_cast<unsigned char>(-1) };
+
+ char const* d = std::find(digits_begin, digits_end, c);
+ return values[d - digits_begin];
+ }
+
+ unsigned char get_value(wchar_t c) const {
+ static wchar_t const*const digits_begin = L"0123456789abcdefABCDEF";
+ static wchar_t const*const digits_end = digits_begin + 22;
+
+ static unsigned char const values[] =
+ { 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,10,11,12,13,14,15
+ , static_cast<unsigned char>(-1) };
+
+ wchar_t const* d = std::find(digits_begin, digits_end, c);
+ return values[d - digits_begin];
+ }
+
+ bool is_dash(char c) const {
+ return c == '-';
+ }
+
+ bool is_dash(wchar_t c) const {
+ return c == L'-';
+ }
+
+ // return closing brace
+ bool is_open_brace(char c) const {
+ return (c == '{');
+ }
+
+ bool is_open_brace(wchar_t c) const {
+ return (c == L'{');
+ }
+
+ void check_close_brace(char c, char open_brace) const {
+ if (open_brace == '{' && c == '}') {
+ //great
+ } else {
+ throw_invalid();
+ }
+ }
+
+ void check_close_brace(wchar_t c, wchar_t open_brace) const {
+ if (open_brace == L'{' && c == L'}') {
+ // great
+ } else {
+ throw_invalid();
+ }
+ }
+
+ void throw_invalid() const {
+ throw std::runtime_error("invalid uuid string");
+ }
+};
+
+}} // namespace boost::uuids
+
+#endif //BOOST_UUID_STRING_GENERATOR_HPP
+
Added: incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/uuid.hpp
URL: http://svn.apache.org/viewvc/incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/uuid.hpp?rev=1140024&view=auto
==============================================================================
--- incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/uuid.hpp (added)
+++ incubator/mesos/trunk/third_party/boost-1.37.0/boost/uuid/uuid.hpp Mon Jun 27 06:08:33 2011
@@ -0,0 +1,221 @@
+// Boost uuid.hpp header file ----------------------------------------------//
+
+// Copyright 2006 Andy Tompkins.
+// 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)
+
+// Revision History
+// 06 Feb 2006 - Initial Revision
+// 09 Nov 2006 - fixed variant and version bits for v4 guids
+// 13 Nov 2006 - added serialization
+// 17 Nov 2006 - added name-based guid creation
+// 20 Nov 2006 - add fixes for gcc (from Tim Blechmann)
+// 07 Mar 2007 - converted to header only
+// 10 May 2007 - removed need for Boost.Thread
+// - added better seed - thanks Peter Dimov
+// - removed null()
+// - replaced byte_count() and output_bytes() with size() and begin() and end()
+// 11 May 2007 - fixed guid(ByteInputIterator first, ByteInputIterator last)
+// - optimized operator>>
+// 14 May 2007 - converted from guid to uuid
+// 29 May 2007 - uses new implementation of sha1
+// 01 Jun 2007 - removed using namespace directives
+// 09 Nov 2007 - moved implementation to uuid.ipp file
+// 12 Nov 2007 - moved serialize code to uuid_serialize.hpp file
+// 25 Feb 2008 - moved to namespace boost::uuids
+// 19 Mar 2009 - changed to a POD, reorganized files
+// 28 Nov 2009 - disabled deprecated warnings for MSVC
+// 30 Nov 2009 - used BOOST_STATIC_CONSTANT
+// 02 Dec 2009 - removed BOOST_STATIC_CONSTANT - not all compilers like it
+
+#ifndef BOOST_UUID_HPP
+#define BOOST_UUID_HPP
+
+#include <boost/config.hpp>
+#include <stddef.h>
+#include <boost/cstdint.hpp>
+#include <algorithm>
+#include <boost/config.hpp> // for static assert
+#ifndef BOOST_UUID_NO_TYPE_TRAITS
+#include <boost/type_traits/is_pod.hpp>
+#include <boost/type_traits/integral_constant.hpp>
+#endif
+
+#if defined(_MSC_VER)
+#pragma warning(push) // Save warning settings.
+#pragma warning(disable : 4996) // Disable deprecated std::swap_ranges, std::equal
+#endif
+
+#ifdef BOOST_NO_STDC_NAMESPACE
+namespace std {
+ using ::size_t;
+ using ::ptrdiff_t;
+} //namespace std
+#endif //BOOST_NO_STDC_NAMESPACE
+
+namespace boost {
+namespace uuids {
+
+struct uuid
+{
+public:
+ typedef uint8_t value_type;
+ typedef uint8_t& reference;
+ typedef uint8_t const& const_reference;
+ typedef uint8_t* iterator;
+ typedef uint8_t const* const_iterator;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ // This does not work on some compilers
+ // They seem to want the variable definec in
+ // a cpp file
+ //BOOST_STATIC_CONSTANT(size_type, static_size = 16);
+ static size_type static_size() { return 16; }
+
+public:
+ iterator begin() { return data; } /* throw() */
+ const_iterator begin() const { return data; } /* throw() */
+ iterator end() { return data+size(); } /* throw() */
+ const_iterator end() const { return data+size(); } /* throw() */
+
+ size_type size() const { return static_size(); } /* throw() */
+
+ bool is_nil() const /* throw() */
+ {
+ for(size_t i=0; i<static_size(); i++) {
+ if (data[i] != 0U) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ enum variant_type
+ {
+ variant_ncs, // NCS backward compatibility
+ variant_rfc_4122, // defined in RFC 4122 document
+ variant_microsoft, // Microsoft Corporation backward compatibility
+ variant_future // future definition
+ };
+ variant_type variant() const /* throw() */
+ {
+ // variant is stored in octet 7
+ // which is index 8, since indexes count backwards
+ unsigned char octet7 = data[8]; // octet 7 is array index 8
+ if ( (octet7 & 0x80) == 0x00 ) { // 0b0xxxxxxx
+ return variant_ncs;
+ } else if ( (octet7 & 0xC0) == 0x80 ) { // 0b10xxxxxx
+ return variant_rfc_4122;
+ } else if ( (octet7 & 0xE0) == 0xC0 ) { // 0b110xxxxx
+ return variant_microsoft;
+ } else {
+ //assert( (octet7 & 0xE0) == 0xE0 ) // 0b111xxxx
+ return variant_future;
+ }
+ }
+
+ enum version_type
+ {
+ version_unknown = -1,
+ version_time_based = 1,
+ version_dce_security = 2,
+ version_name_based_md5 = 3,
+ version_random_number_based = 4,
+ version_name_based_sha1 = 5
+ };
+ version_type version() const /* throw() */
+ {
+ //version is stored in octet 9
+ // which is index 6, since indexes count backwards
+ unsigned char octet9 = data[6];
+ if ( (octet9 & 0xF0) == 0x10 ) {
+ return version_time_based;
+ } else if ( (octet9 & 0xF0) == 0x20 ) {
+ return version_dce_security;
+ } else if ( (octet9 & 0xF0) == 0x30 ) {
+ return version_name_based_md5;
+ } else if ( (octet9 & 0xF0) == 0x40 ) {
+ return version_random_number_based;
+ } else if ( (octet9 & 0xF0) == 0x50 ) {
+ return version_name_based_sha1;
+ } else {
+ return version_unknown;
+ }
+ }
+
+ // note: linear complexity
+ void swap(uuid& rhs) /* throw() */
+ {
+ std::swap_ranges(begin(), end(), rhs.begin());
+ }
+
+public:
+ // or should it be array<uint8_t, 16>
+ uint8_t data[16];
+};
+
+inline bool operator==(uuid const& lhs, uuid const& rhs) /* throw() */
+{
+ return std::equal(lhs.begin(), lhs.end(), rhs.begin());
+}
+
+inline bool operator!=(uuid const& lhs, uuid const& rhs) /* throw() */
+{
+ return !(lhs == rhs);
+}
+
+inline bool operator<(uuid const& lhs, uuid const& rhs) /* throw() */
+{
+ return std::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
+}
+
+inline bool operator>(uuid const& lhs, uuid const& rhs) /* throw() */
+{
+ return rhs < lhs;
+}
+inline bool operator<=(uuid const& lhs, uuid const& rhs) /* throw() */
+{
+ return !(rhs < lhs);
+}
+
+inline bool operator>=(uuid const& lhs, uuid const& rhs) /* throw() */
+{
+ return !(lhs < rhs);
+}
+
+inline void swap(uuid& lhs, uuid& rhs) /* throw() */
+{
+ lhs.swap(rhs);
+}
+
+// This is equivalent to boost::hash_range(u.begin(), u.end());
+inline std::size_t hash_value(uuid const& u) /* throw() */
+{
+ std::size_t seed = 0;
+ for(uuid::const_iterator i=u.begin(); i != u.end(); ++i)
+ {
+ seed ^= static_cast<std::size_t>(*i) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
+ }
+
+ return seed;
+}
+
+}} //namespace boost::uuids
+
+#ifndef BOOST_UUID_NO_TYPE_TRAITS
+// type traits specializations
+namespace boost {
+
+template <>
+struct is_pod<uuids::uuid> : true_type {};
+
+} // namespace boost
+#endif
+
+#if defined(_MSC_VER)
+#pragma warning(pop) // Restore warnings to previous state.
+#endif
+
+#endif // BOOST_UUID_HPP