diff -r 31a43d94cc26 -r 6cbad782d16a include/MemoryMap.h --- a/include/MemoryMap.h Sun Sep 20 15:14:12 2009 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,53 +0,0 @@ -/* - * MemoryMap.h - * Ottoman - * - * Created by Jens Alfke on 9/17/09. - * Copyright 2009 Jens Alfke. All rights reserved. - * BSD-Licensed: See the file "LICENSE.txt" for details. - */ - -#include "File.h" - -namespace Mooseyard { - - /** A flexible memory-map on a file, which can handle multiple discontiguous mapped regions. - Clients usually access this functionality through File, which delegates to it. */ - class MemoryMap { - public: - MemoryMap (File* file) :_file(file), _nRegions(0), _regions(NULL) { } - ~MemoryMap(); - - void mapRegion (off_t position, size_t length); - const void* mappedPosition (off_t position) const; - - private: - UNCOPYABLE(MemoryMap); - class Region; - const void* _at (off_t) const; - - File *_file; - int _nRegions; - Region **_regions; - }; - - - class MemoryMap::Region { - public: - Region (File*, off_t position, size_t length); - ~Region(); - off_t position() const {return _position;} - size_t length() const {return _length;} - off_t end() const {return _position + _length;} - bool setLength (size_t); // Returns false if it failed - const void* mappedPosition(off_t); - private: - UNCOPYABLE(Region); - File* const _file; - const off_t _position; - size_t _length; - const uint8_t *_start; - }; - - -}