Defines the core methods of the ACE_FILE abstraction. More...
#include <FILE.h>
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 ACE_FILE. | |
int | truncate (ACE_OFF_T length) |
Set filesize to length byte. | |
ACE_OFF_T | seek (ACE_OFF_T offset, int whence=SEEK_CUR) |
ACE_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... |
Defines the core methods of the ACE_FILE abstraction.
Definition at line 63 of file FILE.h.
ACE_FILE::ACE_FILE | ( | void | ) | [protected] |
Ensure that this class is only created by the ACE_FILE_Connector.
Definition at line 32 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::ACE_FILE"); }
int ACE_FILE::close | ( | void | ) |
Close the ACE_FILE handle without removing the ACE_FILE from the file system.
Definition at line 40 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::close"); int result = 0; if (this->get_handle () != ACE_INVALID_HANDLE) { result = ACE_OS::close (this->get_handle ()); this->set_handle (ACE_INVALID_HANDLE); } return result; }
int ACE_FILE::disable | ( | int | signum | ) | const [inline] |
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.
{ #if defined (ACE_WIN32) ACE_UNUSED_ARG (signum) ; return 0 ; #else /* ACE_WIN32 */ return ACE_IO_SAP::disable (signum) ; #endif /* ACE_WIN32 */ }
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 22 of file FILE.cpp.
{ #if defined (ACE_HAS_DUMP) ACE_TRACE ("ACE_FILE::dump"); ACE_IO_SAP::dump (); #endif /* ACE_HAS_DUMP */ }
int ACE_FILE::get_info | ( | ACE_FILE_Info * | finfo | ) |
Get information on this ACE_FILE.
Definition at line 54 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::get_info"); ACE_stat filestatus; int const result = ACE_OS::fstat (this->get_handle (), &filestatus); if (result == 0) { finfo->mode_ = filestatus.st_mode; finfo->nlink_ = filestatus.st_nlink; finfo->size_ = filestatus.st_size; } return result; }
int ACE_FILE::get_info | ( | ACE_FILE_Info & | finfo | ) |
int ACE_FILE::get_local_addr | ( | ACE_Addr & | addr | ) | const |
Return the local endpoint address in the referenced ACE_Addr. Returns 0 if successful, else -1.
Definition at line 102 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::get_local_addr"); // Perform the downcast since <addr> had better be an // <ACE_FILE_Addr>. ACE_FILE_Addr *file_addr = dynamic_cast<ACE_FILE_Addr *> (&addr); if (file_addr == 0) return -1; else { *file_addr = this->addr_; return 0; } }
int ACE_FILE::get_remote_addr | ( | ACE_Addr & | addr | ) | const |
Return the same thing as get_local_addr().
Definition at line 123 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::get_remote_addr"); return this->get_local_addr (addr); }
int ACE_FILE::remove | ( | void | ) |
Close and remove the ACE_FILE from the file system.
Definition at line 131 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::remove"); this->close (); return ACE_OS::unlink (this->addr_.get_path_name ()); }
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.
Definition at line 87 of file FILE.cpp.
{ return ACE_OS::lseek (this->get_handle (), offset, startpos); }
ACE_OFF_T ACE_FILE::tell | ( | void | ) |
Return an offset for the file handle.
Definition at line 93 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::tell"); return ACE_OS::lseek (this->get_handle (), 0, SEEK_CUR); }
int ACE_FILE::truncate | ( | ACE_OFF_T | length | ) |
Set filesize to length byte.
Definition at line 80 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::truncate"); return ACE_OS::ftruncate (this->get_handle (), length); }
int ACE_FILE::unlink | ( | void | ) |
Remove the ACE_FILE from the file system without closing the ACE_FILE handle.
Definition at line 140 of file FILE.cpp.
{ ACE_TRACE ("ACE_FILE::unlink"); return ACE_OS::unlink (this->addr_.get_path_name ()); }
ACE_FILE_Addr ACE_FILE::addr_ [protected] |