00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
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;
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_