Stxxl  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Protected Member Functions | Private Attributes
stxxl::fileperblock_file< base_file_type > Class Template Reference

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 stxxl::fileperblock_file< base_file_type >:
Inheritance graph
[legend]
Collaboration diagram for stxxl::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 ~fileperblock_file ()
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.

Private Attributes

std::string filename_prefix
int mode
unsigned_type current_size
bool lock_file_created
base_file_type lock_file

Detailed Description

template<class base_file_type>
class stxxl::fileperblock_file< base_file_type >

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

Definition at line 28 of file fileperblock_file.h.


Constructor & Destructor Documentation

template<class base_file_type >
stxxl::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_prefixfilename prefix, numbering will be appended to it
modeopen mode, see file::open_modes
diskdisk(file) identifier

Definition at line 28 of file fileperblock_file.cpp.

template<class base_file_type >
stxxl::fileperblock_file< base_file_type >::~fileperblock_file ( ) [virtual]

Definition at line 38 of file fileperblock_file.cpp.


Member Function Documentation

template<class base_file_type >
void stxxl::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 stxxl::file.

Definition at line 84 of file fileperblock_file.cpp.

template<class base_file_type >
void stxxl::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 stxxl::file.

Definition at line 97 of file fileperblock_file.cpp.

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

Constructs a file name for a given block.

Definition at line 45 of file fileperblock_file.cpp.

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

Definition at line 110 of file fileperblock_file.cpp.

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

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

Implements stxxl::file.

Definition at line 67 of file fileperblock_file.cpp.

References BLOCK_ALIGN, and stxxl::request_interface::wait().

Referenced by stxxl::create_file().

template<class base_file_type >
void stxxl::fileperblock_file< base_file_type >::serve ( const request req) throw (io_error) [virtual]

Implements stxxl::file.

Definition at line 54 of file fileperblock_file.cpp.

References dummy, and stxxl::request_interface::serve().

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

Changes the size of the file.

Parameters:
new_sizevalue of the new file size

Implements stxxl::file.

Definition at line 58 of file fileperblock_file.h.

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

Returns size of the file.

Returns:
file size in length

Implements stxxl::file.

Definition at line 62 of file fileperblock_file.h.


Member Data Documentation

template<class base_file_type>
unsigned_type stxxl::fileperblock_file< base_file_type >::current_size [private]

Definition at line 33 of file fileperblock_file.h.

template<class base_file_type>
std::string stxxl::fileperblock_file< base_file_type >::filename_prefix [private]

Definition at line 31 of file fileperblock_file.h.

template<class base_file_type>
base_file_type stxxl::fileperblock_file< base_file_type >::lock_file [private]

Definition at line 35 of file fileperblock_file.h.

template<class base_file_type>
bool stxxl::fileperblock_file< base_file_type >::lock_file_created [private]

Definition at line 34 of file fileperblock_file.h.

template<class base_file_type>
int stxxl::fileperblock_file< base_file_type >::mode [private]

Definition at line 32 of file fileperblock_file.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines