Document return values
[ACE_TAO.git] / ACE / ace / SPIPE.cpp
blobe84042104ff30ad75d0d33a44ce3ef7b1220fc8c
1 #include "ace/SPIPE.h"
3 #include "ace/OS_NS_unistd.h"
5 #if defined (ACE_HAS_ALLOC_HOOKS)
6 # include "ace/Malloc_Base.h"
7 #endif /* ACE_HAS_ALLOC_HOOKS */
9 #if !defined (__ACE_INLINE__)
10 #include "ace/SPIPE.inl"
11 #endif /* __ACE_INLINE__ */
13 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
15 ACE_ALLOC_HOOK_DEFINE(ACE_SPIPE)
17 // This is the do-nothing constructor.
19 ACE_SPIPE::ACE_SPIPE ()
21 // ACE_TRACE ("ACE_SPIPE::ACE_SPIPE");
24 void
25 ACE_SPIPE::dump () const
27 #if defined (ACE_HAS_DUMP)
28 ACE_TRACE ("ACE_SPIPE::dump");
29 #endif /* ACE_HAS_DUMP */
32 // Close down a ACE_SPIPE.
34 int
35 ACE_SPIPE::get_local_addr (ACE_SPIPE_Addr &local_sap) const
37 ACE_TRACE ("ACE_SPIPE::get_local_addr");
38 local_sap = this->local_addr_;
39 return 0;
42 // Close down the STREAM pipe without removing the rendezvous point.
44 int
45 ACE_SPIPE::close ()
47 ACE_TRACE ("ACE_SPIPE::close");
48 int result = 0;
50 if (this->get_handle () != ACE_INVALID_HANDLE)
52 result = ACE_OS::close (this->get_handle ());
53 #if defined (ACE_HAS_STREAM_PIPES)
54 result = (ACE_OS::close (duplex_pipe_handle_) || result);
55 #endif /* ACE_HAS_STREAM_PIPES */
56 this->set_handle (ACE_INVALID_HANDLE);
58 return result;
61 // Close down the STREAM pipe and remove the rendezvous point from the
62 // file system.
64 int
65 ACE_SPIPE::remove ()
67 ACE_TRACE ("ACE_SPIPE::remove");
68 int result = this->close ();
69 return ACE_OS::unlink (this->local_addr_.get_path_name ()) == -1 || result == -1 ? -1 : 0;
72 #if defined (ACE_HAS_STREAM_PIPES)
73 /// Temporary store of duplex pipe handle.
74 void
75 ACE_SPIPE::set_duplex_handle (ACE_HANDLE handle)
77 ACE_TRACE ("ACE_SPIPE::set_duplex_handle");
78 this->duplex_pipe_handle_ = handle;
80 #endif /* ACE_HAS_STREAM_PIPES */
82 ACE_END_VERSIONED_NAMESPACE_DECL