Stxxl  1.4.0
include/stxxl/bits/io/mmap_file.h
Go to the documentation of this file.
00001 /***************************************************************************
00002  *  include/stxxl/bits/io/mmap_file.h
00003  *
00004  *  Part of the STXXL. See http://stxxl.sourceforge.net
00005  *
00006  *  Copyright (C) 2002 Roman Dementiev <dementiev@mpi-sb.mpg.de>
00007  *  Copyright (C) 2008 Andreas Beckmann <beckmann@cs.uni-frankfurt.de>
00008  *  Copyright (C) 2009 Johannes Singler <singler@ira.uka.de>
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_MMAP_FILE_HEADER
00016 #define STXXL_MMAP_FILE_HEADER
00017 
00018 #ifndef STXXL_HAVE_MMAP_FILE
00019 #ifdef STXXL_BOOST_CONFIG
00020  #include <boost/config.hpp>
00021 #endif
00022 
00023 #ifndef BOOST_MSVC
00024 // mmap call does not exist in Windows
00025  #define STXXL_HAVE_MMAP_FILE 1
00026 #else
00027  #define STXXL_HAVE_MMAP_FILE 0
00028 #endif
00029 #endif
00030 
00031 #if STXXL_HAVE_MMAP_FILE
00032 
00033 #include <sys/mman.h>
00034 
00035 #include <stxxl/bits/io/ufs_file_base.h>
00036 #include <stxxl/bits/io/disk_queued_file.h>
00037 
00038 
00039 __STXXL_BEGIN_NAMESPACE
00040 
00041 //! \weakgroup fileimpl File implementations
00042 //! \ingroup iolayer
00043 //! Implementations of \c stxxl::file and \c stxxl::request
00044 //! for various file access methods
00045 //! \{
00046 
00047 //! \brief Implementation of memory mapped access file
00048 class mmap_file : public ufs_file_base, public disk_queued_file
00049 {
00050 public:
00051     //! \brief constructs file object
00052     //! \param filename path of file
00053     //! \param mode open mode, see \c stxxl::file::open_modes
00054     //! \param disk disk(file) identifier
00055     inline mmap_file(const std::string & filename, int mode, int queue_id = DEFAULT_QUEUE, int allocator_id = NO_ALLOCATOR) :
00056         ufs_file_base(filename, mode), disk_queued_file(queue_id, allocator_id)
00057     { }
00058     void serve(const request * req) throw (io_error);
00059     const char * io_type() const;
00060 };
00061 
00062 //! \}
00063 
00064 __STXXL_END_NAMESPACE
00065 
00066 #endif  // #if STXXL_HAVE_MMAP_FILE
00067 
00068 #endif  // !STXXL_MMAP_FILE_HEADER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines