Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXMappedFile.h
1 /********************************************************************************
2 * *
3 * M a p p e d F i l e C l a s s *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2023 by Jeroen van der Zijp. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXMAPPEDFILE_H
22 #define FXMAPPEDFILE_H
23 
24 #ifndef FXFILE_H
25 #include "FXFile.h"
26 #endif
27 
29 
30 namespace FX {
31 
32 
36 class FXAPI FXMappedFile : public FXIODevice {
37 private:
38  FXInputHandle memhandle; // Handle for the map
39  FXptr mempointer; // Memory base where it is mapped
40  FXlong memlength; // Length of the map
41  FXlong memoffset; // Offset of the map
42 private:
43  FXMappedFile(const FXMappedFile&);
44  FXMappedFile &operator=(const FXMappedFile&);
45 public:
46 
48  FXMappedFile();
49 
51  FXptr open(const FXString& filename,FXuint m=FXIO::Reading,FXuint perm=FXIO::AllReadWrite,FXlong len=0,FXlong off=0);
52 
54  virtual FXbool isSerial() const;
55 
57  FXptr data() const { return mempointer; }
58 
60  FXival length() const { return (FXival)memlength; }
61 
63  FXlong offset() const { return memoffset; }
64 
66  virtual FXlong size();
67 
69  virtual FXbool flush();
70 
72  virtual FXbool close();
73 
75  static FXival granularity();
76 
78  virtual ~FXMappedFile();
79  };
80 
81 }
82 
83 #endif
Execute permission for all.
Definition: FXIO.h:92
FXptr data() const
Return pointer to memory area.
Definition: FXMappedFile.h:57
Memory mapped file.
Definition: FXMappedFile.h:36
Child process can inherit handle.
Definition: FXIO.h:53
FXival length() const
Obtain length of the map.
Definition: FXMappedFile.h:60
Definition: FX4Splitter.h:28
FXIODevice manipulates a handle to operating system i/o device, such as pipes, sockets, or files.
Definition: FXIODevice.h:35
FXlong offset() const
Obtain offset of the map.
Definition: FXMappedFile.h:63
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42

Copyright © 1997-2022 Jeroen van der Zijp