ACE_FILE Class Reference

Defines the core methods of the ACE_FILE abstraction. More...

#include <FILE.h>

Inheritance diagram for ACE_FILE:

Inheritance graph
[legend]
Collaboration diagram for ACE_FILE:

Collaboration graph
[legend]
List of all members.

Public Member Functions

int close (void)
int remove (void)
 Close and remove the ACE_FILE from the file system.

int unlink (void)
int get_info (ACE_FILE_Info *finfo)
 Get information on this ACE_FILE.

int get_info (ACE_FILE_Info &finfo)
 Get information on this .

int truncate (off_t length)
 Set filesize to length byte.

off_t seek (off_t offset, int whence=SEEK_CUR)
off_t tell (void)
 Return an offset for the file handle.

int disable (int signum) const
int get_local_addr (ACE_Addr &) const
int get_remote_addr (ACE_Addr &) const
 Return the same thing as get_local_addr().

void dump (void) const
 Dump the state of an object.


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks.


Protected Member Functions

 ACE_FILE (void)

Protected Attributes

ACE_FILE_Addr addr_
 File we are "connected" with...


Detailed Description

Defines the core methods of the ACE_FILE abstraction.

Definition at line 63 of file FILE.h.


Constructor & Destructor Documentation

ACE_FILE::ACE_FILE void   )  [protected]
 

Ensure that this class is only created by the ACE_FILE_Connector.

Definition at line 33 of file FILE.cpp.

References ACE_TRACE.

00034 {
00035   ACE_TRACE ("ACE_FILE::ACE_FILE");
00036 }


Member Function Documentation

int ACE_FILE::close void   ) 
 

Close the ACE_FILE handle without removing the ACE_FILE from the file system.

Definition at line 41 of file FILE.cpp.

References ACE_TRACE, ACE_OS::close(), ACE_IO_SAP::get_handle(), and ACE_IO_SAP::set_handle().

Referenced by remove().

00042 {
00043   ACE_TRACE ("ACE_FILE::close");
00044   int result = 0;
00045 
00046   if (this->get_handle () != ACE_INVALID_HANDLE)
00047     {
00048       result = ACE_OS::close (this->get_handle ());
00049       this->set_handle (ACE_INVALID_HANDLE);
00050     }
00051   return result;
00052 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_FILE::disable int  signum  )  const
 

Disable signal signum This is here to prevent Win32 from disabling SPIPE using socket calls

Reimplemented from ACE_IO_SAP.

Definition at line 8 of file FILE.inl.

References ACE_IO_SAP::disable().

00009 {
00010 #if defined (ACE_WIN32)
00011   ACE_UNUSED_ARG (signum) ;
00012   return 0 ;
00013 #else  /* ACE_WIN32 */
00014   return ACE_IO_SAP::disable (signum) ;
00015 #endif /* ACE_WIN32 */
00016 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_FILE::dump void   )  const
 

Dump the state of an object.

Reimplemented from ACE_IO_SAP.

Reimplemented in ACE_FILE_IO.

Definition at line 23 of file FILE.cpp.

References ACE_TRACE, and ACE_IO_SAP::dump().

00024 {
00025 #if defined (ACE_HAS_DUMP)
00026   ACE_TRACE ("ACE_FILE::dump");
00027   ACE_IO_SAP::dump ();
00028 #endif /* ACE_HAS_DUMP */
00029 }

int ACE_FILE::get_info ACE_FILE_Info finfo  ) 
 

Get information on this .

Definition at line 74 of file FILE.cpp.

References ACE_TRACE, and get_info().

00075 {
00076   ACE_TRACE ("ACE_FILE::get_info");
00077 
00078   return this->get_info (&finfo);
00079 }

int ACE_FILE::get_info ACE_FILE_Info finfo  ) 
 

Get information on this ACE_FILE.

Definition at line 55 of file FILE.cpp.

References ACE_stat, ACE_TRACE, ACE_OS::fstat(), ACE_FILE_Info::mode_, ACE_FILE_Info::nlink_, and ACE_FILE_Info::size_.

Referenced by get_info().

