1 /***************************************************************************
2  *  tests/mng/test_write_pool.cpp
3  *
4  *  Part of FOXXLL. See http://foxxll.org
5  *
6  *  Copyright (C) 2003 Roman Dementiev <dementiev@mpi-sb.mpg.de>
7  *  Copyright (C) 2009 Andreas Beckmann <beckmann@cs.uni-frankfurt.de>
8  *
9  *  Distributed under the Boost Software License, Version 1.0.
10  *  (See accompanying file LICENSE_1_0.txt or copy at
11  *  http://www.boost.org/LICENSE_1_0.txt)
12  **************************************************************************/
13 
14 //! \example mng/test_write_pool.cpp
15 
16 #include <iostream>
17 
18 #include <foxxll/mng.hpp>
19 #include <foxxll/mng/write_pool.hpp>
20 
21 #define BLOCK_SIZE (1024 * 512)
22 
23 struct MyType
24 {
25     int integer;
26     char chars[5];
27 };
28 
29 using block_type = foxxll::typed_block<BLOCK_SIZE, MyType>;
30 
31 // forced instantiation
32 template class foxxll::typed_block<BLOCK_SIZE, MyType>;
33 template class foxxll::write_pool<block_type>;
34 
main()35 int main()
36 {
37     foxxll::write_pool<block_type> pool(100);
38     pool.resize(10);
39     pool.resize(5);
40     block_type* blk = new block_type;
41     block_type::bid_type bid;
42     foxxll::block_manager::get_instance()->new_block(foxxll::single_disk(), bid);
43     pool.write(blk, bid)->wait();
44     delete blk;
45 }
46 
47 /**************************************************************************/
48