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 54 of file FileIOClient.h.

Public Member Functions

 FileIOClient ()
 Basic constructor, leaves both path and fd unset.
virtual ~FileIOClient ()
int copy_contents (size_t len, FileIOClient *dest)
 Copy len bytes of file contents from the current offset to another open file.
void set_path (const char *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 46 of file FileIOClient.cc.

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

Definition at line 52 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 60 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 69 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 78 of file FileIOClient.cc.

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

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

int oasys::FileIOClient::unlink (  ) 

System call wrappers.

Definition at line 96 of file FileIOClient.cc.

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

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

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

System call wrappers.

Definition at line 109 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 116 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 123 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 138 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 145 of file FileIOClient.cc.

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

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

Copy len bytes of file contents from the current offset to another open file.

Return the amount copied or -1 if error

Definition at line 152 of file FileIOClient.cc.

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

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

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

Set the path associated with this file handle.

Definition at line 78 of file FileIOClient.h.

References path_.

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

Reopen a previously opened path.

Definition at line 87 of file FileIOClient.cc.

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

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

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

Check if the file descriptor is open.

Definition at line 86 of file FileIOClient.h.

References oasys::FdIOClient::fd_.

Referenced by dtn::BundlePayload::append_data(), dtn::BundlePayload::close_file(), dtn::BundlePayload::internal_write(), dtn::BundlePayload::is_file_open(), dtn::BundlePayload::reopen_file(), and dtn::BundlePayload::write_data().

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

Path accessor.

Definition at line 89 of file FileIOClient.h.

References path_.

Referenced by dtn::APIClient::handle_recv(), dtn::BundlePayload::reopen_file(), and dtn::BundlePayload::write_data().

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

Path accessor.

Definition at line 92 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 96 of file FileIOClient.h.

Referenced by close(), 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 Fri Dec 22 14:48:06 2006 for DTN Reference Implementation by  doxygen 1.5.1