Public Member Functions | Protected Member Functions

fileperblock_file< base_file_type > Class Template Reference
[File implementations]

Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption. More...

#include <fileperblock_file.h>

Inheritance diagram for fileperblock_file< base_file_type >:
Inheritance graph
[legend]
Collaboration diagram for fileperblock_file< base_file_type >:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 fileperblock_file (const std::string &filename_prefix, int mode, int queue_id=DEFAULT_QUEUE, int allocator_id=NO_ALLOCATOR)
 constructs file object
virtual void serve (const request *req) throw (io_error)
virtual void set_size (offset_type new_size)
 Changes the size of the file.
virtual offset_type size ()
 Returns size of the file.
virtual void lock ()
 Locks file for reading and writing (acquires a lock in the file system).
virtual void discard (offset_type offset, offset_type length)
 Frees the specified region. Actually deletes the corresponding file if the whole thing is deleted.
virtual void export_files (offset_type offset, offset_type length, std::string filename)
 Rename the file corresponding to the offset such that it is out of reach for deleting.
const char * io_type () const
 Identifies the type of I/O implementation.

Protected Member Functions

std::string filename_for_block (unsigned_type offset)
 Constructs a file name for a given block.

Detailed Description

template<class base_file_type>
class fileperblock_file< base_file_type >

Implementation of file based on other files, dynamically allocate one file per block. Allows for dynamic disk space consumption.


Constructor & Destructor Documentation

template<class base_file_type >
__STXXL_BEGIN_NAMESPACE fileperblock_file< base_file_type >::fileperblock_file ( const std::string &  filename_prefix,
int  mode,
int  queue_id = DEFAULT_QUEUE,
int  allocator_id = NO_ALLOCATOR 
)

constructs file object

Parameters:
filename_prefix filename prefix, numbering will be appended to it
mode open mode, see file::open_modes
disk disk(file) identifier

Member Function Documentation

template<class base_file_type >
void fileperblock_file< base_file_type >::discard ( offset_type  offset,
offset_type  length 
) [virtual]

Frees the specified region. Actually deletes the corresponding file if the whole thing is deleted.

Reimplemented from file.

References fileperblock_file< base_file_type >::filename_for_block().

template<class base_file_type >
void fileperblock_file< base_file_type >::export_files ( offset_type  offset,
offset_type  length,
std::string  filename 
) [virtual]

Rename the file corresponding to the offset such that it is out of reach for deleting.

Reimplemented from file.

References fileperblock_file< base_file_type >::filename_for_block().

template<class base_file_type >
std::string fileperblock_file< base_file_type >::filename_for_block ( unsigned_type  offset  )  [protected]

Constructs a file name for a given block.

Referenced by fileperblock_file< base_file_type >::discard(), and fileperblock_file< base_file_type >::export_files().

template<class base_file_type >
const char * fileperblock_file< base_file_type >::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 file.

template<class base_file_type >
void fileperblock_file< base_file_type >::lock (  )  [virtual]

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

Implements file.

template<class base_file_type>
virtual void fileperblock_file< base_file_type >::set_size ( offset_type  new_size  )  [inline, virtual]

Changes the size of the file.

Parameters:
new_size value of the new file size

Implements file.

template<class base_file_type>
virtual offset_type fileperblock_file< base_file_type >::size (  )  [inline, virtual]

Returns size of the file.

Returns:
file size in length

Implements file.


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