Fixed vector_test and cleaned up intermodule singleton code.

This commit is contained in:
Ion Gaztañaga
2014-07-10 21:38:52 +02:00
parent fe40c36e6c
commit de72bbf2d8
6 changed files with 17 additions and 15 deletions

View File

@@ -20,8 +20,9 @@
#ifdef BOOST_INTERPROCESS_WINDOWS
#include <boost/interprocess/detail/windows_intermodule_singleton.hpp>
#else
#include <boost/interprocess/detail/portable_intermodule_singleton.hpp>
#endif
#include <boost/interprocess/detail/portable_intermodule_singleton.hpp>
namespace boost{
namespace interprocess{

View File

@@ -310,7 +310,6 @@ class managed_open_or_create_impl
{
typedef bool_<FileBased> file_like_t;
(void)mode;
error_info err;
bool created = false;
bool ronly = false;
bool cow = false;

View File

@@ -23,6 +23,7 @@
#include <boost/interprocess/detail/os_file_functions.hpp>
#include <boost/interprocess/detail/shared_dir_helpers.hpp>
#include <boost/interprocess/detail/intermodule_singleton.hpp>
#include <boost/interprocess/detail/portable_intermodule_singleton.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/sync/spin/wait.hpp>
#include <boost/interprocess/sync/detail/common_algorithms.hpp>

View File

@@ -29,7 +29,7 @@
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <boost/cstdint.hpp>
#include <string>
#include <map>
#include <boost/container/map.hpp>
namespace boost{
namespace interprocess{
@@ -49,7 +49,7 @@ namespace intermodule_singleton_helpers {
// max and current semaphore count.
class windows_semaphore_based_map
{
typedef std::map<std::string, ref_count_ptr> map_type;
typedef boost::container::map<std::string, ref_count_ptr> map_type;
public:
windows_semaphore_based_map()

View File

@@ -185,8 +185,8 @@ bool test_assign_with_expand_bwd()
const int Offset[] = { 50, 50, 50};
const int InitialSize[] = { 25, 25, 25};
const int AssignSize[] = { 40, 60, 80};
const int Iterations = sizeof(AssignSize)/sizeof(int);
const int InsertSize[] = { 15, 35, 55};
const int Iterations = sizeof(InsertSize)/sizeof(int);
for(int iteration = 0; iteration <Iterations; ++iteration)
{
@@ -199,11 +199,11 @@ bool test_assign_with_expand_bwd()
initial_data[i] = i;
}
//Create data to assign
std::vector<non_volatile_value_type> data_to_assign;
data_to_assign.resize(AssignSize[iteration]);
for(int i = 0; i < AssignSize[iteration]; ++i){
data_to_assign[i] = -i;
//Create data to insert
std::vector<non_volatile_value_type> data_to_insert;
data_to_insert.resize(InsertSize[iteration]);
for(int i = 0; i < InsertSize[iteration]; ++i){
data_to_insert[i] = -i;
}
//Insert initial data to the vector to test
@@ -213,13 +213,13 @@ bool test_assign_with_expand_bwd()
vector.insert( vector.begin()
, initial_data.begin(), initial_data.end());
//Assign data
vector.assign(data_to_assign.begin(), data_to_assign.end());
initial_data.assign(data_to_assign.begin(), data_to_assign.end());
//Insert data
vector.insert(vector.cbegin(), data_to_insert.begin(), data_to_insert.end());
initial_data.insert(initial_data.begin(), data_to_insert.begin(), data_to_insert.end());
//Now check that values are equal
if(!CheckEqualVector(vector, initial_data)){
std::cout << "test_assign_with_expand_bwd::CheckEqualVector failed." << std::endl
std::cout << "test_insert_with_expand_bwd::CheckEqualVector failed." << std::endl
<< " Class: " << typeid(VectorWithExpandBwdAllocator).name() << std::endl
<< " Iteration: " << iteration << std::endl;
return false;

View File

@@ -9,6 +9,7 @@
//////////////////////////////////////////////////////////////////////////////
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/detail/intermodule_singleton.hpp>
#include <boost/interprocess/detail/portable_intermodule_singleton.hpp>
#include <iostream>
using namespace boost::interprocess;