Boost logo

Boost Users :

Subject: Re: [Boost-users] How to use the shared region in append mode
From: manish4gupta (manish_at_[hidden])
Date: 2009-10-01 02:17:33


I am trying in this way.
I am writing the shared region and its value in a file and read the file in
the map if shared region exits i make the flag = 1 else make the flag =0;
 bool flag = 0;
 // shared_memory_object::remove(MySharedMemory);

    if(flag == 0)
     managed_shared_memory segment(create_only,MySharedMemory, 99989);
    else
     managed_shared_memory segment(open_only ,MySharedMemory);
  void_allocator alloc_inst (segment.get_segment_manager()); /
   complex_map_type *mymap =
segment.construct<complex_map_type>("MyMap")(std::less<char_string>(),
alloc_inst);

Error message:
Indexingtest.cpp:41: error: ‘segment’ was not declared in this scope
Indexingtest.cpp:42: error: expected primary-expression before ‘>’ token
Indexingtest.cpp:42: error: ‘("MyMap")’ cannot be used as a function

How can i overcome such pblm.

manish4gupta wrote:
>
> First of all i would like to thank for previous answers. Now i am able to
> use the shared region to create a map, insert value into shared map and
> use the shared map. Now moving one step ahead. I am planning to use the
> shared region in append mode. For instance
>
> 1. create shared region if it is not used before //
> how to check this ?
> managed_shared_memory segment(create_only,MySharedMemory, 999999999);
> 2. create map in the region
> // done
> 3. open the map and use the map for retrieving and inserting values
> //done
>
> How i can that the given region already allocated to map so that i can
> insert the value in it otherwise i can create the that region and create
> tha map and insert the value in the map.
>
> Thanks in advance.
>

-- 
View this message in context: http://www.nabble.com/How-to-use-the-shared-region-in-append-mode-tp25677408p25693419.html
Sent from the Boost - Users mailing list archive at Nabble.com.

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net