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

boostfd_file.h

00001 /***************************************************************************
00002  *  include/stxxl/bits/io/boostfd_file.h
00003  *
00004  *  File implementation based on boost::iostreams::file_decriptor
00005  *
00006  *  Part of the STXXL. See http://stxxl.sourceforge.net
00007  *
00008  *  Copyright (C) 2006 Roman Dementiev <[email protected]>
00009  *
00010  *  Distributed under the Boost Software License, Version 1.0.
00011  *  (See accompanying file LICENSE_1_0.txt or copy at
00012  *  http://www.boost.org/LICENSE_1_0.txt)
00013  **************************************************************************/
00014 
00015 #ifndef STXXL_BOOSTFD_FILE_H_
00016 #define STXXL_BOOSTFD_FILE_H_
00017 
00018 #ifndef STXXL_HAVE_BOOSTFD_FILE
00019 #ifdef STXXL_BOOST_CONFIG // if boost is available
00020  #define STXXL_HAVE_BOOSTFD_FILE 1
00021 #else
00022  #define STXXL_HAVE_BOOSTFD_FILE 0
00023 #endif
00024 #endif
00025 
00026 #if STXXL_HAVE_BOOSTFD_FILE
00027 
00028 #include <stxxl/bits/io/disk_queued_file.h>
00029 #include <stxxl/bits/io/request.h>
00030 
00031 #include <boost/iostreams/device/file_descriptor.hpp>
00032 
00033 
00034 __STXXL_BEGIN_NAMESPACE
00035 
00038 
00040 class boostfd_file : public disk_queued_file
00041 {
00042     typedef boost::iostreams::file_descriptor fd_type;
00043 
00044 protected:
00045     mutex fd_mutex;        // sequentialize function calls involving file_des
00046     fd_type file_des;
00047     int mode_;
00048     offset_type _size();
00049 
00050 public:
00051     boostfd_file(const std::string & filename, int mode, int queue_id = DEFAULT_QUEUE, int allocator_id = NO_ALLOCATOR);
00052     ~boostfd_file();
00053     offset_type size();
00054     void set_size(offset_type newsize);
00055     void lock();
00056     void serve(const request * req) throw (io_error);
00057     const char * io_type() const;
00058 };
00059 
00061 
00062 __STXXL_END_NAMESPACE
00063 
00064 #endif  // #if STXXL_HAVE_BOOSTFD_FILE
00065 
00066 #endif  // !STXXL_BOOSTFD_FILE_H_

Generated by  doxygen 1.7.1