mng/test_prefetch_pool.cpp

00001 /***************************************************************************
00002  *  mng/test_prefetch_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  *
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 
00014 
00015 #include <iostream>
00016 #include <stxxl/mng>
00017 #include <stxxl/bits/mng/prefetch_pool.h>
00018 
00019 #define BLOCK_SIZE (1024 * 512)
00020 
00021 struct MyType
00022 {
00023     int integer;
00024     char chars[5];
00025 };
00026 
00027 typedef stxxl::typed_block<BLOCK_SIZE, MyType> block_type;
00028 
00029 int main()
00030 {
00031     stxxl::prefetch_pool<block_type> pool(2);
00032     pool.resize(10);
00033     pool.resize(5);
00034     block_type * blk = new block_type;
00035     block_type::bid_type bid;
00036     stxxl::block_manager::get_instance()->new_blocks(stxxl::single_disk(), &bid, (&bid) + 1);
00037     pool.hint(bid);
00038     pool.read(blk, bid)->wait();
00039     delete blk;
00040 }

Generated on Thu Jun 4 10:29:29 2009 for Stxxl by  doxygen 1.4.7