00056 {
00057   ACE_TRACE ("ACE_FILE::get_info");
00058   ACE_stat filestatus;
00059 
00060   int const result = ACE_OS::fstat (this->get_handle (),
00061                                     &filestatus);
00062 
00063   if (result == 0)
00064     {
00065       finfo->mode_ = filestatus.st_mode;
00066       finfo->nlink_ = filestatus.st_nlink;
00067       finfo->size_ = filestatus.st_size;
00068     }
00069 
00070   return result;
00071 }

int ACE_FILE::get_local_addr ACE_Addr  )  const
 

Return the local endpoint address in the referenced ACE_Addr. Returns 0 if successful, else -1.

Definition at line 106 of file FILE.cpp.

References ACE_TRACE.

Referenced by get_remote_addr().

00107 {
00108   ACE_TRACE ("ACE_FILE::get_local_addr");
00109 
00110   // Perform the downcast since <addr> had better be an
00111   // <ACE_FILE_Addr>.
00112   ACE_FILE_Addr *file_addr =
00113     dynamic_cast<ACE_FILE_Addr *> (&addr);
00114 
00115   if (file_addr == 0)
00116     return -1;
00117   else
00118     {
00119       *file_addr = this->addr_;
00120       return 0;
00121     }
00122 }

int ACE_FILE::get_remote_addr ACE_Addr  )  const
 

Return the same thing as get_local_addr().

Definition at line 127 of file FILE.cpp.

References ACE_TRACE, and get_local_addr().

00128 {
00129   ACE_TRACE ("ACE_FILE::get_remote_addr");
00130 
00131   return this->get_local_addr (addr);
00132 }

int ACE_FILE::remove void   ) 
 

Close and remove the ACE_FILE from the file system.

Definition at line 135 of file FILE.cpp.

References ACE_TRACE, close(), and ACE_OS::unlink().

00136 {
00137   ACE_TRACE ("ACE_FILE::remove");
00138 
00139   this->close ();
00140   return ACE_OS::unlink (this->addr_.get_path_name ());
00141 }

off_t ACE_FILE::seek off_t  offset,
int  whence = SEEK_CUR
 

Sets the file pointer as follows: o If is , the pointer is set to bytes.

o If is , the pointer is set to its current location plus .

o If is , the pointer is set to the size of the file plus offset.

Definition at line 89 of file FILE.cpp.

References ACE_OS::lseek().

00090 {
00091   return ACE_OS::lseek (this->get_handle (),
00092                         offset,
00093                         startpos);
00094 }

off_t ACE_FILE::tell void   ) 
 

Return an offset for the file handle.

Definition at line 97 of file FILE.cpp.

References ACE_TRACE, and ACE_OS::lseek().

00098 {
00099   ACE_TRACE ("ACE_FILE::tell");
00100   return ACE_OS::lseek (this->get_handle (), 0, SEEK_CUR);
00101 }

int ACE_FILE::truncate off_t  length  ) 
 

Set filesize to length byte.

Definition at line 82 of file FILE.cpp.

References ACE_TRACE, and ACE_OS::ftruncate().

00083 {
00084   ACE_TRACE ("ACE_FILE::truncate");
00085   return ACE_OS::ftruncate (this->get_handle(), length);
00086 }

int ACE_FILE::unlink void   ) 
 

Remove the ACE_FILE from the file system without closing the ACE_FILE handle.

Definition at line 144 of file FILE.cpp.

References ACE_TRACE, and ACE_OS::unlink().

00145 {
00146   ACE_TRACE ("ACE_FILE::unlink");
00147 
00148   return ACE_OS::unlink (this->addr_.get_path_name ());
00149 }


Member Data Documentation

ACE_FILE::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_IO_SAP.

Reimplemented in ACE_FILE_IO.

Definition at line 121 of file FILE.h.

ACE_FILE_Addr ACE_FILE::addr_ [protected]
 

File we are "connected" with...

Definition at line 129 of file FILE.h.

Referenced by ACE_FILE_Connector::connect().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:22:13 2006 for ACE by doxygen 1.3.6