Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51971 - in trunk/libs/interprocess: proj/vc7ide test
From: igaztanaga_at_[hidden]
Date: 2009-03-25 13:28:07


Author: igaztanaga
Date: 2009-03-25 13:28:06 EDT (Wed, 25 Mar 2009)
New Revision: 51971
URL: http://svn.boost.org/trac/boost/changeset/51971

Log:
Changes for Boost.1.39
Added:
   trunk/libs/interprocess/test/heap_allocator_v1.hpp (contents, props changed)
Removed:
   trunk/libs/interprocess/proj/vc7ide/doc_contA.vcproj
   trunk/libs/interprocess/proj/vc7ide/doc_shared_memory2.vcproj
Text files modified:
   trunk/libs/interprocess/test/stable_vector_test.cpp | 7 +++++++
   1 files changed, 7 insertions(+), 0 deletions(-)

Deleted: trunk/libs/interprocess/proj/vc7ide/doc_contA.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/doc_contA.vcproj 2009-03-25 13:28:06 EDT (Wed, 25 Mar 2009)
+++ (empty file)
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="doc_contA"
- ProjectGUID="{58CCE183-6092-48FE-A4F7-BA0D3A792652}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../Bin/Win32/Debug"
- IntermediateDirectory="Debug/doc_contA"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../.."
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- TreatWChar_tAsBuiltInType="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="winmm.lib"
- OutputFile="$(OutDir)/doc_contA_d.exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../stage/lib"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/doc_contA.pdb"
- SubSystem="1"
- TargetMachine="1"
- FixedBaseAddress="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../Bin/Win32/Release"
- IntermediateDirectory="Release/doc_contA"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../.."
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
- RuntimeLibrary="2"
- TreatWChar_tAsBuiltInType="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="winmm.lib"
- OutputFile="$(OutDir)/doc_contA.exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../stage/lib"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
- <File
- RelativePath="..\..\example\doc_contA.cpp">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>

Deleted: trunk/libs/interprocess/proj/vc7ide/doc_shared_memory2.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/doc_shared_memory2.vcproj 2009-03-25 13:28:06 EDT (Wed, 25 Mar 2009)
+++ (empty file)
@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="7.10"
- Name="doc_shared_memory2"
- ProjectGUID="{58CE1D83-F31E-4FD7-6132-8A79F6307B61}"
- Keyword="Win32Proj">
- <Platforms>
- <Platform
- Name="Win32"/>
- </Platforms>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="../../Bin/Win32/Debug"
- IntermediateDirectory="Debug/doc_shared_memory2"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../.."
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
- MinimalRebuild="TRUE"
- BasicRuntimeChecks="3"
- RuntimeLibrary="3"
- TreatWChar_tAsBuiltInType="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="3"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="winmm.lib"
- OutputFile="$(OutDir)/doc_shared_memory2_d.exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../stage/lib"
- GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)/doc_shared_memory2.pdb"
- SubSystem="1"
- TargetMachine="1"
- FixedBaseAddress="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="../../Bin/Win32/Release"
- IntermediateDirectory="Release/doc_shared_memory2"
- ConfigurationType="1"
- CharacterSet="2">
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../.."
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
- RuntimeLibrary="2"
- TreatWChar_tAsBuiltInType="TRUE"
- ForceConformanceInForLoopScope="FALSE"
- UsePrecompiledHeader="0"
- WarningLevel="4"
- Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
- <Tool
- Name="VCCustomBuildTool"/>
- <Tool
- Name="VCLinkerTool"
- AdditionalDependencies="winmm.lib"
- OutputFile="$(OutDir)/doc_shared_memory2.exe"
- LinkIncremental="1"
- AdditionalLibraryDirectories="../../../../stage/lib"
- GenerateDebugInformation="TRUE"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"/>
- <Tool
- Name="VCMIDLTool"/>
- <Tool
- Name="VCPostBuildEventTool"/>
- <Tool
- Name="VCPreBuildEventTool"/>
- <Tool
- Name="VCPreLinkEventTool"/>
- <Tool
- Name="VCResourceCompilerTool"/>
- <Tool
- Name="VCWebServiceProxyGeneratorTool"/>
- <Tool
- Name="VCXMLDataGeneratorTool"/>
- <Tool
- Name="VCWebDeploymentTool"/>
- <Tool
- Name="VCManagedWrapperGeneratorTool"/>
- <Tool
- Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <Filter
- Name="Source Files"
- Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
- UniqueIdentifier="{437F71DF-CA9B-6637-0366-35222AA2D7FF}">
- <File
- RelativePath="..\..\example\doc_shared_memory2.cpp">
- </File>
- </Filter>
- <Filter
- Name="Header Files"
- Filter="h;hpp;hxx;hm;inl;inc;xsd"
- UniqueIdentifier="{90954928-D6AD-44D0-8EB8-BF2E56AB26FB}">
- </Filter>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>

