Update of /cvsroot/boost/boost/boost/interprocess/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv30311/detail

Modified Files:
        utilities.hpp version_type.hpp win32_api.hpp workaround.hpp 
Added Files:
        type_traits.hpp 
Log Message:
no message

--- NEW FILE: type_traits.hpp ---
//////////////////////////////////////////////////////////////////////////////
// (C) Copyright John Maddock 2000.
// (C) Copyright Ion Gaztanaga 2005-2007.
//
// 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/interprocess for documentation.
//
// The alignment_of implementation comes from John Maddock's 
boost::alignment_of code
//
//////////////////////////////////////////////////////////////////////////////

#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP
#define BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP

#if (defined _MSC_VER) && (_MSC_VER >= 1200)
#  pragma once
#endif

#include <boost/interprocess/detail/config_begin.hpp>

namespace boost {
namespace interprocess { 
namespace detail {

//boost::alignment_of yields to 10K lines of preprocessed code, so we
//need an alternative
template <typename T> struct alignment_of;

template <typename T>
struct alignment_of_hack
{
    char c;
    T t;
    alignment_of_hack();
};

template <unsigned A, unsigned S>
struct alignment_logic
{
    enum{   value = A < S ? A : S  };
};

template< typename T >
struct alignment_of
{
   enum{ value = alignment_logic
            < sizeof(alignment_of_hack<T>) - sizeof(T)
            , sizeof(T)>::value   };
};

//This is not standard, but should work with all compilers
union max_align
{
   char        char_;
   short       short_;
   int         int_;
   long        long_;
   #ifdef BOOST_HAS_LONG_LONG
   long long   long_long_;
   #endif
   float       float_;
   double      double_;
   long double long_double_;
   void *      void_ptr_;
};

template<class T>
struct remove_reference
{
   typedef T type;
};

template<class T>
struct remove_reference<T&>
{
   typedef T type;
};

template<class T>
struct is_reference
{
   enum {  value = false   };
};

template<class T>
struct is_reference<T&>
{
   enum {  value = true   };
};

template<class T>
struct is_pointer
{
   enum {  value = false   };
};

template<class T>
struct is_pointer<T*>
{
   enum {  value = true   };
};

template <typename T>
struct add_reference
{
    typedef T& type;
};

template<class T>
struct add_reference<T&>
{
    typedef T& type;
};

template<>
struct add_reference<void>
{
    typedef int& type;
};

template<>
struct add_reference<const void>
{
    typedef int& type;
};
template <typename T, typename U>
struct is_same
{
   typedef char yes_type;
   struct no_type
   {
      char padding[8];
   };

   template <typename V>
   static yes_type is_same_tester(V*, V*);
   static no_type is_same_tester(...);

   static T t;
   static U u;

   static const bool value = sizeof(yes_type) == sizeof(is_same_tester(&t,&u));
};
/*
template< typename T >
struct is_pointer_impl
{
   static const bool value =
        (::boost::type_traits::ice_and<
        ::boost::detail::is_pointer_helper<typename remove_cv<T>::type>::value
            , ::boost::type_traits::ice_not<
                ::boost::is_member_pointer<T>::value
                >::value
            >::value)
        );
};*/

} // namespace detail
}  //namespace interprocess { 
}  //namespace boost {

#endif   //#ifndef BOOST_INTERPROCESS_DETAIL_TYPE_TRAITS_HPP

#include <boost/interprocess/detail/config_end.hpp>


Index: utilities.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/detail/utilities.hpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- utilities.hpp       12 Jun 2007 17:07:08 -0000      1.7
+++ utilities.hpp       23 Jun 2007 12:53:54 -0000      1.8
@@ -25,9 +25,8 @@
 #include <boost/interprocess/detail/move.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 #include <boost/interprocess/detail/min_max.hpp>
-//#include <functional>
 #include <utility>
