00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef STXXL_BOOSTFD_FILE_H_
00018 #define STXXL_BOOSTFD_FILE_H_
00019
00020 #ifndef STXXL_HAVE_BOOSTFD_FILE
00021 #ifdef STXXL_BOOST_CONFIG // if boost is available
00022 #define STXXL_HAVE_BOOSTFD_FILE 1
00023 #else
00024 #define STXXL_HAVE_BOOSTFD_FILE 0
00025 #endif
00026 #endif
00027
00028 #if STXXL_HAVE_BOOSTFD_FILE
00029
00030 #include <stxxl/bits/io/disk_queued_file.h>
00031 #include <stxxl/bits/io/request.h>
00032
00033 #include <boost/iostreams/device/file_descriptor.hpp>
00034
00035
00036 __STXXL_BEGIN_NAMESPACE
00037
00040
00042 class boostfd_file : public disk_queued_file
00043 {
00044 typedef boost::iostreams::file_descriptor fd_type;
00045
00046 protected:
00047 mutex fd_mutex;
00048 fd_type file_des;
00049 int mode_;
00050 offset_type _size();
00051
00052 public:
00053 boostfd_file(const std::string & filename, int mode, int queue_id = DEFAULT_QUEUE, int allocator_id = NO_ALLOCATOR);
00054 ~boostfd_file();
00055 offset_type size();
00056 void set_size(offset_type newsize);
00057 void lock();
00058 void serve(const request * req) throw (io_error);
00059 const char * io_type() const;
00060 };
00061
00063
00064 __STXXL_END_NAMESPACE
00065
00066 #endif // #if STXXL_HAVE_BOOSTFD_FILE
00067
00068 #endif // !STXXL_BOOSTFD_FILE_H_