Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
RRawFileUnix.hxx
Go to the documentation of this file.
1 // @(#)root/io:$Id$
2 // Author: Jakob Blomer
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_RRawFileUnix
13 #define ROOT_RRawFileUnix
14 
15 #include <ROOT/RRawFile.hxx>
16 #include <ROOT/RStringView.hxx>
17 
18 #include <cstddef>
19 #include <cstdint>
20 
21 namespace ROOT {
22 namespace Internal {
23 
24 /**
25  * \class RRawFileUnix RRawFileUnix.hxx
26  * \ingroup IO
27  *
28  * The RRawFileUnix class uses POSIX calls to read from a mounted file system. Thus the path name can refer,
29  * for instance, to a named pipe instead of a regular file.
30  */
31 class RRawFileUnix : public RRawFile {
32 private:
33  int fFileDes;
34 
35 protected:
36  void OpenImpl() final;
37  size_t ReadAtImpl(void *buffer, size_t nbytes, std::uint64_t offset) final;
38  std::uint64_t GetSizeImpl() final;
39  void *MapImpl(size_t nbytes, std::uint64_t offset, std::uint64_t &mapdOffset) final;
40  void UnmapImpl(void *region, size_t nbytes) final;
41 
42 public:
43  RRawFileUnix(std::string_view url, RRawFile::ROptions options);
44  ~RRawFileUnix();
45  std::unique_ptr<RRawFile> Clone() const final;
46  int GetFeatures() const final { return kFeatureHasSize | kFeatureHasMmap; }
47 };
48 
49 } // namespace Internal
50 } // namespace ROOT
51 
52 #endif