00001 // SPIPE.cpp,v 4.10 2005/10/28 16:14:55 ossama Exp 00002 00003 #include "ace/SPIPE.h" 00004 00005 #include "ace/OS_NS_unistd.h" 00006 00007 #if !defined (__ACE_INLINE__) 00008 #include "ace/SPIPE.inl" 00009 #endif /* __ACE_INLINE__ */ 00010 00011 ACE_RCSID(ace, SPIPE, "SPIPE.cpp,v 4.10 2005/10/28 16:14:55 ossama Exp") 00012 00013 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00014 00015 ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE) 00016 00017 // This is the do-nothing constructor. 00018 00019 ACE_SPIPE::ACE_SPIPE (void) 00020 { 00021 // ACE_TRACE ("ACE_SPIPE::ACE_SPIPE"); 00022 } 00023 00024 void 00025 ACE_SPIPE::dump (void) const 00026 { 00027 #if defined (ACE_HAS_DUMP) 00028 ACE_TRACE ("ACE_SPIPE::dump"); 00029 #endif /* ACE_HAS_DUMP */ 00030 } 00031 00032 // Close down a ACE_SPIPE. 00033 00034 int 00035 ACE_SPIPE::get_local_addr (ACE_SPIPE_Addr &local_sap) const 00036 { 00037 ACE_TRACE ("ACE_SPIPE::get_local_addr"); 00038 local_sap = this->local_addr_; 00039 return 0; 00040 } 00041 00042 // Close down the STREAM pipe without removing the rendezvous point. 00043 00044 int 00045 ACE_SPIPE::close (void) 00046 { 00047 ACE_TRACE ("ACE_SPIPE::close"); 00048 int result = 0; 00049 00050 if (this->get_handle () != ACE_INVALID_HANDLE) 00051 { 00052 result = ACE_OS::close (this->get_handle ()); 00053 #if defined (ACE_HAS_STREAM_PIPES) 00054 result = (ACE_OS::close (duplex_pipe_handle_) || result); 00055 #endif /* ACE_HAS_STREAM_PIPES */ 00056 this->set_handle (ACE_INVALID_HANDLE); 00057 } 00058 return result; 00059 } 00060 00061 // Close down the STREAM pipe and remove the rendezvous point from the 00062 // file system. 00063 00064 int 00065 ACE_SPIPE::remove (void) 00066 { 00067 ACE_TRACE ("ACE_SPIPE::remove"); 00068 int result = this->close (); 00069 return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1 || result == -1 ? -1 : 0; 00070 } 00071 00072 #if defined (ACE_HAS_STREAM_PIPES) 00073 /// Temporary store of duplex pipe handle. 00074 void 00075 ACE_SPIPE::set_duplex_handle (ACE_HANDLE handle) 00076 { 00077 ACE_TRACE ("ACE_SPIPE::set_duplex_handle"); 00078 this->duplex_pipe_handle_ = handle; 00079 } 00080 #endif /* ACE_HAS_STREAM_PIPES */ 00081 00082 ACE_END_VERSIONED_NAMESPACE_DECL