Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54261 - in sandbox/monotonic: boost/monotonic libs/monotonic/test
From: christian.schladetsch_at_[hidden]
Date: 2009-06-23 01:04:39


Author: cschladetsch
Date: 2009-06-23 01:04:38 EDT (Tue, 23 Jun 2009)
New Revision: 54261
URL: http://svn.boost.org/trac/boost/changeset/54261

Log:
renamed static_storage_base to static_storage

Text files modified:
   sandbox/monotonic/boost/monotonic/allocator.hpp | 2 +-
   sandbox/monotonic/boost/monotonic/forward_declarations.hpp | 10 +++++++---
   sandbox/monotonic/boost/monotonic/local.hpp | 19 +++++++++++++------
   sandbox/monotonic/boost/monotonic/static_storage.hpp | 31 ++++++++++++++++++++-----------
   sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp | 28 ++++++++++++++--------------
   5 files changed, 55 insertions(+), 35 deletions(-)

Modified: sandbox/monotonic/boost/monotonic/allocator.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/allocator.hpp (original)
+++ sandbox/monotonic/boost/monotonic/allocator.hpp 2009-06-23 01:04:38 EDT (Tue, 23 Jun 2009)
@@ -45,7 +45,7 @@
                         };
 
                         allocator() throw()
- : Parent(boost::monotonic::get_storage<Region,Access>()) { }
+ : Parent(static_storage<Region,Access>::get_storage()) { }
 
                 public:
                         allocator(storage_base &store) throw()

Modified: sandbox/monotonic/boost/monotonic/forward_declarations.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/forward_declarations.hpp (original)
+++ sandbox/monotonic/boost/monotonic/forward_declarations.hpp 2009-06-23 01:04:38 EDT (Tue, 23 Jun 2009)
@@ -47,8 +47,12 @@
                         struct storage_type;
                 }
         
- /// a RIIA structure for setting and resetting the global storage pointer
- template <class Region, class Access = default_access_tag, class Storage = storage<> >
+ /// a RIIA structure for accessing and releasing storage
+ template <size_t N = DefaultSizes::InlineSize
+ , class Region = default_region_tag
+ , size_t M = DefaultSizes::MinHeapIncrement
+ , class Access = default_access_tag
+ , class Al = std::allocator<void> >
                 struct local;
 
                 /// thread-safe storage
@@ -69,7 +73,7 @@
                         , size_t InlineSize = DefaultSizes::StaticInlineSize
                         , size_t MinHeapIncrement = DefaultSizes::StaticMinHeapIncrement
                         , class Al = std::allocator<char> >
- struct static_storage_base;
+ struct static_storage;
 
                 /// common to other monotonic allocators for type T of type Derived
                 template <class T, class Derived>

Modified: sandbox/monotonic/boost/monotonic/local.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/local.hpp (original)
+++ sandbox/monotonic/boost/monotonic/local.hpp 2009-06-23 01:04:38 EDT (Tue, 23 Jun 2009)
@@ -13,15 +13,26 @@
         namespace monotonic
         {
                 /// RIIA for storage
- template <class Region, class Access = default_access_tag>
+ template <size_t InlineSize
+ , class Region
+ , size_t MinHeapIncrement
+ , class Access
+ , class Al
+ >
                 struct local
                 {
+ typedef static_storage<Region,Access,InlineSize,MinHeapIncrement,Al> StaticStorage;
+
                         local()
                         {
                         }
                         ~local()
                         {
- release();
+ reset();
+ }
+ static typename StaticStorage::StorageType &get_storage()
+ {
+ return StaticStorage::get_storage();
                         }
                         static void reset()
                         {
@@ -31,10 +42,6 @@
                         {
                                 get_storage().release();
                         }
- static storage_base &get_storage()
- {
- return ::boost::monotonic::get_storage<Region,Access>();
- }
                 };
 
         } // namespace monotonic

Modified: sandbox/monotonic/boost/monotonic/static_storage.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/static_storage.hpp (original)
+++ sandbox/monotonic/boost/monotonic/static_storage.hpp 2009-06-23 01:04:38 EDT (Tue, 23 Jun 2009)
@@ -30,7 +30,7 @@
                         , size_t InlineSize
                         , size_t MinHeapIncrement
                         , class Al>
- struct static_storage_base
+ struct static_storage
                 {
                         typedef Al HeapAllocator;
                         typedef detail::storage_type<Access> Selector;
@@ -40,7 +40,7 @@
                         static StorageType global;
 
                 public:
- static_storage_base()
+ static_storage()
                         {
                         }
                         static StorageType &get_storage()
@@ -79,23 +79,32 @@
                         , size_t InlineSize
                         , size_t MinHeapIncrement
                         , class Al>
- typename static_storage_base<Region, Access, InlineSize, MinHeapIncrement, Al>::StorageType
- static_storage_base<Region, Access, InlineSize, MinHeapIncrement, Al>::global;
+ typename static_storage<Region, Access, InlineSize, MinHeapIncrement, Al>::StorageType
+ static_storage<Region, Access, InlineSize, MinHeapIncrement, Al>::global;
 
- template <class Region, class Access>
- inline storage_base &get_storage()
- {
- return static_storage_base<Region,Access>::get_storage();
- }
+ //template <class Region
+ // , class Access = default_access_tag
+ // , size_t N = DefaultSizes::InlineSize
+ // , size_t M = DefaultSizes::MinHeapIncrement
+ // , class Al = std::allocator<void> >
+ //struct get_storage
+ //{
+ // typedef static_storage_base<Region,Access,N,M,Al> StaticStorage;
+
+ // static typename StaticStorage::StorageType &get()
+ // {
+ // return StaticStorage::get_storage();
+ // }
+ //};
 
                 inline void reset_storage()
                 {
- get_storage<default_region_tag, default_access_tag>().reset();
+ static_storage<default_region_tag>::reset();
                 }
 
                 inline void release_storage()
                 {
- get_storage<default_region_tag, default_access_tag>().release();
+ static_storage<default_region_tag>::release();
                 }
 
         } // namespace monotonic

Modified: sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/compare_memory_pool.cpp 2009-06-23 01:04:38 EDT (Tue, 23 Jun 2009)
@@ -99,20 +99,20 @@
                 result.mono_elapsed = timer.elapsed();
         }
 
- //if (types.Includes(Type::Monotonic))
- //{
- // srand(42);
- // monotonic::local<local_tag> storage;
- // boost::timer timer;
- // for (size_t n = 0; n < count; ++n)
- // {
- // {
- // fun.test(mono_alloc(), length);
- // }
- // storage.reset();
- // }
- // result.local_mono_elapsed = timer.elapsed();
- //}
+ if (types.Includes(Type::Monotonic))
+ {
+ srand(42);
+ monotonic::local<64*1024, local_tag> storage;
+ boost::timer timer;
+ for (size_t n = 0; n < count; ++n)
+ {
+ {
+ fun.test(monotonic::allocator<void, local_tag>(), length);
+ }
+ storage.reset();
+ }
+ result.local_mono_elapsed = timer.elapsed();
+ }
 
         if (types.Includes(Type::Standard))
         {


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