[go: up one dir, main page]

Menu

[19aa1c]: / mng / write_pool.cpp  Maximize  Restore  History

Download this file

38 lines (29 with data), 796 Bytes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/***************************************************************************
* write_pool.cpp
*
* Wed Jul 2 15:32:34 2003
* Copyright 2003 Roman Dementiev
* dementiev@mpi-sb.mpg.de
****************************************************************************/
#include <iostream>
#include "../mng/mng.h"
#include "write_pool.h"
//! \example mng/write_pool.cpp
#define BLOCK_SIZE (1024*512)
struct MyType
{
int integer;
char chars[5];
};
using namespace stxxl;
typedef typed_block<BLOCK_SIZE,MyType> block_type;
int main ()
{
write_pool<block_type> pool(100);
pool.resize(10);
pool.resize(5);
block_type * blk = new block_type;
block_type::bid_type bid;
block_manager::get_instance()->new_blocks(single_disk(),&bid,(&bid) +1);
pool.write(blk,bid);
}