Stxxl
1.4.0
|
00001 /*************************************************************************** 00002 * include/stxxl/bits/io/mem_file.h 00003 * 00004 * Part of the STXXL. See http://stxxl.sourceforge.net 00005 * 00006 * Copyright (C) 2008 Andreas Beckmann <beckmann@cs.uni-frankfurt.de> 00007 * Copyright (C) 2009 Johannes Singler <singler@ira.uka.de> 00008 * 00009 * Distributed under the Boost Software License, Version 1.0. 00010 * (See accompanying file LICENSE_1_0.txt or copy at 00011 * http://www.boost.org/LICENSE_1_0.txt) 00012 **************************************************************************/ 00013 00014 #ifndef STXXL_MEM_FILE_HEADER 00015 #define STXXL_MEM_FILE_HEADER 00016 00017 #include <stxxl/bits/io/disk_queued_file.h> 00018 #include <stxxl/bits/io/request.h> 00019 00020 00021 __STXXL_BEGIN_NAMESPACE 00022 00023 //! \addtogroup fileimpl 00024 //! \{ 00025 00026 //! \brief Implementation of file based on new[] and memcpy 00027 class mem_file : public disk_queued_file 00028 { 00029 char * ptr; 00030 offset_type sz; 00031 00032 public: 00033 //! \brief constructs file object 00034 //! \param disk disk(file) identifier 00035 mem_file( 00036 int queue_id = DEFAULT_QUEUE, int allocator_id = NO_ALLOCATOR) : disk_queued_file(queue_id, allocator_id), ptr(NULL), sz(0) 00037 { } 00038 void serve(const request * req) throw (io_error); 00039 ~mem_file(); 00040 offset_type size(); 00041 void set_size(offset_type newsize); 00042 void lock(); 00043 void discard(offset_type offset, offset_type size); 00044 const char * io_type() const; 00045 }; 00046 00047 //! \} 00048 00049 __STXXL_END_NAMESPACE 00050 00051 #endif // !STXXL_MEM_FILE_HEADER