47#ifndef __ADS_BlockStore
48 #define __ADS_BlockStore
113 [[nodiscard]]
const T &
peek( std::size_t i )
const;
116 [[nodiscard]] std::size_t
blocks(
void )
const {
117 return( f_B.size() - f_free.size() );
121 [[nodiscard]] std::uint64_t
reads(
void )
const {
return( f_reads ); }
124 [[nodiscard]] std::uint64_t
writes(
void )
const {
return( f_writes ); }
131 std::vector< T > f_B;
132 std::vector< bool > f_used;
133 std::vector< std::size_t > f_free;
135 mutable std::uint64_t f_reads = 0;
136 std::uint64_t f_writes = 0;
148#include "ADS/external/impl/BlockStore.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The two-level memory model of Aggarwal and Vitter, simulated so that the algorithms of the external m...
BlockStore(TwoLevelMemory *mem=nullptr)
the empty store, whose I/Os are also counted by mem, if given
Definition BlockStore.h:81
T readBlock(std::size_t i) const
a copy of the block , one read
void resetCounters(void)
the counters back to 0
Definition BlockStore.h:127
std::uint64_t reads(void) const
the reads so far
Definition BlockStore.h:121
void writeBlock(std::size_t i, const T &b)
written in the block , one write
const T & peek(std::size_t i) const
the block , with no I/O, for the checks
std::uint64_t writes(void) const
the writes so far
Definition BlockStore.h:124
std::size_t blocks(void) const
the number of blocks in use
Definition BlockStore.h:116
void freeBlock(std::size_t i)
the block given back
std::size_t placeBlock(const T &b)
written in a free block, one write; its index
the parameters and of the model, the counters of the I/Os and the occupation of the internal memory
Definition TwoLevelMemory.h:94