19 #ifndef __TPIE_FILE_STREAM_H__
20 #define __TPIE_FILE_STREAM_H__
80 template <
typename IT>
107 template <
typename IT>
135 float blockFactor=1.0,
136 bool includeDefaultFileAccessor=
true) throw() {
140 if (includeDefaultFileAccessor)
146 file_stream_base::swap(other);
149 friend struct stream_item_array_operations;
159 template <
typename T>
166 #endif //__TPIE_FILE_STREAM_H__
static void write_array(Stream &stream, const IT &start, const IT &end)
Write several items to the stream.
static memory_size_type block_memory_usage(double blockFactor)
Amount of memory used by a single block given the block factor.
Memory management subsystem.
T item_type
The type of the items stored in the stream.
static void read_array(Stream &stream, const IT &start, const IT &end)
Reads several items from the stream.
void write(const IT &start, const IT &end)
Write several items to the stream.
stream_size_type offset() const
Calculate the current offset in the stream.
const item_type & read()
Read an item from the stream.
const item_type & read_back()
Read an item from the stream.
memory_size_type m_index
Item index into the current block, or maxint if we don't have a block.
Streams that support substreams.
void write(const item_type &item)
Write an item to the stream.
bool is_writable() const
Check if we can write to the file.
void seek(stream_offset_type offset, offset_type whence=beginning)
Moves the logical offset in the stream.
static memory_size_type memory_usage()
Return memory usage of this file accessor.
static memory_size_type memory_usage(float blockFactor=1.0, bool includeDefaultFileAccessor=true)
Calculate the amount of memory used by a single file_stream.
void read(const IT &start, const IT &end)
Reads several items from the stream.
Simple class acting both as file and a file::stream.
file_stream(double blockFactor=1.0, file_accessor::file_accessor *fileAccessor=NULL)
Construct a new file_stream.
void update_block()
Fetch block from disk as indicated by m_nextBlock, writing old block to disk if needed.
Item type-agnostic file_stream operations.
stream_size_type size() const
Get the size of the file measured in items.