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

ACE_FILE_Addr Class Reference

Defines the FILE address family address format. More...

#include <FILE_Addr.h>

Inheritance diagram for ACE_FILE_Addr:

Inheritance graph
[legend]
Collaboration diagram for ACE_FILE_Addr:

Collaboration graph
[legend]
List of all members.

Public Methods

 ACE_FILE_Addr (void)
 Default constructor. More...

 ACE_FILE_Addr (const ACE_FILE_Addr &sa)
 Copy constructor. More...

int 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>. More...

ACE_EXPLICIT ACE_FILE_Addr (const ACE_TCHAR *filename)
 Create a ACE_FILE_Addr from a pathname. More...

int set (const ACE_TCHAR *filename)
 Create a ACE_FILE_Addr from a pathname. More...

ACE_FILE_Addr & operator= (const ACE_FILE_Addr &)
 Assignment operator. More...

virtual void * get_addr (void) const
 Return a pointer to the address. More...

virtual int addr_to_string (ACE_TCHAR *addr, size_t) const
 Transform the current address into string format. More...

int operator== (const ACE_FILE_Addr &SAP) const
 Compare two addresses for equality. More...

int operator!= (const ACE_FILE_Addr &SAP) const
 Compare two addresses for inequality. More...

const ACE_TCHARget_path_name (void) const
 Return the path name used for the rendezvous point. More...

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Private Attributes

ACE_TCHAR filename_ [MAXNAMLEN+1]
 Name of the file. More...


Detailed Description

Defines the FILE address family address format.

Definition at line 31 of file FILE_Addr.h.


Constructor & Destructor Documentation

ACE_FILE_Addr::ACE_FILE_Addr void   
 

Default constructor.

Definition at line 15 of file FILE_Addr.cpp.

References ACE_TCHAR, AF_FILE, and filename_.

00016   : ACE_Addr (AF_FILE, sizeof this->filename_ / sizeof (ACE_TCHAR))
00017 {
00018   this->filename_[0] = '\0';
00019 }

ACE_FILE_Addr::ACE_FILE_Addr const ACE_FILE_Addr &    sa
 

Copy constructor.

Definition at line 66 of file FILE_Addr.cpp.

References AF_FILE, and set.

00067   : ACE_Addr (AF_FILE, sizeof this->filename_)
00068 {
00069   this->set (sa);
00070 }

ACE_FILE_Addr::ACE_FILE_Addr const ACE_TCHAR   filename
 

Create a ACE_FILE_Addr from a pathname.

Definition at line 94 of file FILE_Addr.cpp.

References ACE_TCHAR, and set.

00095 {
00096   this->set (filename);
00097 }


Member Function Documentation

int ACE_FILE_Addr::addr_to_string ACE_TCHAR   addr,
size_t   
const [virtual]
 

Transform the current address into string format.

Definition at line 100 of file FILE_Addr.cpp.

References ACE_TCHAR, and ACE_OS_String::strsncpy.

00101 {
00102   ACE_OS::strsncpy (s, this->filename_, len);
00103   return 0;
00104 }

void ACE_FILE_Addr::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_Addr.

Definition at line 107 of file FILE_Addr.cpp.

References ACE_BEGIN_DUMP, ACE_DEBUG, ACE_END_DUMP, ACE_LIB_TEXT, ACE_TRACE, and LM_DEBUG.

Referenced by ACE_FILE_IO::dump.

00108 {
00109   ACE_TRACE ("ACE_FILE_Addr::dump");
00110 
00111   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00112   ACE_DEBUG ((LM_DEBUG,  ACE_LIB_TEXT ("filename_ = %s"), this->filename_));
00113   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00114 }

ACE_INLINE void * ACE_FILE_Addr::get_addr void    const [virtual]
 

Return a pointer to the address.

Reimplemented from ACE_Addr.

Definition at line 15 of file FILE_Addr.i.

References filename_.

00016 {
00017   return (void *) &this->filename_;
00018 }

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 39 of file FILE_Addr.i.

References filename_.

Referenced by ACE_FILE_Connector::ACE_FILE_Connector, and ACE_FILE_Connector::connect.

