#include <File.h>
Public Member Functions | |
virtual void | abort (void) |
virtual void | attach (IOFD fd) |
virtual void | close (void) |
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 (void) | |
File (IOFD fd, bool autoclose=true) | |
File (const char *name, int flags=IOFlags::OpenRead, int perms=0666) | |
File (const std::string &name, int flags=IOFlags::OpenRead, int perms=0666) | |
virtual void | flush (void) |
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) |
virtual IOOffset | position (IOOffset offset, Relative whence=SET) |
virtual bool | prefetch (const IOPosBuffer *what, IOSize n) |
virtual IOSize | read (void *into, IOSize n) |
virtual IOSize | read (void *into, IOSize n, IOOffset pos) |
virtual IOSize | readv (IOBuffer *into, IOSize length) |
virtual void | resize (IOOffset size) |
virtual void | setAutoClose (bool closeit) |
virtual IOOffset | size (void) const |
virtual IOSize | write (const void *from, IOSize n) |
virtual IOSize | write (const void *from, IOSize n, IOOffset pos) |
virtual IOSize | writev (const IOBuffer *from, IOSize length) |
~File (void) | |
Public Member Functions inherited from IOChannel | |
virtual IOFD | fd (void) const |
virtual void | fd (IOFD value) |
IOChannel (IOFD fd=-1) | |
virtual bool | isBlocking (void) const |
virtual void | setBlocking (bool value) |
virtual | ~IOChannel (void) |
Public Member Functions inherited from IOInput | |
int | read (void) |
IOSize | read (IOBuffer into) |
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 (unsigned char byte) |
IOSize | write (IOBuffer from) |
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, IOOffset pos) |
virtual IOSize | readv (IOPosBuffer *into, IOSize buffers) |
virtual void | rewind (void) |
Storage (void) | |
IOSize | write (IOBuffer from, IOOffset pos) |
virtual IOSize | writev (const IOPosBuffer *from, IOSize buffers) |
virtual | ~Storage (void) |
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=0) |
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=0) |
|
private |
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 80 of file File.cc.
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 84 of file File.cc.
References flags.
File::~File | ( | void | ) |
|
private |
|
virtual |
Close the file and ignore all errors.
Reimplemented in RemoteFile.
Definition at line 293 of file File.cc.
References EDM_IOFD_INVALID, and ztee::fd.
Referenced by RemoteFile::abort().
|
virtual |
Close the file.
Reimplemented from IOChannel.
Reimplemented in RemoteFile.
Definition at line 277 of file File.cc.
References assert(), EDM_IOFD_INVALID, relativeConstraints::error, ztee::fd, and throwStorageError().
Referenced by RemoteFile::close(), LocalCacheFile::close(), lumiQTWidget.ApplicationWindow::fileQuit(), esMonitoring.AsyncLineReaderMixin::handle_close(), esMonitoring.FDJsonServer::handle_close(), Vispa.Gui.BoxContentDialog.BoxContentDialog::keyPressEvent(), and Vispa.Gui.FindDialog.FindDialog::keyPressEvent().
|
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 142 of file File.cc.
References 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 155 of file File.cc.
References 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 117 of file File.cc.
References cond::persistency::duplicate(), ztee::fd, and reco_application_tbsim_DetSim-Digi_cfg::File.
Internal implementation of duplicate() to actually duplicate the file handle into child.
Definition at line 126 of file File.cc.
References assert(), class-composition::child, EDM_IOFD_INVALID, IOChannel::fd(), ztee::fd, and m_flags.
|
virtual |
Flush the system's file system buffers for this file.
Reimplemented from Storage.
Definition at line 140 of file UnixFile.cc.
References 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 177 of file File.cc.
References assert(), EDM_IOFD_INVALID, ztee::fd, 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 169 of file File.cc.
References flags.
Return the current file pointer position.
Implements Storage.
Definition at line 113 of file UnixFile.cc.
References assert(), EDM_IOFD_INVALID, ztee::fd, query::result, and throwStorageError().
Referenced by LocalCacheFile::position(), LocalCacheFile::read(), and LocalCacheFile::readv().
|
virtual |
Prefetch data for the file.
Reimplemented from Storage.
Definition at line 210 of file File.cc.
References ztee::fd, i, info(), gen::n, IOPosBuffer::offset(), hltrates_dqm_sourceclient-live_cfg::offset, IOPosBuffer::size(), and findQualityFiles::size.
Referenced by LocalCacheFile::prefetch().
Read from the file.
Reimplemented from IOChannel.
Definition at line 231 of file File.cc.
References IOInput::read().
Referenced by LocalCacheFile::read().
Reimplemented from Storage.
Definition at line 64 of file UnixFile.cc.
References assert(), ztee::fd, edm::errors::FileReadError, alignCSCRings::s, and throwStorageError().
Read from the file.
Reimplemented from IOChannel.
Definition at line 236 of file File.cc.
References IOChannel::readv().
Referenced by LocalCacheFile::readv().
|
virtual |
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 130 of file UnixFile.cc.
References assert(), EDM_IOFD_INVALID, ztee::fd, and throwStorageError().
Referenced by Vispa.Gui.TextDialog.TextDialog::__init__(), Vispa.Plugins.ConfigEditor.ToolDialog.ToolDialog::__init__(), Vispa.Main.MainWindow.MainWindow::_loadIni(), LocalCacheFile::LocalCacheFile(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().
|
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.
Definition at line 103 of file File.cc.
|
virtual |
Get the size of the file.
Reimplemented from Storage.
Definition at line 100 of file UnixFile.cc.
References assert(), EDM_IOFD_INVALID, ztee::fd, and throwStorageError().
|
staticprivate |
Actually close a file handle and return error code.
Definition at line 155 of file UnixFile.cc.
References run_regression::ret.
Definition at line 10 of file UnixFile.cc.
References EDM_IOFD_INVALID, and throwStorageError().
|
staticprivate |
Definition at line 20 of file UnixFile.cc.
References edm::errors::FileOpenError, 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.
Reimplemented from IOChannel.
Definition at line 241 of file File.cc.
References IOFlags::OpenAppend, IOFlags::OpenUnbuffered, position, alignCSCRings::s, and IOChannel::write().
Reimplemented from Storage.
Definition at line 80 of file UnixFile.cc.
References assert(), ztee::fd, IOFlags::OpenUnbuffered, alignCSCRings::s, and throwStorageError().
Write to the file.
Reimplemented from IOChannel.
Definition at line 259 of file File.cc.
References IOFlags::OpenAppend, IOFlags::OpenUnbuffered, position, alignCSCRings::s, and IOChannel::writev().
|
private |
Definition at line 72 of file File.h.
Referenced by duplicate().