Added: trunk/libs/interprocess/test/heap_allocator_v1.hpp
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/test/heap_allocator_v1.hpp 2009-03-25 13:28:06 EDT (Wed, 25 Mar 2009)
@@ -0,0 +1,159 @@
+///////////////////////////////////////////////////////////////////////////////
+//
+// (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.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_INTERPROCESS_HEAP_ALLOCATOR_V1_HPP
+#define BOOST_INTERPROCESS_HEAP_ALLOCATOR_V1_HPP
+
+#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+# pragma once
+#endif
+
+#include <boost/interprocess/detail/config_begin.hpp>
+#include <boost/interprocess/detail/workaround.hpp>
+
+#include <boost/pointer_to_other.hpp>
+
+#include <boost/interprocess/interprocess_fwd.hpp>
+#include <boost/interprocess/containers/allocation_type.hpp>
+#include <boost/interprocess/detail/utilities.hpp>
+#include <boost/interprocess/containers/version_type.hpp>
+#include <boost/interprocess/exceptions.hpp>
+#include <memory>
+#include <algorithm>
+#include <cstddef>
+#include <stdexcept>
+
+//!\file
+//!Describes an heap_allocator_v1 that allocates portions of fixed size
+//!memory buffer (shared memory, mapped file...)
+
+namespace boost {
+namespace interprocess {
+namespace test {
+
+//!An STL compatible heap_allocator_v1 that uses a segment manager as
+//!memory source. The internal pointer type will of the same type (raw, smart) as
+//!"typename SegmentManager::void_pointer" type. This allows
+//!placing the heap_allocator_v1 in shared memory, memory mapped-files, etc...*/
+template<class T, class SegmentManager>
+class heap_allocator_v1
+{
+ private:
+ typedef heap_allocator_v1<T, SegmentManager> self_t;
+ typedef SegmentManager segment_manager;
+ typedef typename segment_manager::void_pointer aux_pointer_t;
+
+ typedef typename
+ boost::pointer_to_other
+ <aux_pointer_t, const void>::type cvoid_ptr;
+
+ typedef typename boost::pointer_to_other
+ <cvoid_ptr, segment_manager>::type alloc_ptr_t;
+
+ template<class T2, class SegmentManager2>
+ heap_allocator_v1& operator=(const heap_allocator_v1<T2, SegmentManager2>&);
+
+ heap_allocator_v1& operator=(const heap_allocator_v1&);
+
+ alloc_ptr_t mp_mngr;
+
+ public:
+ typedef T value_type;
+ typedef typename boost::pointer_to_other
+ <cvoid_ptr, T>::type pointer;
+ typedef typename boost::
+ pointer_to_other<pointer, const T>::type const_pointer;
+ typedef typename detail::add_reference
+ <value_type>::type reference;
+ typedef typename detail::add_reference
+ <const value_type>::type const_reference;
+ typedef std::size_t size_type;
+ typedef std::ptrdiff_t difference_type;
+
+ //!Obtains an heap_allocator_v1 of other type
+ template<class T2>
+ struct rebind
+ {
+ typedef heap_allocator_v1<T2, SegmentManager> other;
+ };
+
+ //!Returns the segment manager. Never throws
+ segment_manager* get_segment_manager()const
+ { return detail::get_pointer(mp_mngr); }
+/*
+ //!Returns address of mutable object. Never throws
+ pointer address(reference value) const
+ { return pointer(addressof(value)); }
+
+ //!Returns address of non mutable object. Never throws
+ const_pointer address(const_reference value) const
+ { return const_pointer(addressof(value)); }
+*/
+ //!Constructor from the segment manager. Never throws
+ heap_allocator_v1(segment_manager *segment_mngr)
+ : mp_mngr(segment_mngr) { }
+
+ //!Constructor from other heap_allocator_v1. Never throws
+ heap_allocator_v1(const heap_allocator_v1 &other)
+ : mp_mngr(other.get_segment_manager()){ }
+
+ //!Constructor from related heap_allocator_v1. Never throws
+ template<class T2>
+ heap_allocator_v1(const heap_allocator_v1<T2, SegmentManager> &other)
+ : mp_mngr(other.get_segment_manager()){}
+
+ //!Allocates memory for an array of count elements.
+ //!Throws boost::interprocess::bad_alloc if there is no enough memory
+ pointer allocate(size_type count, cvoid_ptr hint = 0)
+ { (void)hint; return ::new value_type[count]; }
+
+ //!Deallocates memory previously allocated. Never throws
+ void deallocate(const pointer &ptr, size_type)
+ { return ::delete[] detail::get_pointer(ptr) ; }
+
+ //!Construct object, calling constructor.
+ //!Throws if T(const T&) throws
+ void construct(const pointer &ptr, const_reference value)
+ { new((void*)detail::get_pointer(ptr)) value_type(value); }
+
+ //!Destroys object. Throws if object's destructor throws
+ void destroy(const pointer &ptr)
+ { BOOST_ASSERT(ptr != 0); (*ptr).~value_type(); }
+
+ //!Returns the number of elements that could be allocated. Never throws
+ size_type max_size() const
+ { return mp_mngr->get_size(); }
+
+ //!Swap segment manager. Does not throw. If each heap_allocator_v1 is placed in
+ //!different memory segments, the result is undefined.
+ friend void swap(self_t &alloc1, self_t &alloc2)
+ { detail::do_swap(alloc1.mp_mngr, alloc2.mp_mngr); }
+};
+
+//!Equality test for same type of heap_allocator_v1
+template<class T, class SegmentManager> inline
+bool operator==(const heap_allocator_v1<T , SegmentManager> &alloc1,
+ const heap_allocator_v1<T, SegmentManager> &alloc2)
+ { return alloc1.get_segment_manager() == alloc2.get_segment_manager(); }
+
+//!Inequality test for same type of heap_allocator_v1
+template<class T, class SegmentManager> inline
+bool operator!=(const heap_allocator_v1<T, SegmentManager> &alloc1,
+ const heap_allocator_v1<T, SegmentManager> &alloc2)
+ { return alloc1.get_segment_manager() != alloc2.get_segment_manager(); }
+
+} //namespace test {
+} //namespace interprocess {
+} //namespace boost {
+
+#include <boost/interprocess/detail/config_end.hpp>
+
+#endif //BOOST_INTERPROCESS_HEAP_ALLOCATOR_V1_HPP
+

