Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53996 - in sandbox/monotonic: boost/monotonic libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-17 00:34:25


Author: cschladetsch
Date: 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
New Revision: 53996
URL: http://svn.boost.org/trac/boost/changeset/53996

Log:
added config.h, removed #pragma once

Added:
   sandbox/monotonic/boost/monotonic/config.h (contents, props changed)
   sandbox/monotonic/boost/monotonic/forward_declarations.h (contents, props changed)
Text files modified:
   sandbox/monotonic/boost/monotonic/allocator.h | 15 +++++++--------
   sandbox/monotonic/boost/monotonic/chain.h | 7 ++++---
   sandbox/monotonic/boost/monotonic/fixed_storage.h | 29 ++++++++++++-----------------
   sandbox/monotonic/boost/monotonic/inline_clone_allocator.h | 12 +++++++++---
   sandbox/monotonic/boost/monotonic/list.h | 5 ++++-
   sandbox/monotonic/boost/monotonic/map.h | 5 ++++-
   sandbox/monotonic/boost/monotonic/ptr_list.h | 5 ++++-
   sandbox/monotonic/boost/monotonic/set.h | 5 ++++-
   sandbox/monotonic/boost/monotonic/shared_storage.h | 8 ++++++--
   sandbox/monotonic/boost/monotonic/static_storage.h | 17 ++++++++---------
   sandbox/monotonic/boost/monotonic/storage.h | 12 +++++-------
   sandbox/monotonic/boost/monotonic/storage_base.h | 14 +++++++++-----
   sandbox/monotonic/boost/monotonic/vector.h | 6 ++++--
   sandbox/monotonic/libs/monotonic/test/monotonic.vcproj | 8 ++++++++
   14 files changed, 88 insertions(+), 60 deletions(-)

Modified: sandbox/monotonic/boost/monotonic/allocator.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/allocator.h (original)
+++ sandbox/monotonic/boost/monotonic/allocator.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,23 +3,20 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_ALLOCATOR_H
+#define BOOST_MONOTONIC_ALLOCATOR_H
 
-#include <boost/monotonic/storage_base.h>
-#include <boost/monotonic/storage.h>
-#include <boost/monotonic/static_storage.h>
 #include <boost/assert.hpp>
 #include <boost/type_traits/has_trivial_constructor.hpp>
 #include <boost/type_traits/has_trivial_destructor.hpp>
 