-#include <stdexcept>
+#include <algorithm>
 
 namespace boost {
 namespace interprocess { 
@@ -143,10 +142,11 @@
 
 //!A deleter for scoped_ptr that destroys
 //!an object using a STL allocator.
-template <class Pointer>
+template <class Allocator>
 struct scoped_destructor_n
 {
-   typedef Pointer pointer;
+   typedef typename Allocator::pointer pointer;
+   typedef typename Allocator::value_type value_type;
 
    pointer     m_p;
    std::size_t m_n;
@@ -160,7 +160,6 @@
    ~scoped_destructor_n()
    {
       if(!m_p) return;
-      typedef typename std::iterator_traits<Pointer>::value_type value_type;
       value_type *raw_ptr = detail::get_pointer(m_p);
       for(std::size_t i = 0; i < m_n; ++i, ++raw_ptr)
          raw_ptr->~value_type();
@@ -558,8 +557,12 @@
    : public boost::has_trivial_destructor<T>
 {};
 
-enum create_enum_t
-{  DoCreate, DoOpen, DoCreateOrOpen   };
+template <typename T> T*
+addressof(T& v)
+{
+  return reinterpret_cast<T*>(
+       &const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
+}
 
 }  //namespace interprocess { 
 }  //namespace boost {

Index: version_type.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/detail/version_type.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- version_type.hpp    12 May 2007 12:51:19 -0000      1.4
+++ version_type.hpp    23 Jun 2007 12:53:54 -0000      1.5
@@ -15,36 +15,11 @@
 
 #ifndef BOOST_INTERPROCESS_DETAIL_VERSION_TYPE_HPP
 #define BOOST_INTERPROCESS_DETAIL_VERSION_TYPE_HPP
-/*
-#include <boost/type_traits/integral_constant.hpp>
-
-namespace boost{
-namespace interprocess{
-namespace detail{
-
-template <class T, unsigned V>
-struct version_type
-    : public boost::integral_constant<unsigned, V>
-{
-    typedef T type;
-
-    version_type(const version_type<T, 0>&);
-};
 
-template <class T>
-struct version
-   : public boost::integral_constant<unsigned, 1>
-{};
-
-}  //namespace detail{
-}  //namespace interprocess{
-}  //namespace boost{
-*/
+#include <boost/interprocess/detail/mpl.hpp>
+#include <boost/interprocess/detail/type_traits.hpp>
 
 
-#include <boost/type_traits/integral_constant.hpp>
-#include <boost/type_traits/is_convertible.hpp>
-
 namespace boost{
 namespace interprocess{
 namespace detail{
@@ -53,7 +28,7 @@
 
 template <class T, unsigned V>
 struct version_type
-    : public boost::integral_constant<unsigned, V>
+    : public detail::integral_constant<unsigned, V>
 {
     typedef T type;
 
@@ -63,7 +38,7 @@
 namespace impl{
 
 template <class T, 
-          bool = boost::is_convertible<version_type<T, 0>, typename 
T::version>::value>
+          bool = detail::is_convertible<version_type<T, 0>, typename 
T::version>::value>
 struct extract_version
 {
    static const unsigned value = 1;
@@ -103,7 +78,7 @@
 
 template <class T>
 struct version
-   : public boost::integral_constant<unsigned, impl::version<T>::value>
+   : public detail::integral_constant<unsigned, impl::version<T>::value>
 {
 };
 
@@ -111,28 +86,4 @@
 }  //namespace interprocess{
 }  //namespace boost{
 
-
-/*
-#include <iostream>
-#include <boost/interprocess/detail/version_type.hpp>
-
-struct A
-{
-    typedef boost::interprocess::detail::version_type<A, 2> version;
-};
-
-struct B
-{
-    struct version {static unsigned const value = 3;};
-};
-
-int main()
-{
-   boost::interprocess::detail::
-   std::cout << boost::interprocess::detail::version<int>::value << '\n';
-   std::cout << boost::interprocess::detail::version<A>::value << '\n';
-   std::cout << boost::interprocess::detail::version<B>::value << '\n';
-} 
-*/
-
 #endif   //#define BOOST_INTERPROCESS_DETAIL_VERSION_TYPE_HPP

Index: win32_api.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/detail/win32_api.hpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- win32_api.hpp       12 Jun 2007 17:07:08 -0000      1.4
+++ win32_api.hpp       23 Jun 2007 12:53:54 -0000      1.5
@@ -190,6 +190,7 @@
    , unsigned long dwDesiredAccess, int bInheritHandle
    , unsigned long dwOptions);
 extern "C" __declspec(dllimport) void __stdcall 
GetSystemTimeAsFileTime(interprocess_filetime*);
+extern "C" __declspec(dllimport) int  __stdcall FileTimeToLocalFileTime(const 
interprocess_filetime *in, const interprocess_filetime *out);
 extern "C" __declspec(dllimport) void * __stdcall 
CreateMutexA(interprocess_security_attributes*, int, const char *);
 extern "C" __declspec(dllimport) void * __stdcall OpenMutexA(unsigned long, 
int, const char *);
 extern "C" __declspec(dllimport) unsigned long __stdcall 
WaitForSingleObject(void *, unsigned long);
@@ -221,6 +222,8 @@
 extern "C" __declspec(dllimport) int __stdcall UnlockFile(void *hnd, unsigned 
long offset_low, unsigned long offset_high, unsigned long size_low, unsigned 
long size_high);
 extern "C" __declspec(dllimport) int __stdcall LockFileEx(void *hnd, unsigned 
long flags, unsigned long reserved, unsigned long size_low, unsigned long 
size_high, interprocess_overlapped* overlapped);
 extern "C" __declspec(dllimport) int __stdcall UnlockFileEx(void *hnd, 
unsigned long reserved, unsigned long size_low, unsigned long size_high, 
interprocess_overlapped* overlapped);
+extern "C" __declspec(dllimport) int __stdcall WriteFile(void *hnd, const void 
*buffer, unsigned long bytes_to_write, unsigned long *bytes_written, 
interprocess_overlapped* overlapped);
+
 /*
 extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long 
volatile * );
 extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long 
volatile * );
@@ -281,6 +284,10 @@
 static inline void get_system_time_as_file_time(interprocess_filetime 
*filetime)
 {  GetSystemTimeAsFileTime(filetime);  }
 
+static inline bool file_time_to_local_file_time
+   (const interprocess_filetime *in, const interprocess_filetime *out)
+{  return 0 != FileTimeToLocalFileTime(in, out);  }
+
 static inline void *create_mutex(const char *name)
 {  return CreateMutexA(0, 0, name); }
 
@@ -347,6 +354,9 @@
 static inline bool unlock_file_ex(void *hnd, unsigned long reserved, unsigned 
long size_low, unsigned long size_high, interprocess_overlapped *overlapped)
 {  return 0 != UnlockFileEx(hnd, reserved, size_low, size_high, overlapped);  }
 
+static inline bool write_file(void *hnd, const void *buffer, unsigned long 
bytes_to_write, unsigned long *bytes_written, interprocess_overlapped* 
overlapped)
+{  return 0 != WriteFile(hnd, buffer, bytes_to_write, bytes_written, 
overlapped);  }
+
 static inline long interlocked_increment(long volatile *addr)
 {  return BOOST_INTERLOCKED_INCREMENT(addr);  }
 

Index: workaround.hpp
===================================================================
RCS file: /cvsroot/boost/boost/boost/interprocess/detail/workaround.hpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- workaround.hpp      12 Jun 2007 17:07:08 -0000      1.8
+++ workaround.hpp      23 Jun 2007 12:53:54 -0000      1.9
@@ -13,11 +13,6 @@
 
 #include <boost/interprocess/detail/config_begin.hpp>
 
-#include <boost/config.hpp>
-#include <boost/detail/workaround.hpp>
-#include <boost/iterator.hpp>
-#include <boost/iterator/reverse_iterator.hpp>
-
 #if !(defined BOOST_WINDOWS) || (defined BOOST_DISABLE_WIN32)
    #if defined(_POSIX_THREAD_PROCESS_SHARED) && (_POSIX_THREAD_PROCESS_SHARED 
- 0 > 0)
    #if !defined(__CYGWIN__)
@@ -70,26 +65,26 @@
 #if defined(BOOST_INTERPROCESS_RVALUE_REFERENCE) || 
defined(BOOST_INTERPROCESS_VARIADIC_TEMPLATES)
 #define BOOST_INTERPROCESS_PERFECT_FORWARDING
 #endif
-
+/*
 namespace boost {
 namespace interprocess {
 namespace workaround{
 
-//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*//
+//////////////////////////////////////////////////
 //                                              //
 //    We want generally const_shm_ptr to inherit//
 //    from iterator class but for void this     //
 //    doesn't work, so we must inherit from     //
 //    other class.                              //
 //                                              //
-//-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*//
+//////////////////////////////////////////////////
 
 //Empty class
 struct empty_type{};
 
 template<class T>
 struct random_it 
-: public boost::iterator<std::random_access_iterator_tag, 
+: public std::iterator<std::random_access_iterator_tag, 
                          T, std::ptrdiff_t, T*, T&> 
 {
    typedef const T*           const_pointer;
@@ -143,7 +138,7 @@
 }  //namespace workaround
 }  //namespace interprocess {
 }  //namespace boost {
-
+*/
 #include <boost/interprocess/detail/config_end.hpp>
 
 #endif   //#ifndef BOOST_INTERPROCESS_PTR_WRKRND_HPP


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs

Reply via email to