• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • Examples
  • File List

fileperblock_file.h

00001 /***************************************************************************
00002  *  include/stxxl/bits/io/fileperblock_file.h
00003  *
00004  *  Part of the STXXL. See http://stxxl.sourceforge.net
00005  *
00006  *  Copyright (C) 2008, 2009 Johannes Singler <[email protected]>
00007  *
00008  *  Distributed under the Boost Software License, Version 1.0.
00009  *  (See accompanying file LICENSE_1_0.txt or copy at
00010  *  http://www.boost.org/LICENSE_1_0.txt)
00011  **************************************************************************/
00012 
00013 #ifndef STXXL_FILEPERBLOCK_FILE_HEADER
00014 #define STXXL_FILEPERBLOCK_FILE_HEADER
00015 
00016 #include <string>
00017 #include <stxxl/bits/io/disk_queued_file.h>
00018 
00019 
00020 __STXXL_BEGIN_NAMESPACE
00021 
00024 
00027 template <class base_file_type>
00028 class fileperblock_file : public disk_queued_file
00029 {
00030 private:
00031     std::string filename_prefix;
00032     int mode;
00033     unsigned_type current_size;
00034     bool lock_file_created;
00035     base_file_type lock_file;
00036 
00037 protected:
00039     std::string filename_for_block(unsigned_type offset);
00040 
00041 public:
00046     fileperblock_file(
00047         const std::string & filename_prefix,
00048         int mode,
00049         int queue_id = DEFAULT_QUEUE,
00050         int allocator_id = NO_ALLOCATOR);
00051 
00052     virtual ~fileperblock_file();
00053 
00054     virtual void serve(const request * req) throw (io_error);
00055 
00058     virtual void set_size(offset_type new_size) { current_size = new_size; }
00059 
00062     virtual offset_type size() { return current_size; }
00063 
00064     virtual void lock();
00065 
00068     virtual void discard(offset_type offset, offset_type length);
00069 
00071     virtual void export_files(offset_type offset, offset_type length, std::string filename);
00072 
00073     const char * io_type() const;
00074 };
00075 
00077 
00078 __STXXL_END_NAMESPACE
00079 
00080 #endif // !STXXL_FILEPERBLOCK_FILE_HEADER

Generated by  doxygen 1.7.1