+#include <boost/monotonic/storage.h>
+#include <boost/monotonic/static_storage.h>
+
 namespace boost
 {
         namespace monotonic
         {
- /// a monotonic allocator has a storage buffer and a no-op deallocate() method
- template <class>
- struct allocator;
-
                 template <>
                 struct allocator<void>
                 {
@@ -161,4 +158,6 @@
 
 } // namespace boost
 
+#endif // BOOST_MONOTONIC_ALLOCATOR_H
+
 //EOF

Modified: sandbox/monotonic/boost/monotonic/chain.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/chain.h (original)
+++ sandbox/monotonic/boost/monotonic/chain.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,14 +3,13 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_CHAIN_H
+#define BOOST_MONOTONIC_CHAIN_H
 
 #include <boost/monotonic/allocator.h>
-#include <boost/monotonic/storage_base.h>
 #include <boost/utility/iter_range.h>
 #include <boost/iterator.hpp>
 #include <boost/iterator/iterator_categories.hpp>
-#include <boost/foreach.hpp>
 
 namespace boost
 {
@@ -258,4 +257,6 @@
         }
 }
 
+#endif // BOOST_MONOTONIC_CHAIN_H
+
 //EOF

Added: sandbox/monotonic/boost/monotonic/config.h
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/monotonic/config.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -0,0 +1,35 @@
+// Copyright (C) 2009 Christian Schladetsch
+//
+// 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_MONOTONIC_CONFIG_H
+#define BOOST_MONOTONIC_CONFIG_H
+
+#include <utility>
+#include <limits>
+#include <vector>
+#include <boost/foreach.hpp>
+
+namespace boost
+{
+ namespace monotonic
+ {
+ struct DefaultSizes
+ {
+ enum
+ {
+ InlineSize = 8*1024, ///< buffer that is inline with the storage
+ MinHeapIncrement = 2*1024*1024, ///< the smallest new chunk-size for heap storage
+ StaticInlineSize = 64*1024, ///< inline size for a global store
+ StaticMinHeapIncrement = MinHeapIncrement,
+ };
+ };
+
+ } // namespace monotonic
+
+} // namespace boost
+
+#endif // BOOST_MONOTONIC_CONFIG_H
+
+//EOF

Modified: sandbox/monotonic/boost/monotonic/fixed_storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/fixed_storage.h (original)
+++ sandbox/monotonic/boost/monotonic/fixed_storage.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,30 +3,23 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_FIXED_STORAGE_H
+#define BOOST_MONOTONIC_FIXED_STORAGE_H
 
-#include <cassert>
 #include <boost/array.hpp>
 #include <boost/aligned_storage.hpp>
-
-// define this to use boost::auto_buffer<> rather than boost::array for monotonic::storage
-//#define BOOST_MONOTONIC_USE_AUTOBUFFER
-// this currently does not work, because resizing the underlying buffer breaks
-// containers that may reference the previously used memory
-
-#ifdef BOOST_MONOTONIC_USE_AUTOBUFFER
-# include <boost/auto_buffer.hpp>
-#endif
+#include <boost/monotonic/forward_declarations.h>
+#include <boost/monotonic/storage_base.h>
 
 namespace boost
 {
         namespace monotonic
         {
                 /// storage for an allocator that is on the stack or heap
- template <size_t N>
+ template <size_t InlineSize>
                 struct fixed_storage : storage_base
                 {
- typedef boost::array<char, N> Buffer;
+ typedef boost::array<char, InlineSize> Buffer;
 
                 private:
                         Buffer buffer; ///< the storage
@@ -53,7 +46,7 @@
                         }
                         const char *end() const
                         {
- return &buffer[N - 1];
+ return &buffer[InlineSize - 1];
                         }
                         void reset()
                         {
@@ -85,7 +78,7 @@
                                 if (extra > 0)
                                         extra = alignment - extra;
                                 size_t required = num_bytes + extra;
- if (cursor + required > N)
+ if (cursor + required > InlineSize)
                                 {
                                         return 0;
                                 }
@@ -99,12 +92,12 @@
 
                         size_t max_size() const
                         {
- return N;
+ return InlineSize;
                         }
 
                         size_t remaining() const
                         {
- return N - cursor;
+ return InlineSize - cursor;
                         }
 
                         size_t used() const
@@ -124,4 +117,6 @@
 
 } // namespace boost
 
+#endif // BOOST_MONOTONIC_FIXED_STORAGE_H
+
 //EOF

Added: sandbox/monotonic/boost/monotonic/forward_declarations.h
==============================================================================
--- (empty file)
+++ sandbox/monotonic/boost/monotonic/forward_declarations.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -0,0 +1,54 @@
+// Copyright (C) 2009 Christian Schladetsch
+//
+// 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_MONOTONIC_FORWARD_DECLARATIONS_H
+#define BOOST_MONOTONIC_FORWARD_DECLARATIONS_H
+
+#include <boost/monotonic/config.h>
+
+namespace boost
+{
+ namespace monotonic
+ {
+ /// storage for an allocator that is on the stack or heap
+ template <size_t InlineSize = DefaultSizes::InlineSize>
+ struct fixed_storage;
+
+ /// storage that spans the stack/heap boundary.
+ ///
+ /// allocation requests first use inline fixed_storage of N bytes.
+ /// once that is exhausted, later requests are serviced from the heap.
+ ///
+ /// all allocations remain valid at all times.
+ template <
+ size_t InlineSize = DefaultSizes::InlineSize
+ , size_t MinHeapIncrement = DefaultSizes::MinHeapIncrement
+ , class Al = std::allocator<char> >
+ struct storage;
+
+ /// thread-safe storage
+ template <
+ size_t InlineSize = DefaultSizes::InlineSize
+ , size_t MinHeapIncrement = DefaultSizes::MinHeapIncrement
+ , class Al = std::allocator<char> >
+ struct shared_storage;
+
+ /// a globally available storage buffer
+ template <size_t InlineSize = DefaultSizes::StaticInlineSize
+ , size_t MinHeapIncrement = DefaultSizes::StaticMinHeapIncrement
+ , class Al = std::allocator<char>
+ , template <size_t, size_t, class> class Storage = storage
+ >
+ struct static_storage_base;
+
+ /// a monotonic allocator has a storage buffer and a no-op deallocate() method
+ template <class>
+ struct allocator;
+ }
+}
+
+#endif // BOOST_MONOTONIC_FORWARD_DECLARATIONS_H
+
+//EOF

Modified: sandbox/monotonic/boost/monotonic/inline_clone_allocator.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/inline_clone_allocator.h (original)
+++ sandbox/monotonic/boost/monotonic/inline_clone_allocator.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,7 +3,10 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_INLINE_CLONE_ALLOCATOR_H
+#define BOOST_MONOTONIC_INLINE_CLONE_ALLOCATOR_H
+
+#include <boost/monotonic/allocator.h>
 
 namespace boost
 {
@@ -29,7 +32,10 @@
                         }
                 };
 
- }
-}
+ } // namespace monotonic
+
+} // namespace boost
+
+#endif // BOOST_MONOTONIC_INLINE_CLONE_ALLOCATOR_H
 
 //EOF

