20 #ifndef TPIE_FILE_ACCESSOR_STREAM_ACCESSOR_H
21 #define TPIE_FILE_ACCESSOR_STREAM_ACCESSOR_H
26 namespace file_accessor {
28 template <
typename file_accessor_t>
32 stream_size_type blockNumber,
33 memory_size_type itemCount)
override
35 stream_size_type loc = this->
header_size() + blockNumber*this->block_size();
36 this->m_fileAccessor.seek_i(loc);
37 stream_size_type offset = blockNumber*this->block_items();
38 if (offset + itemCount > this->
size()) itemCount =
static_cast<memory_size_type
>(this->
size() - offset);
39 memory_size_type z=itemCount*this->item_size();
40 this->m_fileAccessor.read_i(data, z);
45 stream_size_type blockNumber,
46 memory_size_type itemCount)
override
48 stream_size_type loc = this->
header_size() + blockNumber*this->block_size();
52 this->m_fileAccessor.seek_i(loc);
53 stream_size_type offset = blockNumber*this->block_items();
54 memory_size_type z=itemCount*this->item_size();
55 this->m_fileAccessor.write_i(data, z);
56 if (offset+itemCount > this->
size()) this->set_size(offset+itemCount);
63 #endif // TPIE_FILE_ACCESSOR_STREAM_ACCESSOR_H