#include <FILE_Addr.h>
Inheritance diagram for ACE_FILE_Addr:
Public Member Functions | |
ACE_FILE_Addr (void) | |
Default constructor. | |
ACE_FILE_Addr (const ACE_FILE_Addr &sa) | |
Copy constructor. | |
int | set (const ACE_FILE_Addr &sa) |
ACE_FILE_Addr (const ACE_TCHAR *filename) | |
Create a ACE_FILE_Addr from a pathname. | |
int | set (const ACE_TCHAR *filename) |
Create a ACE_FILE_Addr from a pathname. | |
ACE_FILE_Addr & | operator= (const ACE_FILE_Addr &) |
Assignment operator. | |
virtual void * | get_addr (void) const |
Return a pointer to the address. | |
virtual int | addr_to_string (ACE_TCHAR *addr, size_t) const |
Transform the current address into string format. | |
bool | operator== (const ACE_FILE_Addr &SAP) const |
Compare two addresses for equality. | |
bool | operator!= (const ACE_FILE_Addr &SAP) const |
Compare two addresses for inequality. | |
const ACE_TCHAR * | get_path_name (void) const |
Return the path name used for the rendezvous point. | |
void | dump (void) const |
Dump the state of an object. | |
Public Attributes | |
ACE_ALLOC_HOOK_DECLARE | |
Declare the dynamic allocation hooks. | |
Private Attributes | |
ACE_TCHAR | filename_ [MAXPATHLEN+1] |
Name of the file. |
Definition at line 33 of file FILE_Addr.h.
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_FILE_Addr::ACE_FILE_Addr | ( | void | ) |
ACE_FILE_Addr::ACE_FILE_Addr | ( | const ACE_FILE_Addr & | sa | ) |
ACE_FILE_Addr::ACE_FILE_Addr | ( | const ACE_TCHAR * | filename | ) | [explicit] |
Create a ACE_FILE_Addr from a pathname.
Definition at line 93 of file FILE_Addr.cpp.
References set().
00094 { 00095 this->set (filename); 00096 }
int ACE_FILE_Addr::addr_to_string | ( | ACE_TCHAR * | addr, | |
size_t | ||||
) | const [virtual] |
Transform the current address into string format.
Definition at line 99 of file FILE_Addr.cpp.
References ACE_OS::strsncpy().
00100 { 00101 ACE_OS::strsncpy (s, this->filename_, len); 00102 return 0; 00103 }
void ACE_FILE_Addr::dump | ( | void | ) | const |
Dump the state of an object.
Reimplemented from ACE_Addr.
Definition at line 114 of file FILE_Addr.cpp.
References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_TEXT, ACE_TRACE, and LM_DEBUG.
00115 { 00116 #if defined (ACE_HAS_DUMP) 00117 ACE_TRACE ("ACE_FILE_Addr::dump"); 00118 00119 ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this)); 00120 ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("filename_ = %s"), this->filename_)); 00121 ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP)); 00122 #endif /* ACE_HAS_DUMP */ 00123 }
void * ACE_FILE_Addr::get_addr | ( | void | ) | const [virtual] |
Return a pointer to the address.
Reimplemented from ACE_Addr.
Definition at line 108 of file FILE_Addr.cpp.
References filename_.
00109 { 00110 return (void *)&this->filename_; 00111 }
ACE_INLINE const ACE_TCHAR * ACE_FILE_Addr::get_path_name | ( | void | ) | const |
Return the path name used for the rendezvous point.
Definition at line 29 of file FILE_Addr.inl.
References filename_.
Referenced by ACE_FILE_Connector::ACE_FILE_Connector(), and ACE_FILE_Connector::connect().
00030 { 00031 return this->filename_; 00032 }
ACE_INLINE bool ACE_FILE_Addr::operator!= | ( | const ACE_FILE_Addr & | SAP | ) | const |
ACE_FILE_Addr & ACE_FILE_Addr::operator= | ( | const ACE_FILE_Addr & | ) |
Assignment operator.
Definition at line 84 of file FILE_Addr.cpp.
References set().
00085 { 00086 if (this != &sa) 00087 this->set (sa); 00088 return *this; 00089 }
ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE bool ACE_FILE_Addr::operator== | ( | const ACE_FILE_Addr & | SAP | ) | const |
Compare two addresses for equality.
Definition at line 13 of file FILE_Addr.inl.
References filename_, and ACE_OS::strcmp().
00014 { 00015 return ACE_OS::strcmp (this->filename_, sap.filename_) == 0; 00016 }
int ACE_FILE_Addr::set | ( | const ACE_TCHAR * | filename | ) |
Create a ACE_FILE_Addr from a pathname.
Definition at line 73 of file FILE_Addr.cpp.
References AF_FILE, ACE_Addr::base_set(), ACE_OS::strlen(), and ACE_OS::strsncpy().
00074 { 00075 this->ACE_Addr::base_set (AF_FILE, 00076 static_cast<int> (ACE_OS::strlen (filename) + 1)); 00077 (void) ACE_OS::strsncpy (this->filename_, 00078 filename, 00079 sizeof this->filename_ / sizeof (ACE_TCHAR)); 00080 return 0; 00081 }
int ACE_FILE_Addr::set | ( | const ACE_FILE_Addr & | sa | ) |
Acts like a copy constructor. If sa == ACE_Addr::sap_any then create a temporary filename using ACE_OS::mktemp.
Definition at line 27 of file FILE_Addr.cpp.
References ACE_ERROR, ACE_TEXT, AF_ANY, AF_FILE, ACE_Addr::base_set(), filename_, ACE_Addr::get_size(), ACE::get_temp_dir(), ACE_Addr::get_type(), LM_ERROR, MAXPATHLEN, ACE_OS::mktemp(), ACE_OS::strcat(), ACE_OS::strcpy(), ACE_OS::strlen(), and ACE_OS::strsncpy().
Referenced by ACE_FILE_Addr(), ACE_FILE_Connector::connect(), and operator=().
00028 { 00029 if (sa.get_type () == AF_ANY) 00030 { 00031 #if defined (ACE_DEFAULT_TEMP_FILE) 00032 // Create a temporary file. 00033 ACE_OS::strcpy (this->filename_, 00034 ACE_DEFAULT_TEMP_FILE); 00035 #else /* ACE_DEFAULT_TEMP_FILE */ 00036 if (ACE::get_temp_dir (this->filename_, MAXPATHLEN - 15) == -1) 00037 // -15 for ace-file-XXXXXX 00038 { 00039 ACE_ERROR ((LM_ERROR, 00040 ACE_TEXT ("Temporary path too long, ") 00041 ACE_TEXT ("defaulting to current directory\n"))); 00042 this->filename_[0] = 0; 00043 } 00044 00045 // Add the filename to the end 00046 ACE_OS::strcat (this->filename_, ACE_TEXT ("ace-fileXXXXXX")); 00047 00048 #endif /* ACE_DEFAULT_TEMP_FILE */ 00049 00050 if (ACE_OS::mktemp (this->filename_) == 0) 00051 return -1; 00052 this->base_set (AF_FILE, 00053 static_cast<int> (ACE_OS::strlen (this->filename_) + 1)); 00054 } 00055 else 00056 { 00057 (void)ACE_OS::strsncpy (this->filename_, sa.filename_, sa.get_size ()); 00058 00059 this->base_set (sa.get_type (), sa.get_size ()); 00060 } 00061 return 0; 00062 }
Declare the dynamic allocation hooks.
Reimplemented from ACE_Addr.
Definition at line 75 of file FILE_Addr.h.
ACE_TCHAR ACE_FILE_Addr::filename_[MAXPATHLEN+1] [private] |
Name of the file.
Definition at line 79 of file FILE_Addr.h.
Referenced by get_addr(), get_path_name(), operator==(), and set().