Modified: sandbox/monotonic/boost/monotonic/list.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/list.h (original)
+++ sandbox/monotonic/boost/monotonic/list.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,7 +3,8 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_LIST_H
+#define BOOST_MONOTONIC_LIST_H
 
 #include <list>
 #include <boost/monotonic/allocator.h>
@@ -29,4 +30,6 @@
         }
 }
 
+#endif // BOOST_MONOTONIC_LIST_H
+
 //EOF

Modified: sandbox/monotonic/boost/monotonic/map.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/map.h (original)
+++ sandbox/monotonic/boost/monotonic/map.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,7 +3,8 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_MAP_H
+#define BOOST_MONOTONIC_MAP_H
 
 #include <map>
 #include <boost/monotonic/allocator.h>
@@ -35,4 +36,6 @@
         }
 }
 
+#endif // BOOST_MONOTONIC_MAP_H
+
 //EOF

Modified: sandbox/monotonic/boost/monotonic/ptr_list.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/ptr_list.h (original)
+++ sandbox/monotonic/boost/monotonic/ptr_list.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,7 +3,8 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_PTR_LIST_H
+#define BOOST_MONOTONIC_PTR_LIST_H
 
 #include <boost/ptr_container/ptr_list.hpp>
 #include <boost/monotonic/allocator.h>
@@ -41,4 +42,6 @@
         }
 }
 
+#endif // BOOST_MONOTONIC_PTR_LIST_H
+
 //EOF

Modified: sandbox/monotonic/boost/monotonic/set.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/set.h (original)
+++ sandbox/monotonic/boost/monotonic/set.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,7 +3,8 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_SET_H
+#define BOOST_MONOTONIC_SET_H
 
 #include <set>
 #include <boost/monotonic/allocator.h>
@@ -35,4 +36,6 @@
         }
 }
 
+#endif // BOOST_MONOTONIC_SET_H
+
 //EOF

Modified: sandbox/monotonic/boost/monotonic/shared_storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/shared_storage.h (original)
+++ sandbox/monotonic/boost/monotonic/shared_storage.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,7 +3,8 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_SHARED_STORAGE_H
+#define BOOST_MONOTONIC_SHARED_STORAGE_H
 
 #include <boost/monotonic/storage.h>
 #include <boost/thread/mutex.hpp>
