The RRawFileUnix class uses POSIX calls to read from a mounted file system.
Thus the path name can refer, for instance, to a named pipe instead of a regular file.
Definition at line 31 of file RRawFileUnix.hxx.
Public Member Functions | |
RRawFileUnix (std::string_view url, RRawFile::ROptions options) | |
~RRawFileUnix () | |
std::unique_ptr< RRawFile > | Clone () const final |
Create a new RawFile that accesses the same resource. The file pointer is reset to zero. More... | |
int | GetFeatures () const final |
Derived classes shall inform the user about the supported functionality, which can possibly depend on the file at hand. More... | |
Public Member Functions inherited from ROOT::Internal::RRawFile | |
RRawFile (const RRawFile &)=delete | |
RRawFile (std::string_view url, ROptions options) | |
virtual | ~RRawFile () |
virtual std::unique_ptr< RRawFile > | Clone () const =0 |
Create a new RawFile that accesses the same resource. The file pointer is reset to zero. More... | |
virtual int | GetFeatures () const =0 |
Derived classes shall inform the user about the supported functionality, which can possibly depend on the file at hand. More... | |
std::uint64_t | GetSize () |
Returns the size of the file. More... | |
void * | Map (size_t nbytes, std::uint64_t offset, std::uint64_t &mapdOffset) |
Memory mapping according to POSIX standard; in particular, new mappings of the same range replace older ones. More... | |
RRawFile & | operator= (const RRawFile &)=delete |
size_t | Read (void *buffer, size_t nbytes) |
Read from fFilePos offset. Returns the actual number of bytes read. More... | |
size_t | ReadAt (void *buffer, size_t nbytes, std::uint64_t offset) |
Buffered read from a random position. More... | |
bool | Readln (std::string &line) |
Read the next line starting from the current value of fFilePos. Returns false if the end of the file is reached. More... | |
void | Seek (std::uint64_t offset) |
Change the cursor fFilePos. More... | |
void | Unmap (void *region, size_t nbytes) |
Receives a pointer returned by Map() and should have nbytes set to the full length of the mapping. More... | |
Protected Member Functions | |
std::uint64_t | GetSizeImpl () final |
Derived classes should return the file size or kUnknownFileSize. More... | |
void * | MapImpl (size_t nbytes, std::uint64_t offset, std::uint64_t &mapdOffset) final |
If a derived class supports mmap, the MapImpl and UnmapImpl calls are supposed to be implemented, too The default implementation throws an error. More... | |
void | OpenImpl () final |
OpenImpl() is called at most once and before any call to either DoReadAt or DoGetSize. More... | |
size_t | ReadAtImpl (void *buffer, size_t nbytes, std::uint64_t offset) final |
Derived classes should implement low-level reading without buffering. More... | |
void | UnmapImpl (void *region, size_t nbytes) final |
Derived classes with mmap support must be able to unmap the memory area handed out by Map() More... | |
virtual std::uint64_t | GetSizeImpl ()=0 |
Derived classes should return the file size or kUnknownFileSize. More... | |
virtual void * | MapImpl (size_t nbytes, std::uint64_t offset, std::uint64_t &mapdOffset) |
If a derived class supports mmap, the MapImpl and UnmapImpl calls are supposed to be implemented, too The default implementation throws an error. More... | |
virtual void | OpenImpl ()=0 |
OpenImpl() is called at most once and before any call to either DoReadAt or DoGetSize. More... | |
virtual size_t | ReadAtImpl (void *buffer, size_t nbytes, std::uint64_t offset)=0 |
Derived classes should implement low-level reading without buffering. More... | |
virtual void | UnmapImpl (void *region, size_t nbytes) |
Derived classes with mmap support must be able to unmap the memory area handed out by Map() More... | |
Private Attributes | |
int | fFileDes |
Additional Inherited Members | |
Public Types inherited from ROOT::Internal::RRawFile | |
enum class | ELineBreaks { kAuto , kSystem , kUnix , kWindows } |
kAuto detects the line break from the first line, kSystem picks the system's default More... | |
Static Public Member Functions inherited from ROOT::Internal::RRawFile | |
static std::unique_ptr< RRawFile > | Create (std::string_view url, ROptions options=ROptions()) |
Factory method that returns a suitable concrete implementation according to the transport in the url. More... | |
static std::string | GetLocation (std::string_view url) |
Returns only the file location, e.g. "server/file" for http://server/file. More... | |
static std::string | GetTransport (std::string_view url) |
Returns only the transport protocol in lower case, e.g. "http" for HTTP://server/file. More... | |
Static Public Attributes inherited from ROOT::Internal::RRawFile | |
static constexpr int | kFeatureHasMmap = 0x02 |
Map() and Unmap() are implemented. More... | |
static constexpr int | kFeatureHasSize = 0x01 |
GetSize() does not return kUnknownFileSize. More... | |
static constexpr std::uint64_t | kUnknownFileSize = std::uint64_t(-1) |
Derived classes do not necessarily need to provide file size information but they can return "not known" instead. More... | |
Protected Attributes inherited from ROOT::Internal::RRawFile | |
std::uint64_t | fFilePos |
The current position in the file, which can be changed by Seek, Read, and Readln. More... | |
ROptions | fOptions |
std::string | fUrl |
#include <ROOT/RRawFileUnix.hxx>
ROOT::Internal::RRawFileUnix::RRawFileUnix | ( | std::string_view | url, |
RRawFile::ROptions | options | ||
) |
Definition at line 32 of file RRawFileUnix.cxx.
ROOT::Internal::RRawFileUnix::~RRawFileUnix | ( | ) |
Definition at line 37 of file RRawFileUnix.cxx.
|
finalvirtual |
Create a new RawFile that accesses the same resource. The file pointer is reset to zero.
Implements ROOT::Internal::RRawFile.
Definition at line 43 of file RRawFileUnix.cxx.
|
inlinefinalvirtual |
Derived classes shall inform the user about the supported functionality, which can possibly depend on the file at hand.
Implements ROOT::Internal::RRawFile.
Definition at line 46 of file RRawFileUnix.hxx.
|
finalprotectedvirtual |
Derived classes should return the file size or kUnknownFileSize.
Implements ROOT::Internal::RRawFile.
Definition at line 48 of file RRawFileUnix.cxx.
|
finalprotectedvirtual |
If a derived class supports mmap, the MapImpl and UnmapImpl calls are supposed to be implemented, too The default implementation throws an error.
Reimplemented from ROOT::Internal::RRawFile.
Definition at line 57 of file RRawFileUnix.cxx.
|
finalprotectedvirtual |
OpenImpl() is called at most once and before any call to either DoReadAt or DoGetSize.
If fOptions.fBlocksize is negative, derived classes are responsible to set a sensible value. After a call to OpenImpl(), fOptions.fBlocksize must be larger or equal to zero.
Implements ROOT::Internal::RRawFile.
Definition at line 69 of file RRawFileUnix.cxx.
|
finalprotectedvirtual |
Derived classes should implement low-level reading without buffering.
Short reads indicate the end of the file, therefore derived classes should return nbytes bytes if available.
Implements ROOT::Internal::RRawFile.
Definition at line 91 of file RRawFileUnix.cxx.
Derived classes with mmap support must be able to unmap the memory area handed out by Map()
Reimplemented from ROOT::Internal::RRawFile.
Definition at line 112 of file RRawFileUnix.cxx.
|
private |
Definition at line 33 of file RRawFileUnix.hxx.