oasys::FileIOClient Class Reference

#include <FileIOClient.h>

Inheritance diagram for oasys::FileIOClient:

oasys::FdIOClient oasys::IOClient oasys::Logger oasys::IOHandlerBase List of all members.

Detailed Description

IOClient derivative for real files -- not sockets.

Unlike the base class FdIOClient, FileIOClient contains the path as a member variable and exposes file specific system calls, i.e. open(), lseek(), etc.

Definition at line 33 of file FileIOClient.h.

Public Member Functions

 FileIOClient ()
 Basic constructor, leaves both path and fd unset.
virtual ~FileIOClient ()
int copy_contents (FileIOClient *dest, size_t len=0)
 Copy the contents of the current file to the given destination file.
void set_path (const std::string &path)
 Set the path associated with this file handle.
int reopen (int flags)
 Reopen a previously opened path.
bool is_open ()
 Check if the file descriptor is open.
const char * path ()
 Path accessor.
size_t path_len ()
 Path accessor.
int open (const char *path, int flags, int *errnop=0)
 System call wrappers.
int open (const char *path, int flags, mode_t mode, int *errnop=0)
 System call wrappers.
int close ()
 System call wrappers.
int unlink ()
 System call wrappers.
int lseek (off_t offset, int whence)
 System call wrappers.
int truncate (off_t length)
 System call wrappers.
int mkstemp (char *temp)
 System call wrappers.
int stat (struct stat *buf)
 System call wrappers.
int lstat (struct stat *buf)
 System call wrappers.

Protected Attributes

std::string path_
 Path to the file.


Constructor & Destructor Documentation

oasys::FileIOClient::FileIOClient (  ) 

Basic constructor, leaves both path and fd unset.

Definition at line 25 of file FileIOClient.cc.

oasys::FileIOClient::~FileIOClient (  )  [virtual]

Definition at line 31 of file FileIOClient.cc.

References close(), and oasys::FdIOClient::fd_.


Member Function Documentation

int oasys::FileIOClient::open ( const char *  path,
int  flags,
int *  errnop = 0 
)

System call wrappers.

Definition at line 39 of file FileIOClient.cc.

References oasys::FdIOClient::fd_, oasys::Logger::logpath_, oasys::IO::open(), and path_.

Referenced by dtn::BundlePayload::init(), and dtn::BundlePayload::init_from_store().

int oasys::FileIOClient::open ( const char *  path,
int  flags,
mode_t  mode,
int *  errnop = 0 
)

System call wrappers.

Definition at line 48 of file FileIOClient.cc.

References oasys::FdIOClient::fd_, oasys::Logger::logpath_, oasys::IO::open(), and path_.

int oasys::FileIOClient::close (  ) 

System call wrappers.

Definition at line 57 of file FileIOClient.cc.

References oasys::IO::close(), oasys::FdIOClient::fd_, oasys::Logger::logpath_, and path_.

Referenced by dtn::APIClient::handle_recv(), and ~FileIOClient().

int oasys::FileIOClient::unlink (  ) 

System call wrappers.

Definition at line 75 of file FileIOClient.cc.

References oasys::Logger::logpath_, path_, and oasys::IO::unlink().

Referenced by dtn::BundlePayload::replace_with_file(), and dtn::BundlePayload::~BundlePayload().

int oasys::FileIOClient::lseek ( off_t  offset,
int  whence 
)

System call wrappers.

Definition at line 88 of file FileIOClient.cc.

References oasys::FdIOClient::fd_, oasys::Logger::logpath_, and oasys::IO::lseek().

Referenced by dtn::BundlePayload::append_data(), dtn::BundlePayload::copy_file(), dtn::BundlePayload::internal_write(), and dtn::BundlePayload::read_data().

int oasys::FileIOClient::truncate ( off_t  length  ) 

System call wrappers.

Definition at line 95 of file FileIOClient.cc.

References oasys::FdIOClient::fd_, oasys::Logger::logpath_, and oasys::IO::truncate().

Referenced by dtn::BundlePayload::truncate().

int oasys::FileIOClient::mkstemp ( char *  temp  ) 

System call wrappers.

Definition at line 102 of file FileIOClient.cc.

References oasys::FdIOClient::fd_, log_err, oasys::Logger::logpath_, oasys::IO::mkstemp(), and path_.

Referenced by dtn::APIClient::handle_recv().

int oasys::FileIOClient::stat ( struct stat *  buf  ) 

System call wrappers.

Definition at line 117 of file FileIOClient.cc.

References oasys::Logger::logpath_, path_, and oasys::IO::stat().

int oasys::FileIOClient::lstat ( struct stat *  buf  ) 

System call wrappers.

Definition at line 124 of file FileIOClient.cc.

References oasys::Logger::logpath_, oasys::IO::lstat(), and path_.

int oasys::FileIOClient::copy_contents ( FileIOClient dest,
size_t  len = 0 
)

Copy the contents of the current file to the given destination file.

If len is non-zero, copy at most that many bytes, otherwise copy the whole file.

Definition at line 131 of file FileIOClient.cc.

References errno, log_err, path_, oasys::FdIOClient::read(), and oasys::FdIOClient::writeall().

Referenced by dtn::BundlePayload::copy_file().

void oasys::FileIOClient::set_path ( const std::string &  path  )  [inline]

Set the path associated with this file handle.

Definition at line 58 of file FileIOClient.h.

References path_.

Referenced by dtn::BundlePayload::replace_with_file().

int oasys::FileIOClient::reopen ( int  flags  ) 

Reopen a previously opened path.

Definition at line 66 of file FileIOClient.cc.

References ASSERT, oasys::FdIOClient::fd_, oasys::Logger::logpath_, oasys::IO::open(), and path_.

Referenced by dtn::BundlePayload::pin_file().

bool oasys::FileIOClient::is_open (  )  [inline]

Check if the file descriptor is open.

Definition at line 66 of file FileIOClient.h.

References oasys::FdIOClient::fd_.

Referenced by dtn::BundlePayload::internal_write(), and dtn::BundlePayload::~BundlePayload().

const char* oasys::FileIOClient::path (  )  [inline]

Path accessor.

Definition at line 69 of file FileIOClient.h.

References path_.

Referenced by dtn::APIClient::handle_recv(), dtn::BundlePayload::init(), dtn::BundlePayload::init_from_store(), dtn::BundlePayload::pin_file(), dtn::BundlePayload::replace_with_file(), dtn::BundlePayload::unpin_file(), dtn::BundlePayload::write_data(), and dtn::BundlePayload::~BundlePayload().

size_t oasys::FileIOClient::path_len (  )  [inline]

Path accessor.

Definition at line 72 of file FileIOClient.h.

References path_.

Referenced by dtn::APIClient::handle_recv().


Member Data Documentation

std::string oasys::FileIOClient::path_ [protected]

Path to the file.

Definition at line 76 of file FileIOClient.h.

Referenced by close(), copy_contents(), lstat(), mkstemp(), open(), path(), path_len(), reopen(), set_path(), stat(), and unlink().


The documentation for this class was generated from the following files:
Generated on Thu Jun 7 16:57:00 2007 for DTN Reference Implementation by  doxygen 1.5.1