Modified: trunk/libs/interprocess/test/stable_vector_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/stable_vector_test.cpp (original)
+++ trunk/libs/interprocess/test/stable_vector_test.cpp 2009-03-25 13:28:06 EDT (Wed, 25 Mar 2009)
@@ -19,6 +19,7 @@
 #include <boost/interprocess/containers/stable_vector.hpp>
 #include <boost/interprocess/allocators/allocator.hpp>
 #include "allocator_v1.hpp"
+#include "heap_allocator_v1.hpp"
 #include "check_equal_containers.hpp"
 #include "movable_int.hpp"
 #include "expand_bwd_test_allocator.hpp"
@@ -61,6 +62,9 @@
    typedef test::allocator_v1<int, managed_shared_memory::segment_manager> ShmemV1Allocator;
    typedef stable_vector<int, ShmemV1Allocator> MyV1Vector;
 
+ typedef test::heap_allocator_v1<int, managed_shared_memory::segment_manager> ShmemHeapV1Allocator;
+ typedef stable_vector<int, ShmemHeapV1Allocator> MyHeapV1Vector;
+
    typedef allocator<test::movable_int, managed_shared_memory::segment_manager> ShmemMoveAllocator;
    typedef stable_vector<test::movable_int, ShmemMoveAllocator> MyMoveVector;
 
@@ -73,6 +77,9 @@
    if(test::vector_test<managed_shared_memory, MyV1Vector>())
       return 1;
 
+ if(test::vector_test<managed_shared_memory, MyHeapV1Vector>())
+ return 1;
+
    if(test::vector_test<managed_shared_memory, MyMoveVector>())
       return 1;
 


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