@@ -13,10 +14,11 @@
         namespace monotonic
         {
                 /// thread-safe storage
- template <size_t InlineSize = 8*1024, size_t MinHeapSize = InlineSize*1000, class Al = std::allocator<char> >
+ template <size_t InlineSize, size_t MinHeapSize, class Al>
                 struct shared_storage : storage_base
                 {
                         typedef storage<InlineSize, MinHeapSize, Al> Storage;
+
                 private:
                         Storage storage;
                         mutable mutex guard;
@@ -71,5 +73,7 @@
 
 } // namespace boost
 
+#endif // BOOST_MONOTONIC_SHARED_STORAGE_H
+
 //EOF
 

Modified: sandbox/monotonic/boost/monotonic/static_storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/static_storage.h (original)
+++ sandbox/monotonic/boost/monotonic/static_storage.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -12,14 +12,6 @@
 {
         namespace monotonic
         {
- /// a globally available storage buffer
- template <size_t InlineSize = 64*1024
- , size_t MinHeapIncrement = 2*1024*1024
- , class Al = std::allocator<char>
- , template <size_t, size_t, class> class Storage = storage
- >
- struct static_storage_base;
-
                 template <size_t InlineSize, size_t MinHeapIncrement, class Al, template <size_t, size_t, class> class Storage>
                 struct static_storage_base : storage_base
                 {
@@ -66,7 +58,14 @@
                 /// 'static_storage' will be used by a default-constructed monotonic::allocator
                 extern static_storage_base<> static_storage;
 
- //extern static_storage_base<8*1024, 8*1024*1024, std::allocator<char>, shared_storage> static_shared_storage;
+ /*
+ extern static_storage_base<
+ DefaultSizes::StaticInlineSize
+ , DefaultSizes::StaticMinHeapIncrement
+ , std::allocator<char>
+ , shared_storage>
+ static_shared_storage;
+ */
         }
 }
 

Modified: sandbox/monotonic/boost/monotonic/storage.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/storage.h (original)
+++ sandbox/monotonic/boost/monotonic/storage.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,14 +3,10 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_STORAGE_H
+#define BOOST_MONOTONIC_STORAGE_H
 
-#include <utility>
-#include <limits>
-#include <vector>
 #include <boost/monotonic/fixed_storage.h>
-#include <boost/foreach.hpp>
-#include <limits>
 
 namespace boost
 {
@@ -22,7 +18,7 @@
                 /// once that is exhausted, later requests are serviced from the heap.
                 ///
                 /// all allocations remain valid at all times.
- template <size_t InlineSize = 8*1024, size_t MinHeapIncrement = InlineSize*1000, class Al = std::allocator<char> >
+ template <size_t InlineSize, size_t MinHeapIncrement, class Al>
                 struct storage : storage_base
                 {
                         typedef Al Allocator;
@@ -161,4 +157,6 @@
 
 } // namespace boost
 
+#endif // BOOST_MONOTONIC_STORAGE_H
+
 //EOF

Modified: sandbox/monotonic/boost/monotonic/storage_base.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/storage_base.h (original)
+++ sandbox/monotonic/boost/monotonic/storage_base.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,10 +3,10 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_STORAGE_BASE_H
+#define BOOST_MONOTONIC_STORAGE_BASE_H
 
-#include <vector>
-#include <utility>
+#include <boost/monotonic/config.h>
 
 namespace boost
 {
@@ -32,7 +32,11 @@
                         /// return the number of bytes remaining
                         virtual size_t remaining() const = 0;
                 };
- }
-}
+
+ } // namespace monotonic
+
+} // namespace boost
+
+#endif // BOOST_MONOTONIC_STORAGE_BASE_H
 
 //EOF

Modified: sandbox/monotonic/boost/monotonic/vector.h
==============================================================================
--- sandbox/monotonic/boost/monotonic/vector.h (original)
+++ sandbox/monotonic/boost/monotonic/vector.h 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -3,11 +3,11 @@
 // 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)
 
-#pragma once
+#ifndef BOOST_MONOTONIC_VECTOR_H
+#define BOOST_MONOTONIC_VECTOR_H
 
 #include <vector>
 #include <boost/monotonic/allocator.h>
-#include <boost/monotonic/storage_base.h>
 
 namespace boost
 {
@@ -32,4 +32,6 @@
         }
 }
 
+#endif // BOOST_MONOTONIC_VECTOR_H
+
 //EOF

Modified: sandbox/monotonic/libs/monotonic/test/monotonic.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/monotonic.vcproj (original)
+++ sandbox/monotonic/libs/monotonic/test/monotonic.vcproj 2009-06-17 00:34:22 EDT (Wed, 17 Jun 2009)
@@ -182,10 +182,18 @@
>
                                 </File>
                                 <File
+ RelativePath="..\..\..\boost\monotonic\config.h"
+ >
+ </File>
+ <File
                                         RelativePath="..\..\..\boost\monotonic\fixed_storage.h"
>
                                 </File>
                                 <File
+ RelativePath="..\..\..\boost\monotonic\forward_declarations.h"
+ >
+ </File>
+ <File
                                         RelativePath="..\..\..\boost\monotonic\inline_clone_allocator.h"
>
                                 </File>


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