Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

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 Methods

int close (void)
 Close the ACE_FILE handle without removing the ACE_FILE from the file system. More...

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

int unlink (void)
 Remove the ACE_FILE from the file system without closing the ACE_FILE handle. More...

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

int get_info (ACE_FILE_Info &finfo)
 Get information on this <ACE_FILE>. More...

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

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

off_t position (void)
int disable (int signum) const
int get_local_addr (ACE_Addr &) const
 Return the local endpoint address in the referenced ACE_Addr. Returns 0 if successful, else -1. More...

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

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

 ACE_FILE (void)
 Ensure that this class is only created by the ACE_FILE_Connector. More...


Protected Attributes

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


Detailed Description

Defines the core methods of the ACE_FILE abstraction.

Definition at line 61 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 27 of file FILE.cpp.

References ACE_TRACE.

00028 {
00029   ACE_TRACE ("ACE_FILE::ACE_FILE");
00030 }


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 35 of file FILE.cpp.

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

Referenced by remove.

00036 {
00037   ACE_TRACE ("ACE_FILE::close");
00038   int result = 0;
00039 
00040   if (this->get_handle () != ACE_INVALID_HANDLE)
00041     {
00042       result = ACE_OS::close (this->get_handle ());
00043       this->set_handle (ACE_INVALID_HANDLE);
00044     }
00045   return result;
00046 }

ASYS_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 7 of file FILE.i.

References ACE_IO_SAP::disable.

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

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 19 of file FILE.cpp.

References ACE_TRACE, and ACE_IO_SAP::dump.

00020 {
00021   ACE_TRACE ("ACE_FILE::dump");
00022   ACE_IO_SAP::dump ();
00023 }

int ACE_FILE::get_info ACE_FILE_Info   finfo
 

Get information on this <ACE_FILE>.

Definition at line 68 of file FILE.cpp.

References ACE_TRACE, and get_info.

00069 {
00070   ACE_TRACE ("ACE_FILE::get_info");
00071 
00072   return this->get_info (&finfo);
00073 }

int ACE_FILE::get_info ACE_FILE_Info   finfo
 

Get information on this ACE_FILE.

Definition at line 49 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.

00050 {
00051   ACE_TRACE ("ACE_FILE::get_info");
00052   ACE_stat filestatus;
00053 
00054   int result = ACE_OS::fstat (this->get_handle (),
00055                               &filestatus);
00056 
00057   if (result == 0)
00058     {
00059       finfo->mode_ = filestatus.st_mode;
00060       finfo->nlink_ = filestatus.st_nlink;
00061       finfo->size_ = filestatus.st_size;
00062     }
00063 
00064   return result;
00065 }

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 114 of file FILE.cpp.

References ACE_TRACE, and addr_.

Referenced by get_remote_addr.

00115 {
00116   ACE_TRACE ("ACE_FILE::get_local_addr");
00117 
00118   // Perform the downcast since <addr> had better be an
00119   // <ACE_FILE_Addr>.
00120   ACE_FILE_Addr *file_addr =
00121     ACE_dynamic_cast (ACE_FILE_Addr *, &addr);
00122 
00123   if (file_addr == 0)
00124     return -1;
00125   else
00126     {
00127       *file_addr = this->addr_;
00128       return 0;
00129     }
00130 }

int ACE_FILE::get_remote_addr ACE_Addr   const
 

Return the same thing as get_local_addr().

Definition at line 135 of file FILE.cpp.

References ACE_TRACE, and get_local_addr.

00136 {
00137   ACE_TRACE ("ACE_FILE::get_remote_addr");
00138 
00139   return this->get_local_addr (addr);
00140 }

off_t ACE_FILE::position void   
 

Deprecated:
Same as tell(), but position() is deprecated.

Definition at line 105 of file FILE.cpp.

References ACE_TRACE, and tell.

00106 {
00107   ACE_TRACE ("ACE_FILE::position");
00108   return this->tell ();
00109 }

off_t ACE_FILE::position long    offset,
int    startpos
 

Definition at line 91 of file FILE.cpp.

References ACE_TRACE, and seek.

00092 {
00093   ACE_TRACE ("ACE_FILE::position");
00094   return this->seek (offset, startpos);
00095 }

int ACE_FILE::remove void   
 

Close and remove the ACE_FILE from the file system.

Definition at line 143 of file FILE.cpp.

References ACE_TRACE, close, and ACE_OS::unlink.

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

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

Sets the file pointer as follows: o If <whence> is <SEEK_SET>, the pointer is set to <offset> bytes.

o If <whence> is <SEEK_CUR>, the pointer is set to its current location plus <offset>.

o If <whence> is <SEEK_END>, the pointer is set to the size of the file plus offset. Same as <seek>, but <position> is deprecated.

Definition at line 83 of file FILE.cpp.

References ACE_OS::lseek.

Referenced by position.

00084 {
00085   return ACE_OS::lseek (this->get_handle (),
00086                         offset,
00087                         startpos);
00088 }

off_t ACE_FILE::tell void   
 

Return an offset for the file handle.

Definition at line 98 of file FILE.cpp.

References ACE_TRACE, and ACE_OS::lseek.

Referenced by position.

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

int ACE_FILE::truncate off_t    length
 

Set filesize to length byte.

Definition at line 76 of file FILE.cpp.

References ACE_TRACE, and ACE_OS::ftruncate.

00077 {
00078   ACE_TRACE ("ACE_FILE::truncate");
00079   return ACE_OS::ftruncate (this->get_handle(), length);
00080 }

int ACE_FILE::unlink void   
 

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

Definition at line 152 of file FILE.cpp.

References ACE_TRACE, and ACE_OS::unlink.

00153 {
00154   ACE_TRACE ("ACE_FILE::unlink");
00155 
00156   return ACE_OS::unlink (this->addr_.get_path_name ());
00157 }


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 127 of file FILE.h.

ACE_FILE_Addr ACE_FILE::addr_ [protected]
 

File we are "connected" with...

Definition at line 135 of file FILE.h.

Referenced by ACE_FILE_Connector::connect, ACE_FILE_IO::dump, and get_local_addr.


The documentation for this class was generated from the following files:
Generated on Mon Jun 16 12:47:52 2003 for ACE by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002