00040 {
00041   return this->filename_;
00042 }

ACE_INLINE int ACE_FILE_Addr::operator!= const ACE_FILE_Addr &    SAP const
 

Compare two addresses for inequality.

Definition at line 31 of file FILE_Addr.i.

00032 {
00033   return !((*this) == sap);     // This is lazy, of course... ;-)
00034 }

ACE_FILE_Addr & ACE_FILE_Addr::operator= const ACE_FILE_Addr &   
 

Assignment operator.

Definition at line 85 of file FILE_Addr.cpp.

References set.

00086 {
00087   if (this != &sa)
00088     this->set (sa);
00089   return *this;
00090 }

ACE_INLINE int ACE_FILE_Addr::operator== const ACE_FILE_Addr &    SAP const
 

Compare two addresses for equality.

Definition at line 23 of file FILE_Addr.i.

References filename_, and ACE_OS_String::strcmp.

00024 {
00025   return ACE_OS::strcmp (this->filename_, sap.filename_) == 0;
00026 }

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 ACE_TCHAR, AF_FILE, ACE_Addr::base_set, ACE_OS_String::strlen, and ACE_OS_String::strsncpy.

00074 {
00075   this->ACE_Addr::base_set (AF_FILE,
00076                             ACE_static_cast (int,
00077                                              ACE_OS::strlen (filename) + 1));
00078   (void) ACE_OS::strsncpy (this->filename_,
00079                            filename,
00080                            sizeof this->filename_ / sizeof (ACE_TCHAR));
00081   return 0;
00082 }

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 22 of file FILE_Addr.cpp.

References ACE_ERROR, ACE_LIB_TEXT, AF_ANY, AF_FILE, ACE_Addr::base_set, filename_, ACE_Addr::get_size, ACE_Lib_Find::get_temp_dir, ACE_Addr::get_type, LM_ERROR, MAXPATHLEN, ACE_OS::mktemp, ACE_OS_String::strcat, ACE_OS_String::strcpy, ACE_OS_String::strlen, and ACE_OS_String::strsncpy.

Referenced by ACE_FILE_Addr, ACE_FILE_Connector::connect, and operator=.

00023 {
00024   if (sa.get_type () == AF_ANY)
00025     {
00026 #if defined (ACE_DEFAULT_TEMP_FILE)
00027       // Create a temporary file.
00028       ACE_OS::strcpy (this->filename_,
00029                       ACE_DEFAULT_TEMP_FILE);
00030 #else /* ACE_DEFAULT_TEMP_FILE */
00031       if (ACE_Lib_Find::get_temp_dir (this->filename_,
00032                                       MAXPATHLEN - 15) == -1)
00033         // -15 for ace-file-XXXXXX
00034         {
00035           ACE_ERROR ((LM_ERROR,
00036                       ACE_LIB_TEXT ("Temporary path too long, ")
00037                       ACE_LIB_TEXT ("defaulting to current directory\n")));
00038           this->filename_[0] = 0;
00039         }
00040 
00041       // Add the filename to the end
00042       ACE_OS::strcat (this->filename_, ACE_LIB_TEXT ("ace-fileXXXXXX"));
00043 
00044 #endif /* ACE_DEFAULT_TEMP_FILE */
00045 
00046       if (ACE_OS::mktemp (this->filename_) == 0)
00047         return -1;
00048       this->base_set (AF_FILE,
00049                       ACE_static_cast (int,
00050                                        ACE_OS::strlen (this->filename_) + 1));
00051     }
00052   else
00053     {
00054       (void) ACE_OS::strsncpy (this->filename_,
00055                                sa.filename_,
00056                                sa.get_size ());
00057 
00058       this->base_set (sa.get_type (),
00059                       sa.get_size ());
00060     }
00061   return 0;
00062 }


Member Data Documentation

ACE_FILE_Addr::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_Addr.

Definition at line 73 of file FILE_Addr.h.

ACE_TCHAR ACE_FILE_Addr::filename_[MAXNAMLEN + 1] [private]
 

Name of the file.

Definition at line 77 of file FILE_Addr.h.

Referenced by ACE_FILE_Addr, get_addr, get_path_name, operator==, and set.


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