#include <File.h>
Public Member Functions | |
virtual void | abort (void) |
virtual void | attach (IOFD fd) |
void | close (void) override |
virtual void | create (const char *name, bool exclusive=false, int perms=0666) |
virtual void | create (const std::string &name, bool exclusive=false, int perms=0666) |
File (const char *name, int flags=IOFlags::OpenRead, int perms=0666) | |
File (const std::string &name, int flags=IOFlags::OpenRead, int perms=0666) | |
File (IOFD fd, bool autoclose=true) | |
File (void) | |
void | flush (void) override |
virtual void | open (const char *name, int flags=IOFlags::OpenRead, int perms=0666) |
virtual void | open (const std::string &name, int flags=IOFlags::OpenRead, int perms=0666) |
IOOffset | position (IOOffset offset, Relative whence=SET) override |
virtual IOOffset | position (IOOffset offset, Relative whence=SET)=0 |
virtual IOOffset | position (void) const |
bool | prefetch (const IOPosBuffer *what, IOSize n) override |
IOSize | read (IOBuffer into, IOOffset pos) |
IOSize | read (void *into, IOSize n) override |
virtual IOSize | read (void *into, IOSize n, IOOffset pos) |
IOSize | read (void *into, IOSize n, IOOffset pos) override |
IOSize | readv (IOBuffer *into, IOSize length) override |
virtual IOSize | readv (IOPosBuffer *into, IOSize buffers) |
void | resize (IOOffset size) override |
virtual void | setAutoClose (bool closeit) |
IOOffset | size (void) const override |
IOSize | write (const void *from, IOSize n) override |
virtual IOSize | write (const void *from, IOSize n, IOOffset pos) |
IOSize | write (const void *from, IOSize n, IOOffset pos) override |
IOSize | write (IOBuffer from, IOOffset pos) |
IOSize | writev (const IOBuffer *from, IOSize length) override |
virtual IOSize | writev (const IOPosBuffer *from, IOSize buffers) |
~File (void) override | |
Public Member Functions inherited from IOChannel | |
virtual void | fd (IOFD value) |
virtual IOFD | fd (void) const |
IOChannel (IOFD fd=-1) | |
virtual bool | isBlocking (void) const |
IOSize | read (IOBuffer into) |
IOSize | read (void *into, IOSize n) override |
virtual IOSize | read (void *into, IOSize n)=0 |
int | read (void) |
IOSize | readv (IOBuffer *into, IOSize buffers) override |
virtual void | setBlocking (bool value) |
IOSize | write (const void *from, IOSize n) override |
virtual IOSize | write (const void *from, IOSize n)=0 |
IOSize | write (IOBuffer from) |
IOSize | write (unsigned char byte) |
IOSize | writev (const IOBuffer *from, IOSize buffers) override |
~IOChannel (void) override | |
Public Member Functions inherited from IOInput | |
IOSize | read (IOBuffer into) |
int | read (void) |
IOSize | xread (IOBuffer into) |
IOSize | xread (void *into, IOSize n) |
IOSize | xreadv (IOBuffer *into, IOSize buffers) |
virtual | ~IOInput (void) |
Destruct the stream. A no-op. More... | |
Public Member Functions inherited from IOOutput | |
IOSize | write (IOBuffer from) |
IOSize | write (unsigned char byte) |
IOSize | xwrite (const void *from, IOSize n) |
IOSize | xwrite (IOBuffer from) |
IOSize | xwritev (const IOBuffer *from, IOSize buffers) |
virtual | ~IOOutput (void) |
Destruct the stream. A no-op. More... | |
Public Member Functions inherited from Storage | |
virtual bool | eof (void) const |
virtual IOOffset | position (void) const |
IOSize | read (IOBuffer into) |
IOSize | read (IOBuffer into, IOOffset pos) |
virtual IOSize | read (void *into, IOSize n)=0 |
int | read (void) |
virtual IOSize | readv (IOBuffer *into, IOSize buffers) |
virtual IOSize | readv (IOPosBuffer *into, IOSize buffers) |
virtual void | rewind (void) |
Storage (void) | |
virtual IOSize | write (const void *from, IOSize n)=0 |
IOSize | write (IOBuffer from) |
IOSize | write (IOBuffer from, IOOffset pos) |
IOSize | write (unsigned char byte) |
virtual IOSize | writev (const IOBuffer *from, IOSize buffers) |
virtual IOSize | writev (const IOPosBuffer *from, IOSize buffers) |
~Storage (void) override | |
Private Types | |
enum | { InternalAutoClose = 4096 } |
Private Member Functions | |
File * | duplicate (bool copy) const |
File * | duplicate (File *child) const |
File (IOFD fd, unsigned flags) | |
Static Private Member Functions | |
static bool | sysclose (IOFD fd, int *error=nullptr) |
static IOFD | sysduplicate (IOFD fd) |
static void | sysopen (const char *name, int flags, int perms, IOFD &newfd, unsigned &newflags) |
Private Attributes | |
unsigned | m_flags |
Additional Inherited Members | |
Public Types inherited from Storage | |
enum | Relative { SET, CURRENT, END } |
Protected Member Functions inherited from IOChannel | |
bool | sysclose (IOFD fd, int *error=nullptr) |
File::File | ( | void | ) |
Create a new file object without a file attached to it.
Definition at line 57 of file File.cc.
References EDM_IOFD_INVALID, and ztee::fd.
File::File | ( | IOFD | fd, |
bool | autoclose = true |
||
) |
File::File | ( | const char * | name, |
int | flags = IOFlags::OpenRead , |
||
int | perms = 0666 |
||
) |
Create a new file object by calling open() with the given arguments.
Definition at line 77 of file File.cc.
References HLT_FULL_cff::flags, and Skims_PA_cff::name.
File::File | ( | const std::string & | name, |
int | flags = IOFlags::OpenRead , |
||
int | perms = 0666 |
||
) |
Create a new file object by calling open() with the given arguments.
Definition at line 80 of file File.cc.
References HLT_FULL_cff::flags, and Skims_PA_cff::name.
|
override |
|
private |
|
virtual |
Close the file and ignore all errors.
Reimplemented in RemoteFile.
Definition at line 254 of file File.cc.
References EDM_IOFD_INVALID, and ztee::fd.
Referenced by RemoteFile::abort().
|
virtual |
|
overridevirtual |
Close the file.
Reimplemented from IOChannel.
Reimplemented in RemoteFile.
Definition at line 241 of file File.cc.
References cms::cuda::assert(), EDM_IOFD_INVALID, relativeConstraints::error, ztee::fd, and throwStorageError().
Referenced by RemoteFile::close(), esMonitoring.AsyncLineReaderMixin::handle_close(), and esMonitoring.FDJsonServer::handle_close().
|
virtual |
Create and open the file name in write mode. If exclusive, the creation fails if the file already exists, otherwise if the file exists, it will be truncated. The new file will have the permissions perms.
Definition at line 131 of file File.cc.
References generator_cfi::exclusive, Skims_PA_cff::name, IOFlags::OpenCreate, IOFlags::OpenExclusive, IOFlags::OpenTruncate, and IOFlags::OpenWrite.
|
virtual |
Create and open the file name in write mode. If exclusive, the creation fails if the file already exists, otherwise if the file exists, it will be truncated. The new file will have the permissions perms.
Definition at line 139 of file File.cc.
References generator_cfi::exclusive, Skims_PA_cff::name, IOFlags::OpenCreate, IOFlags::OpenExclusive, IOFlags::OpenTruncate, and IOFlags::OpenWrite.
|
private |
Duplicate the file object. If copy, also duplicates the underlying file descriptor, otherwise the two will point to the same descriptor. If the file descriptor is not copied, the copy will not close its file descriptor on destruction, the original object (this
) will.
Definition at line 110 of file File.cc.
References filterCSVwithJSON::copy, trackingPlots::dup, ztee::fd, and VtxSmearedBeamProfile_cfi::File.
Internal implementation of duplicate() to actually duplicate the file handle into child.
Definition at line 117 of file File.cc.
References cms::cuda::assert(), submitPVValidationJobs::child, EDM_IOFD_INVALID, and ztee::fd.
|
overridevirtual |
Flush the system's file system buffers for this file.
Reimplemented from Storage.
Definition at line 122 of file UnixFile.cc.
References cms::cuda::assert(), EDM_IOFD_INVALID, ztee::fd, and throwStorageError().
|
virtual |
Open or possibly create the file name with options specified in flags. If the file is to be created, it will be given the permissions perms. If this object already has a file open, it is closed first.
Definition at line 156 of file File.cc.
References cms::cuda::assert(), EDM_IOFD_INVALID, ztee::fd, HLT_FULL_cff::flags, Skims_PA_cff::name, IOFlags::OpenRead, and IOFlags::OpenWrite.
|
virtual |
Open or possibly create the file name with options specified in flags. If the file is to be created, it will be given the permissions perms. If this object already has a file open, it is closed first. Redirected to the overloaded method taking a "const char *" argument.
Definition at line 148 of file File.cc.
References HLT_FULL_cff::flags, and Skims_PA_cff::name.
Return the current file pointer position.
Implements Storage.
Definition at line 101 of file UnixFile.cc.
References cms::cuda::assert(), EDM_IOFD_INVALID, ztee::fd, hltrates_dqm_sourceclient-live_cfg::offset, mps_fire::result, L1DTConfigBti_cff::SET, and throwStorageError().
virtual IOOffset Storage::position |
IOOffset Storage::position |
Definition at line 72 of file Storage.cc.
|
overridevirtual |
Prefetch data for the file.
Reimplemented from Storage.
Definition at line 185 of file File.cc.
References ztee::fd, mps_fire::i, info(), dqmiodumpmetadata::n, IOPosBuffer::offset(), hltrates_dqm_sourceclient-live_cfg::offset, IOPosBuffer::size(), and findQualityFiles::size.
IOSize Storage::read |
Definition at line 10 of file Storage.cc.
Read from the file.
Implements IOInput.
Definition at line 203 of file File.cc.
References dqmiodumpmetadata::n, and IOInput::read().
IOSize Storage::read |
Definition at line 12 of file Storage.cc.
Reimplemented from Storage.
Definition at line 58 of file UnixFile.cc.
References cms::cuda::assert(), ztee::fd, edm::errors::FileReadError, dqmiodumpmetadata::n, alignCSCRings::s, and throwStorageError().
Read from the file.
Reimplemented from IOInput.
Definition at line 206 of file File.cc.
References IOChannel::readv().
IOSize Storage::readv |
Definition at line 24 of file Storage.cc.
|
overridevirtual |
Resize to the file to size. If size is less than the file's current size, the file is truncated. If size is larger than the file's current size, the file is extended with zero bytes. Does not change the current file pointer.
Implements Storage.
Definition at line 114 of file UnixFile.cc.
References cms::cuda::assert(), EDM_IOFD_INVALID, ztee::fd, findQualityFiles::size, and throwStorageError().
|
virtual |
Set the autoclose flag of the file. If autoclose is true
, the destructor will automatically try to close the underlying file descriptor. Otherwise the file descriptor will be left open. Set the flag off if the file descriptor is originally owned by someone else.
|
overridevirtual |
Get the size of the file.
Reimplemented from Storage.
Definition at line 90 of file UnixFile.cc.
References cms::cuda::assert(), EDM_IOFD_INVALID, ztee::fd, info(), hgcalPlots::stat, and throwStorageError().
Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().
|
staticprivate |
Actually close a file handle and return error code.
Definition at line 135 of file UnixFile.cc.
References relativeConstraints::error, ztee::fd, and runTheMatrix::ret.
Definition at line 9 of file UnixFile.cc.
References trackingPlots::dup, EDM_IOFD_INVALID, ztee::fd, and throwStorageError().
|
staticprivate |
Definition at line 17 of file UnixFile.cc.
References edm::errors::FileOpenError, HLT_FULL_cff::flags, Skims_PA_cff::name, O_NONBLOCK, IOFlags::OpenAppend, IOFlags::OpenCreate, IOFlags::OpenExclusive, IOFlags::OpenNonBlock, IOFlags::OpenNotCTTY, IOFlags::OpenRead, IOFlags::OpenTruncate, IOFlags::OpenUnbuffered, IOFlags::OpenWrite, and throwStorageError().
Write to the file.
Implements IOOutput.
Definition at line 209 of file File.cc.
References dqmiodumpmetadata::n, IOFlags::OpenAppend, IOFlags::OpenUnbuffered, position, alignCSCRings::s, and IOChannel::write().
IOSize Storage::write |
Definition at line 44 of file Storage.cc.
Reimplemented from Storage.
Definition at line 72 of file UnixFile.cc.
References cms::cuda::assert(), ztee::fd, edm::errors::FileWriteError, dqmiodumpmetadata::n, IOFlags::OpenUnbuffered, alignCSCRings::s, and throwStorageError().
IOSize Storage::write |
Definition at line 42 of file Storage.cc.
Write to the file.
Reimplemented from IOOutput.
Definition at line 225 of file File.cc.
References IOFlags::OpenAppend, IOFlags::OpenUnbuffered, position, alignCSCRings::s, and IOChannel::writev().
IOSize Storage::writev |