CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
XrdFile Class Reference

#include <XrdFile.h>

Inheritance diagram for XrdFile:
Storage IOInput IOOutput

Public Member Functions

virtual void abort (void)
 
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)
 
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 n)
 
virtual IOSize readv (IOPosBuffer *into, IOSize n)
 
virtual void resize (IOOffset size)
 
virtual IOSize write (const void *from, IOSize n)
 
virtual IOSize write (const void *from, IOSize n, IOOffset pos)
 
 XrdFile (void)
 
 XrdFile (IOFD fd)
 
 XrdFile (const char *name, int flags=IOFlags::OpenRead, int perms=0666)
 
 XrdFile (const std::string &name, int flags=IOFlags::OpenRead, int perms=0666)
 
 ~XrdFile (void)
 
- Public Member Functions inherited from Storage
virtual bool eof (void) const
 
virtual void flush (void)
 
virtual IOOffset position (void) const
 
IOSize read (IOBuffer into, IOOffset pos)
 
virtual void rewind (void)
 
virtual IOOffset size (void) const
 
 Storage (void)
 
IOSize write (IOBuffer from, IOOffset pos)
 
virtual IOSize writev (const IOPosBuffer *from, IOSize buffers)
 
virtual ~Storage (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)
 
virtual IOSize writev (const IOBuffer *from, IOSize buffers)
 
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...
 

Private Member Functions

void addConnection (cms::Exception &)
 
std::shared_ptr< XrdCl::File > getActiveFile ()
 

Private Attributes

bool m_close
 
std::string m_name
 
IOOffset m_offset
 
std::atomic< unsigned int > m_op_count
 
edm::propagate_const
< std::shared_ptr
< XrdAdaptor::RequestManager > > 
m_requestmanager
 
IOOffset m_size
 

Additional Inherited Members

- Public Types inherited from Storage
enum  Relative { SET, CURRENT, END }
 

Detailed Description

Definition at line 17 of file XrdFile.h.

Constructor & Destructor Documentation

XrdFile::XrdFile ( void  )

Definition at line 20 of file XrdFile.cc.

XrdFile::XrdFile ( IOFD  fd)
XrdFile::XrdFile ( const char *  name,
int  flags = IOFlags::OpenRead,
int  perms = 0666 
)

Definition at line 29 of file XrdFile.cc.

XrdFile::XrdFile ( const std::string &  name,
int  flags = IOFlags::OpenRead,
int  perms = 0666 
)

Definition at line 41 of file XrdFile.cc.

XrdFile::~XrdFile ( void  )

Definition at line 53 of file XrdFile.cc.

Member Function Documentation

void XrdFile::abort ( void  )
virtual

Definition at line 214 of file XrdFile.cc.

void XrdFile::addConnection ( cms::Exception ex)
private

Definition at line 564 of file XrdFile.cc.

void XrdFile::close ( void  )
virtual
void XrdFile::create ( const char *  name,
bool  exclusive = false,
int  perms = 0666 
)
virtual

Definition at line 63 of file XrdFile.cc.

void XrdFile::create ( const std::string &  name,
bool  exclusive = false,
int  perms = 0666 
)
virtual

Definition at line 74 of file XrdFile.cc.

std::shared_ptr< XrdCl::File > XrdFile::getActiveFile ( void  )
private

Returns a file handle from one of the active sources. Verifies the file is open and throws an exception as necessary.

Definition at line 549 of file XrdFile.cc.

void XrdFile::open ( const char *  name,
int  flags = IOFlags::OpenRead,
int  perms = 0666 
)
virtual

Definition at line 91 of file XrdFile.cc.

void XrdFile::open ( const std::string &  name,
int  flags = IOFlags::OpenRead,
int  perms = 0666 
)
virtual

Definition at line 85 of file XrdFile.cc.

IOOffset XrdFile::position ( IOOffset  offset,
Relative  whence = SET 
)
virtual

Implements Storage.

Definition at line 496 of file XrdFile.cc.

bool XrdFile::prefetch ( const IOPosBuffer what,
IOSize  n 
)
virtual

Reimplemented from Storage.

