OpenDDS::FileSystemStorage::File Class Reference

#include <FileSystemStorage.h>

Inheritance diagram for OpenDDS::FileSystemStorage::File:
Inheritance graph
[legend]
Collaboration diagram for OpenDDS::FileSystemStorage::File:
Collaboration graph
[legend]

List of all members.

Public Types

typedef RcHandle< FilePtr

Public Member Functions

bool write (std::ofstream &stream)
bool read (std::ifstream &stream)
bool remove ()
OPENDDS_STRING name () const
Directory::Ptr parent () const

Private Member Functions

 File (const ACE_TString &fname_phys, const ACE_TString &logical, const Directory::Ptr &parent)

Private Attributes

ACE_TString physical_file_
ACE_TString physical_dir_
ACE_TString logical_relative_
Directory::Ptr parent_

Friends

class Directory
class Directory::Iterator
template<typename T , typename U0 , typename U1 , typename U2 >
OpenDDS::DCPS::RcHandle< T > OpenDDS::DCPS::make_rch (const U0 &, const U1 &, const U2 &)

Detailed Description

Definition at line 222 of file FileSystemStorage.h.


Member Typedef Documentation

Definition at line 224 of file FileSystemStorage.h.


Constructor & Destructor Documentation

OpenDDS::FileSystemStorage::File::File ( const ACE_TString fname_phys,
const ACE_TString logical,
const Directory::Ptr parent 
) [private]

Definition at line 458 of file FileSystemStorage.cpp.

References ACE_TEXT(), ACE_String_Base< ACE_CHAR_T >::c_str(), ACE_String_Base_Const::npos, physical_dir_, physical_file_, ACE_String_Base< ACE_CHAR_T >::rfind(), and ACE_String_Base< ACE_CHAR_T >::set().

00460   : physical_file_()
00461   , physical_dir_()
00462   , logical_relative_(logical)
00463   , parent_(parent)
00464 {
00465   String_Index_t last_slash = fname_phys.rfind(ACE_TEXT('/'));
00466 
00467   if (last_slash == ACE_TString::npos) {
00468     physical_file_ = fname_phys;
00469     physical_dir_ = ACE_TEXT(".");
00470 
00471   } else {
00472     physical_file_ = fname_phys.c_str() + last_slash + 1;
00473     physical_dir_.set(fname_phys.c_str(), last_slash, true);
00474   }
00475 }

Here is the call graph for this function:


Member Function Documentation

OPENDDS_STRING OpenDDS::FileSystemStorage::File::name ( void   )  const

Definition at line 509 of file FileSystemStorage.cpp.

References ACE_TEXT_ALWAYS_CHAR, ACE_String_Base< ACE_CHAR_T >::c_str(), and logical_relative_.

00510 {
00511   return ACE_TEXT_ALWAYS_CHAR(logical_relative_.c_str());
00512 }

Here is the call graph for this function:

Directory::Ptr OpenDDS::FileSystemStorage::File::parent ( void   )  const [inline]

Definition at line 230 of file FileSystemStorage.h.

00230                               {
00231     return parent_;
00232   }

bool OpenDDS::FileSystemStorage::File::read ( std::ifstream &  stream  ) 

Definition at line 485 of file FileSystemStorage.cpp.

References ACE_TEXT_ALWAYS_CHAR, ACE_String_Base< ACE_CHAR_T >::c_str(), physical_dir_, and physical_file_.

00486 {
00487   CwdGuard cg(physical_dir_);
00488   stream.open(ACE_TEXT_ALWAYS_CHAR(physical_file_.c_str()),
00489               ios::binary | ios::in);
00490   return !stream.bad() && !stream.fail();
00491 }

Here is the call graph for this function:

bool OpenDDS::FileSystemStorage::File::remove ( void   ) 

Definition at line 493 of file FileSystemStorage.cpp.

References ACE_String_Base< ACE_CHAR_T >::c_str(), logical_relative_, parent_, physical_dir_, physical_file_, and ACE_OS::unlink().

00494 {
00495   int unlink_result = -1;
00496   {
00497     CwdGuard cg(physical_dir_);
00498     unlink_result = ACE_OS::unlink(physical_file_.c_str());
00499   }
00500 
00501   if (unlink_result != -1) {
00502     parent_->removing(logical_relative_, true);
00503     return true;
00504   }
00505 
00506   return false;
00507 }

Here is the call graph for this function:

bool OpenDDS::FileSystemStorage::File::write ( std::ofstream &  stream  ) 

Definition at line 477 of file FileSystemStorage.cpp.

References ACE_TEXT_ALWAYS_CHAR, ACE_String_Base< ACE_CHAR_T >::c_str(), physical_dir_, and physical_file_.

00478 {
00479   CwdGuard cg(physical_dir_);
00480   stream.open(ACE_TEXT_ALWAYS_CHAR(physical_file_.c_str()),
00481               ios::binary | ios::out);
00482   return !stream.bad() && !stream.fail();
00483 }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class Directory [friend]

Definition at line 235 of file FileSystemStorage.h.

friend class Directory::Iterator [friend]

Definition at line 238 of file FileSystemStorage.h.

template<typename T , typename U0 , typename U1 , typename U2 >
OpenDDS::DCPS::RcHandle<T> OpenDDS::DCPS::make_rch ( const U0 &  ,
const U1 &  ,
const U2 &   
) [friend]

Member Data Documentation

Definition at line 242 of file FileSystemStorage.h.

Referenced by name(), and remove().

Definition at line 243 of file FileSystemStorage.h.

Referenced by remove().

Definition at line 242 of file FileSystemStorage.h.

Referenced by File(), read(), remove(), and write().

Definition at line 242 of file FileSystemStorage.h.

Referenced by File(), read(), remove(), and write().


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1