16 #ifndef STXXL_IO_FILE_HEADER
17 #define STXXL_IO_FILE_HEADER
21 #if defined (__linux__)
22 #define STXXL_CHECK_BLOCK_ALIGNING
50 class completion_handler;
82 static const int DEFAULT_QUEUE = -1;
83 static const int DEFAULT_LINUXAIO_QUEUE = -2;
84 static const int NO_ALLOCATOR = -1;
85 static const unsigned int DEFAULT_DEVICE_ID = (
unsigned int)(-1);
88 file(
unsigned int device_id = DEFAULT_DEVICE_ID)
89 : m_device_id(device_id)
110 virtual request_ptr awrite(
void* buffer, offset_type pos, size_type bytes,
113 virtual void serve(
void* buffer, offset_type offset, size_type bytes,
118 virtual void set_size(offset_type newsize) = 0;
122 virtual offset_type size() = 0;
127 virtual int get_queue_id()
const = 0;
130 virtual int get_allocator_id()
const = 0;
133 virtual void lock() = 0;
158 STXXL_ERRMSG(
"stxxl::file is being deleted while there are "
159 "still " << nr <<
" (unfinished) requests "
166 virtual const char * io_type()
const = 0;
188 m_request_ref.inc_reference();
194 m_request_ref.dec_reference();
200 return m_request_ref.get_reference_count();
208 static int unlink(
const char* path);
229 #endif // !STXXL_IO_FILE_HEADER
unsigned int get_device_id() const
Returns the file's physical device id.
virtual void discard(offset_type offset, offset_type size)
Discard a region of the file (mark it unused). Some specialized file types may need to know freed reg...
atomic_counted_object m_request_ref
count the number of requests referencing this file
Completion handler class (Loki-style).
file(unsigned int device_id=DEFAULT_DEVICE_ID)
Construct a new file, usually called by a subclass.
unsigned_type get_request_nref()
return number of referenced requests
Provides reference counting abilities for use with counting_ptr with mutex locking.
High-performance smart pointer used as a wrapping reference counting pointer.
request::size_type size_type
the size of a request
Defines interface of file.
#define STXXL_BEGIN_NAMESPACE
void STXXL_UNUSED(const U &)
virtual void export_files(offset_type offset, offset_type length, std::string prefix)
open_mode
Definition of acceptable file open modes.
void add_request_ref()
increment referenced requests
stxxl::internal_size_type size_type
uint64 external_size_type
choose_int_types< my_pointer_size >::unsigned_type unsigned_type
static const size_t bytes
number of bytes in uint_pair
unsigned int m_device_id
The file's physical device id (e.g. used for prefetching sequence calculation)
request::offset_type offset_type
the offset of a request, also the size of the file
virtual void close_remove()
close and remove file
virtual ~file() noexcept(false)
void delete_request_ref()
decrement referenced requests
#define STXXL_END_NAMESPACE