From: Dejan L. <de...@us...> - 2004-04-19 21:56:20
|
Update of /cvsroot/rtk/rtk/rtk In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21683/rtk Added Files: Mmap.h Log Message: I thought Mmap.h was already in CVS. Sorry. :( --- NEW FILE: Mmap.h --- /** * * RTK * Fast and easy cross-platform GUI ToolKit. * * Copyright (C) 2001-200x RTK Development Team * * This library is free software; you can redistribute it and/or modify it * under the terms of the slightly modified (see the "EXCEPTION NOTICE" part * of RTK Library License) GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public License * and along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA . * * Also you should have received a copy of RTK Library License, if not please * write an e-mail to some of RTK authors (listed in file AUTHORS). * * Bug reports: bu...@rt... * Suggestions: rf...@rt... ***************************************************************************/ /** * $Source: /cvsroot/rtk/rtk/rtk/Mmap.h,v $ ***** * Authors (chronological order): * Dejan Lekic, de...@nu... (dejan§rtk.cx) * Contributors (chronological order): * $fname $lname, $email ***** * T0D0 List: * - ***************************************************************************/ #ifndef _RTK_MMAP_H_ #define _RTK_MMAP_H_ 1 #include <unistd.h> #include <sys/mman.h> #include <sys/types.h> #include <fcntl.h> #include <sys/stat.h> #include <string.h> #include <rtk/Export.h> #include <rtk/rtkdef.h> #include <rtk/String.h> namespace Rtk { /** Simple wrapper class around *map() and related functions. * Simple wrapper class around *map() and related functions. */ class RTK_API Mmap { public: // CONSTRUCTORS /** * Default constructor - note that You have to use SetFilename * when You use this constructor. */ Mmap(); /** * Another Mmap constructor, with filename and bc flag which * determines wheather file should be created or not. * @param fname String Name of file * @param bc bool Create flag TRUE or FALSE (default). */ Mmap::Mmap(const String& fname, bool bc = false); // DESTRUCTORS ~Mmap(); // SET METHODS bool SetFilename(const RCHAR *filename, bool create = false); void SetSize(uint size); void SetShared(int shared) { _shared = shared; } void SetProt(int prot) { _prot = prot; } // GET METHODS uint GetSize() const { return _len; } const RCHAR *GetFilename() const { return _filename; } // OTHER METHODS void Bzero(); void *Map(); private: RCHAR *_filename; /// Name of file to be memory-mapped uint _len; uint _file_size; int _shared; int _prot; int _fd; /// Mmap file's file descriptor void *_mmap_address; /// Addres where file is mapped bool _file_opened; /// Indicates wheather file is opened or not }; // Mmap }; // Rtk namespace #endif /** * $Id: Mmap.h,v 1.1 2004/04/19 21:56:05 dejan Exp $ ***************************************************************************/ |