Definition at line 485 of file XrdFile.cc.

IOSize XrdFile::read ( void *  into,
IOSize  n 
)
virtual

Read into into at most n number of bytes.

If this is a blocking stream, the call will block until some data can be read, end of input is reached, or an exception is thrown. For a non-blocking stream the available input is returned. If none is available, an exception is thrown.

Returns
The number of bytes actually read. This is less or equal to the size of the buffer. Zero indicates that the end of the input has been reached: end of file, or remote end closing for a connected channel like a pipe or a socket. Otherwise the value can be less than requested if limited amount of input is currently available for platform or implementation reasons.
Exceptions
Incase of error, a #IOError exception is thrown. This includes the situation where the input stream is in non-blocking mode and no input is currently available (FIXME: make this simpler; clarify which exception).

Implements IOInput.

Definition at line 224 of file XrdFile.cc.

IOSize XrdFile::read ( void *  into,
IOSize  n,
IOOffset  pos 
)
virtual

Reimplemented from Storage.

Definition at line 241 of file XrdFile.cc.

IOSize XrdFile::readv ( IOBuffer into,
IOSize  buffers 
)
virtual

Read from the input stream into multiple scattered buffers. There are buffers to fill in an array starting at into; the memory those buffers occupy does not need to be contiguous. The buffers are filled in the order given, eac buffer is filled fully before the subsequent buffers.

If this is a blocking stream, the call will block until some data can be read, end of input is reached, or an exception is thrown. For a non-blocking stream the available input is returned. If none is available, an exception is thrown.

The base class implementation uses read(void *, IOSize) method, but derived classes may implement a more efficient alternative.

Returns
The number of bytes actually read. This is less or equal to the size of the buffer. Zero indicates that the end of the input has been reached: end of file, or remote end closing for a connected channel like a pipe or a socket. Otherwise the value can be less than requested if limited amount of input is currently available for platform or implementation reasons. Note that the return value indicates the number of bytes read, not the number of buffers; it is the sum total of bytes filled into all the buffers.
Exceptions
Incase of error, a #IOError exception is thrown. However if some data has already been read, the error is swallowed and the method returns the data read so far. It is assumed that persistent errors will occur anyway on the next read and sporadic errors like stream becoming unvailable can be ignored. Use xread() if a different policy is desirable.

Reimplemented from IOInput.

Definition at line 259 of file XrdFile.cc.

IOSize XrdFile::readv ( IOPosBuffer into,
IOSize  n 
)
virtual

Reimplemented from Storage.

Definition at line 277 of file XrdFile.cc.

void XrdFile::resize ( IOOffset  size)
virtual

Implements Storage.

Definition at line 539 of file XrdFile.cc.

Referenced by Vispa.Gui.TextDialog.TextDialog::__init__().

IOSize XrdFile::write ( const void *  from,
IOSize  n 
)
virtual

Write n bytes of data starting at address from.

Returns
The number of bytes written. Normally this will be n, but can be less, even zero, for example if the stream is non-blocking mode and cannot accept input at this time.
Exceptions
Incase of error, an exception is thrown. However if the stream is in non-blocking mode and cannot accept output, it will not throw an exception – the return value will be less than requested.

Implements IOOutput.

Definition at line 424 of file XrdFile.cc.

IOSize XrdFile::write ( const void *  from,
IOSize  n,
IOOffset  pos 
)
virtual

Reimplemented from Storage.

Definition at line 455 of file XrdFile.cc.

Member Data Documentation

bool XrdFile::m_close
private

Definition at line 71 of file XrdFile.h.

std::string XrdFile::m_name
private

Definition at line 72 of file XrdFile.h.

IOOffset XrdFile::m_offset
private

Definition at line 69 of file XrdFile.h.

std::atomic<unsigned int> XrdFile::m_op_count
private

Definition at line 73 of file XrdFile.h.

edm::propagate_const<std::shared_ptr<XrdAdaptor::RequestManager> > XrdFile::m_requestmanager
private

Definition at line 68 of file XrdFile.h.

IOOffset XrdFile::m_size
private

Definition at line 70 of file XrdFile.h.