STXXL  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
stxxl::mem_file Class Reference

Detailed Description

Implementation of file based on new[] and memcpy.

Definition at line 27 of file mem_file.h.

+ Inheritance diagram for stxxl::mem_file:
+ Collaboration diagram for stxxl::mem_file:

Public Member Functions

 mem_file (int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR)
 constructs file object. More...
 
 ~mem_file ()
 
void discard (offset_type offset, offset_type size)
 
const char * io_type () const
 Identifies the type of I/O implementation. More...
 
void lock ()
 Locks file for reading and writing (acquires a lock in the file system). More...
 
void serve (const request *req) throw (io_error)
 
void set_size (offset_type newsize)
 
offset_type size ()
 Returns size of the file. More...
 
- Public Member Functions inherited from stxxl::disk_queued_file
 disk_queued_file (int queue_id, int allocator_id)
 
request_ptr aread (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl)
 
request_ptr awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl)
 
virtual int get_allocator_id () const
 Returns the file's allocator. More...
 
virtual int get_queue_id () const
 Returns the identifier of the file's queue. More...
 
- Public Member Functions inherited from stxxl::file
virtual ~file ()
 
void add_request_ref ()
 
virtual request_ptr aread (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl)=0
 Schedules an asynchronous read request to the file. More...
 
virtual request_ptr awrite (void *buffer, offset_type pos, size_type bytes, const completion_handler &on_cmpl)=0
 Schedules an asynchronous write request to the file. More...
 
virtual void close_remove ()
 close and remove file More...
 
void delete_request_ref ()
 
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 regions. More...
 
virtual void export_files (offset_type offset, offset_type length, std::string prefix)
 
virtual int get_physical_device_id () const
 
int get_request_nref ()
 
virtual void set_size (offset_type newsize)=0
 Changes the size of the file. More...
 

Private Attributes

mutex m_mutex
 
char * ptr
 
offset_type sz
 

Additional Inherited Members

- Public Types inherited from stxxl::file
typedef request::offset_type offset_type
 the offset of a request, also the size of the file More...
 
enum  open_mode {
  RDONLY = 1, WRONLY = 2, RDWR = 4, CREAT = 8,
  DIRECT = 16, TRUNC = 32, SYNC = 64, NO_LOCK = 128,
  REQUIRE_DIRECT = 256
}
 Definition of acceptable file open modes. More...
 
typedef request::size_type size_type
 the size of a request More...
 
- Static Public Member Functions inherited from stxxl::file
static int unlink (const char *path)
 unlink path from filesystem More...
 
static int truncate (const char *path, external_size_type length)
 truncate a path to given length. Use this only if you dont have a fileio-specific object, which provides truncate(). More...
 
- Static Public Attributes inherited from stxxl::file
static const int DEFAULT_QUEUE = -1
 
static const int NO_ALLOCATOR = -1
 
static const int NO_QUEUE = -2
 
- Protected Member Functions inherited from stxxl::file
 file ()
 Initializes file object. More...
 

Constructor & Destructor Documentation

stxxl::mem_file::mem_file ( int  queue_id = DEFAULT_QUEUE,
int  allocator_id = NO_ALLOCATOR 
)
inline

constructs file object.

Definition at line 36 of file mem_file.h.

stxxl::mem_file::~mem_file ( )

Definition at line 52 of file mem_file.cpp.

Member Function Documentation

void stxxl::mem_file::discard ( offset_type  offset,
offset_type  size 
)

Definition at line 77 of file mem_file.cpp.

References BLOCK_ALIGN, max(), stxxl::STXXL_UNUSED(), and STXXL_VERBOSE.

const char * stxxl::mem_file::io_type ( ) const
virtual

Identifies the type of I/O implementation.

Returns
pointer to null terminated string of characters, containing the name of I/O implementation

Reimplemented from stxxl::file.

Definition at line 47 of file mem_file.cpp.

void stxxl::mem_file::lock ( )
virtual

Locks file for reading and writing (acquires a lock in the file system).

Implements stxxl::file.

Definition at line 58 of file mem_file.cpp.

Referenced by stxxl::create_file().

void stxxl::mem_file::serve ( const request req)
throw (io_error
)
virtual

Implements stxxl::file.

Definition at line 25 of file mem_file.cpp.

References bytes.

void stxxl::mem_file::set_size ( offset_type  newsize)

Definition at line 68 of file mem_file.cpp.

References max().

file::offset_type stxxl::mem_file::size ( )
virtual

Returns size of the file.

Returns
file size in bytes

Implements stxxl::file.

Definition at line 63 of file mem_file.cpp.

Member Data Documentation

mutex stxxl::mem_file::m_mutex
private

Definition at line 32 of file mem_file.h.

char* stxxl::mem_file::ptr
private

Definition at line 29 of file mem_file.h.

offset_type stxxl::mem_file::sz
private

Definition at line 30 of file mem_file.h.


The documentation for this class was generated from the following files: