Stxxl
1.4.0
|
00001 /*************************************************************************** 00002 * mng/test_write_pool.cpp 00003 * 00004 * Part of the STXXL. See http://stxxl.sourceforge.net 00005 * 00006 * Copyright (C) 2003 Roman Dementiev <dementiev@mpi-sb.mpg.de> 00007 * Copyright (C) 2009 Andreas Beckmann <beckmann@cs.uni-frankfurt.de> 00008 * 00009 * Distributed under the Boost Software License, Version 1.0. 00010 * (See accompanying file LICENSE_1_0.txt or copy at 00011 * http://www.boost.org/LICENSE_1_0.txt) 00012 **************************************************************************/ 00013 00014 //! \example mng/test_write_pool.cpp 00015 00016 #include <iostream> 00017 #include <stxxl/mng> 00018 #include <stxxl/bits/mng/write_pool.h> 00019 00020 #define BLOCK_SIZE (1024 * 512) 00021 00022 struct MyType 00023 { 00024 int integer; 00025 char chars[5]; 00026 }; 00027 00028 typedef stxxl::typed_block<BLOCK_SIZE, MyType> block_type; 00029 00030 int main() 00031 { 00032 stxxl::write_pool<block_type> pool(100); 00033 pool.resize(10); 00034 pool.resize(5); 00035 block_type * blk = new block_type; 00036 block_type::bid_type bid; 00037 stxxl::block_manager::get_instance()->new_block(stxxl::single_disk(), bid); 00038 pool.write(blk, bid)->wait(); 00039 delete blk; 00040 }