Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
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 <string_view>
17
18#include <cstddef>
19#include <cstdint>
20
21namespace ROOT {
22namespace Internal {
23
24/**
25 * \class RRawFileUnix RRawFileUnix.hxx
26 * \ingroup io_files
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 */
31class RRawFileUnix : public RRawFile {
32private:
33 int fFileDes = -1;
34
35protected:
36 void OpenImpl() final;
37 size_t ReadAtImpl(void *buffer, size_t nbytes, std::uint64_t offset) final;
38 void ReadVImpl(RIOVec *ioVec, unsigned int nReq) final;
39 std::uint64_t GetSizeImpl() final;
40 void SetDiscourageReadAheadImpl(bool value) final;
41
42public:
43 RRawFileUnix(std::string_view url, RRawFile::ROptions options);
44 ~RRawFileUnix() override;
45 std::unique_ptr<RRawFile> Clone() const final;
46 int GetFd() const { return fFileDes; }
47};
48
49} // namespace Internal
50} // namespace ROOT
51
52#endif
std::unique_ptr< RRawFile > Clone() const final
Create a new RawFile that accesses the same resource. The file pointer is reset to zero.
RRawFileUnix(std::string_view url, RRawFile::ROptions options)
std::uint64_t GetSizeImpl() final
Derived classes should return the file size.
void ReadVImpl(RIOVec *ioVec, unsigned int nReq) final
By default implemented as a loop of ReadAt calls but can be overwritten, e.g. XRootD or DAVIX impleme...
void SetDiscourageReadAheadImpl(bool value) final
void OpenImpl() final
OpenImpl() is called at most once and before any call to either DoReadAt or DoGetSize.
size_t ReadAtImpl(void *buffer, size_t nbytes, std::uint64_t offset) final
Derived classes should implement low-level reading without buffering.
RRawFile(std::string_view url, ROptions options)
Definition RRawFile.cxx:61
STL class.
STL class.
Used for vector reads from multiple offsets into multiple buffers.
Definition RRawFile.hxx:61
On construction, an ROptions parameter can customize the RRawFile behavior.
Definition RRawFile.hxx:49