file Class Reference
[I/O primitives layer]

Defines interface of file. More...

#include <iobase.h>

Inheritance diagram for file:

[legend]
List of all members.

Public Types

 RDONLY = 1
 only reading of the file is allowed
 WRONLY = 2
 only writing of the file is allowed
 RDWR = 4
 read and write of the file are allowed
 CREAT = 8
 in case file does not exist no error occurs and file is newly created
 DIRECT = 16
 I/Os proceed bypassing file system buffers, i.e. unbuffered I/O.
 TRUNC = 32
 once file is opened its length becomes zero
enum  open_mode {
  RDONLY = 1, WRONLY = 2, RDWR = 4, CREAT = 8,
  DIRECT = 16, TRUNC = 32
}
 Definition of acceptable file open modes. More...

Public Member Functions

virtual request_ptr aread (void *buffer, stxxl::int64 pos, size_t bytes, completion_handler on_cmpl)=0
 Schedules asynchronous read request to the file.
virtual request_ptr awrite (void *buffer, stxxl::int64 pos, size_t bytes, completion_handler on_cmpl)=0
 Schedules asynchronous write request to the file.
virtual void set_size (stxxl::int64 newsize)=0
 Changes the size of the file.
virtual stxxl::int64 size ()=0
 Returns size of the file.
 __STXXL_DEPRECATED (int get_disk_number())
 deprecated, use stxxl::file::get_id() instead
int get_id ()
 Returns file's identifier
Remarks:
might be used as disk's id in case disk to file mapping.

virtual void lock ()
 Locks file for reading and writing.
virtual void delete_region (int64 offset, unsigned_type size)
 Some specialized file types may need to know freed regions.

Protected Member Functions

 file (int _id)
 Initializes file object.

Detailed Description

Defines interface of file.

It is a base class for different implementations that might base on various file systems or even remote storage interfaces


Member Enumeration Documentation

enum file::open_mode

Definition of acceptable file open modes.

Various open modes in a file system must be converted to this set of acceptable modes

Enumerator:
RDONLY  only reading of the file is allowed
WRONLY  only writing of the file is allowed
RDWR  read and write of the file are allowed
CREAT  in case file does not exist no error occurs and file is newly created
DIRECT  I/Os proceed bypassing file system buffers, i.e. unbuffered I/O.
TRUNC  once file is opened its length becomes zero


Constructor & Destructor Documentation

file::file ( int  _id  )  [inline, protected]

Initializes file object.

Parameters:
_id file identifier
Remarks:
Called in implementations of file


Member Function Documentation

file::__STXXL_DEPRECATED ( int   get_disk_number()  )  [inline]

deprecated, use stxxl::file::get_id() instead

virtual request_ptr file::aread ( void *  buffer,
stxxl::int64  pos,
size_t  bytes,
completion_handler  on_cmpl 
) [pure virtual]

Schedules asynchronous read request to the file.

Parameters:
buffer pointer to memory buffer to read into
pos starting file position to read
bytes number of bytes to transfer
on_cmpl I/O completion handler
Returns:
request_ptr object, that can be used to track the status of the operation

Implemented in mem_file, mmap_file, sim_disk_file, and syscall_file.

virtual request_ptr file::awrite ( void *  buffer,
stxxl::int64  pos,
size_t  bytes,
completion_handler  on_cmpl 
) [pure virtual]

Schedules asynchronous write request to the file.

Parameters:
buffer pointer to memory buffer to write from
pos starting file position to write
bytes number of bytes to transfer
on_cmpl I/O completion handler
Returns:
request_ptr object, that can be used to track the status of the operation

Implemented in mem_file, mmap_file, sim_disk_file, and syscall_file.

virtual void file::delete_region ( int64  offset,
unsigned_type  size 
) [inline, virtual]

Some specialized file types may need to know freed regions.

Reimplemented in mem_file.

int file::get_id (  )  [inline]

Returns file's identifier

Remarks:
might be used as disk's id in case disk to file mapping.

Returns:
integer file identifier, passed as constructor parameter

virtual void file::lock (  )  [inline, virtual]

Locks file for reading and writing.

Reimplemented in mem_file, and ufs_file_base.

virtual void file::set_size ( stxxl::int64  newsize  )  [pure virtual]

Changes the size of the file.

Parameters:
newsize value of the new file size

Implemented in mem_file, sim_disk_file, and ufs_file_base.

virtual stxxl::int64 file::size (  )  [pure virtual]

Returns size of the file.

Returns:
file size in bytes

Implemented in mem_file, and ufs_file_base.


The documentation for this class was generated from the following file:
Generated on Thu Jun 4 10:29:32 2009 for Stxxl by  doxygen 1.4.7