Stxxl  1.4.0
mng/test_mng1.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002  *  mng/test_mng1.cpp
00003  *
00004  *  Part of the STXXL. See http://stxxl.sourceforge.net
00005  *
00006  *  Copyright (C) 2002 Roman Dementiev <dementiev@mpi-sb.mpg.de>
00007  *
00008  *  Distributed under the Boost Software License, Version 1.0.
00009  *  (See accompanying file LICENSE_1_0.txt or copy at
00010  *  http://www.boost.org/LICENSE_1_0.txt)
00011  **************************************************************************/
00012 
00013 #include <stxxl/request>
00014 #include <stxxl/mng>
00015 
00016 
00017 int main()
00018 {
00019     typedef stxxl::typed_block<128 * 1024, double> block_type;
00020     std::vector<block_type::bid_type> bids;
00021     std::vector<stxxl::request_ptr> requests;
00022     stxxl::block_manager * bm = stxxl::block_manager::get_instance();
00023     bm->new_blocks<block_type>(32, stxxl::striping(), std::back_inserter(bids));
00024     std::vector<block_type, stxxl::new_alloc<block_type> > blocks(32);
00025     int vIndex;
00026     for (vIndex = 0; vIndex < 32; ++vIndex) {
00027         for (int vIndex2 = 0; vIndex2 < block_type::size; ++vIndex2) {
00028             blocks[vIndex][vIndex2] = vIndex2;
00029         }
00030     }
00031     for (vIndex = 0; vIndex < 32; ++vIndex) {
00032         requests.push_back(blocks[vIndex].write(bids[vIndex]));
00033     }
00034     stxxl::wait_all(requests.begin(), requests.end());
00035     bm->delete_blocks(bids.begin(), bids.end());
00036     return 0;
00037 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines