TPIE

11a2c2d
block_collection.h
1 // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; c-file-style: "stroustrup"; -*-
2 // vi:set ts=4 sts=4 sw=4 noet cino+=(0 :
3 // Copyright 2014, The TPIE development team
4 //
5 // This file is part of TPIE.
6 //
7 // TPIE is free software: you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License as published by the
9 // Free Software Foundation, either version 3 of the License, or (at your
10 // option) any later version.
11 //
12 // TPIE is distributed in the hope that it will be useful, but WITHOUT ANY
13 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 // License for more details.
16 //
17 // You should have received a copy of the GNU Lesser General Public License
18 // along with TPIE. If not, see <http://www.gnu.org/licenses/>
19 
23 
24 #ifndef _TPIE_BLOCKS_BLOCK_COLLECTION_H
25 #define _TPIE_BLOCKS_BLOCK_COLLECTION_H
26 
27 #include <tpie/tpie_export.h>
28 #include <tpie/tpie.h>
30 #include <tpie/blocks/block.h>
31 #include <tpie/blocks/freespace_collection.h>
32 
33 namespace tpie {
34 
35 namespace blocks {
36 
40 class TPIE_EXPORT block_collection {
41 public:
48  block_collection(std::string fileName, memory_size_type blockSize, bool writeable);
49 
51 
52  block_collection(const block_collection &) = delete;
53 
58  block_handle get_free_block();
59 
64  void free_block(block_handle handle);
65 
71  void read_block(block_handle handle, block & b);
72 
78  void write_block(block_handle handle, const block & b);
79 private:
80  bits::freespace_collection m_collection;
82 
83  bool m_writeable;
84 };
85 
86 } // blocks namespace
87 
88 } // tpie namespace
89 
90 #endif // _TPIE_BLOCKS_BLOCK_COLLECTION_H
file_accessor.h
tpie::blocks::block_collection
A class to manage writing and reading of block to disk.
Definition: block_collection.h:40
tpie::array< char >
tpie.h
tpie::blocks::bits::freespace_collection
Definition: freespace_collection.h:39
tpie::blocks::block_handle
Definition: block.h:32
tpie
Definition: access_type.h:26
tpie::file_accessor::posix
POSIX-style file accessor.
Definition: posix.h:35