15 #ifndef STXXL_BID_HEADER
16 #define STXXL_BID_HEADER
22 #include <stxxl/bits/io/file.h>
23 #include <stxxl/bits/common/utils.h>
25 #ifndef STXXL_VERBOSE_BLOCK_LIFE_CYCLE
26 #define STXXL_VERBOSE_BLOCK_LIFE_CYCLE STXXL_VERBOSE2
28 #define FMT_BID(_bid_) "[" << (_bid_).storage->get_allocator_id() << "]0x" << std::hex << std::setfill('0') << std::setw(8) << (_bid_).offset << "/0x" << std::setw(8) << (_bid_).size
31 __STXXL_BEGIN_NAMESPACE
39 template <
unsigned SIZE>
51 BID() : storage(NULL), offset(0)
56 return storage != NULL;
59 BID(
file * s, stxxl::int64 o) : storage(s), offset(o)
62 BID(
const BID & obj) : storage(obj.storage), offset(obj.offset)
65 template <
unsigned BlockSize>
66 explicit BID(
const BID<BlockSize> & obj) : storage(obj.storage), offset(obj.offset)
69 template <
unsigned BlockSize>
77 bool is_managed()
const
99 BID() : storage(NULL), offset(0), size(0)
102 BID(
file * f, stxxl::int64 o,
unsigned s) : storage(f), offset(o), size(s)
111 template <
unsigned blk_sz>
117 template <
unsigned blk_sz>
123 template <
unsigned blk_sz>
124 std::ostream & operator << (std::ostream & s, const BID<blk_sz> & bid)
129 s <<
"[" << bid.storage <<
"|";
134 s <<
"]0x" << std::hex << std::setfill(
'0') << std::setw(8) << bid.offset <<
"/0x" << std::setw(8) << bid.size << std::dec;
140 template <
unsigned BLK_SIZE>
141 class BIDArray :
public std::vector<BID<BLK_SIZE> >
148 template <
unsigned BLK_SIZE>
149 class BIDArray :
private noncopyable
160 BIDArray() : _size(0), array(NULL)
170 return array + _size;
173 BIDArray(unsigned_type size) : _size(size)
178 unsigned_type size()
const
183 reference operator [] (int_type i)
188 void resize(unsigned_type newsize)
192 STXXL_MSG(
"Warning: resizing nonempty BIDArray");
195 memcpy((
void *)array, (
void *)tmp,
216 __STXXL_END_NAMESPACE
218 #endif // !STXXL_BID_HEADER
Defines interface of file.
Definition: file.h:90
Definition: test_stream.cpp:36
unsigned size
size of the block in bytes
Definition: bid.h:92
Block size.
Definition: bid.h:44
file * storage
pointer to the file of the block
Definition: bid.h:48
virtual int get_allocator_id() const =0
Returns the file's allocator.
stxxl::int64 offset
offset within the file of the block
Definition: bid.h:91
stxxl::int64 offset
offset within the file of the block
Definition: bid.h:49
External vector container.
Definition: vector.h:259
file * storage
pointer to the file of the block
Definition: bid.h:90
Blocks size, given by the parameter.
Definition: bid.h:45
Block identifier class.
Definition: bid.h:40