ACE_FIFO Class Reference

Abstract base class for UNIX FIFOs. More...

#include <FIFO.h>

Inheritance diagram for ACE_FIFO:

Inheritance graph
[legend]
Collaboration diagram for ACE_FIFO:

Collaboration graph
[legend]
List of all members.

Public Member Functions

int open (const ACE_TCHAR *rendezvous, int flags, mode_t perms, LPSECURITY_ATTRIBUTES sa=0)
int close (void)
 Close down the ACE_FIFO without removing the rendezvous point.

int remove (void)
int get_local_addr (const ACE_TCHAR *&rendezvous) const
 Return the local address of this endpoint.

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_FIFO (void)
 Default constructor.

 ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, mode_t perms, LPSECURITY_ATTRIBUTES sa=0)

Private Attributes

ACE_TCHAR rendezvous_ [MAXPATHLEN+1]
 Rendezvous point in the file system.


Detailed Description

Abstract base class for UNIX FIFOs.

UNIX FIFOs are also known Named Pipes, which are totally unrelated to Win32 Named Pipes. If you want to use a local IPC mechanism that will be portable to both UNIX and Win32, take a look at the <ACE_SPIPE_*> classes.

Definition at line 39 of file FIFO.h.


Constructor & Destructor Documentation

ACE_FIFO::ACE_FIFO void   )  [protected]
 

Default constructor.

Definition at line 59 of file FIFO.cpp.

00060 {
00061 //  ACE_TRACE ("ACE_FIFO::ACE_FIFO");
00062 }

ACE_FIFO::ACE_FIFO const ACE_TCHAR rendezvous,
int  flags,
mode_t  perms,
LPSECURITY_ATTRIBUTES  sa = 0
[protected]
 

Open up the named pipe on the in accordance with the flags.

Definition at line 49 of file FIFO.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_TCHAR, ACE_TRACE, LM_ERROR, mode_t, and open().

00053 {
00054   ACE_TRACE ("ACE_FIFO::ACE_FIFO");
00055   if (this->open (fifo_name, flags, perms, sa) == -1)
00056     ACE_ERROR ((LM_ERROR,  ACE_LIB_TEXT ("%p\n"),  ACE_LIB_TEXT ("ACE_FIFO")));
00057 }


Member Function Documentation

int ACE_FIFO::close void   ) 
 

Close down the ACE_FIFO without removing the rendezvous point.

Reimplemented in ACE_FIFO_Recv.

Definition at line 65 of file FIFO.cpp.

References ACE_TRACE, ACE_OS::close(), ACE_IPC_SAP::get_handle(), and ACE_IPC_SAP::set_handle().

Referenced by ACE_FIFO_Recv::close(), and remove().

00066 {
00067   ACE_TRACE ("ACE_FIFO::close");
00068   int result = 0;
00069 
00070   if (this->get_handle () != ACE_INVALID_HANDLE)
00071     {
00072       result = ACE_OS::close (this->get_handle ());
00073       this->set_handle (ACE_INVALID_HANDLE);
00074     }
00075  return result;
00076 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL void ACE_FIFO::dump void   )  const
 

Dump the state of an object.

Reimplemented from ACE_IPC_SAP.

Reimplemented in ACE_FIFO_Recv, ACE_FIFO_Recv_Msg, ACE_FIFO_Send, and ACE_FIFO_Send_Msg.

Definition at line 22 of file FIFO.cpp.

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

Referenced by ACE_FIFO_Send::dump(), and ACE_FIFO_Recv::dump().

00023 {
00024 #if defined (ACE_HAS_DUMP)
00025   ACE_TRACE ("ACE_FIFO::dump");
00026 
00027   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00028   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("rendezvous_ = %s"), this->rendezvous_));
00029   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00030 #endif /* ACE_HAS_DUMP */
00031 }

ACE_BEGIN_VERSIONED_NAMESPACE_DECL ACE_INLINE int ACE_FIFO::get_local_addr const ACE_TCHAR *&  rendezvous  )  const
 

Return the local address of this endpoint.

Definition at line 10 of file FIFO.inl.

References ACE_TCHAR, ACE_TRACE, and rendezvous_.

00011 {
00012   ACE_TRACE ("ACE_FIFO::get_local_addr");
00013   r = this->rendezvous_;
00014   return 0;
00015 }

int ACE_FIFO::open const ACE_TCHAR rendezvous,
int  flags,
mode_t  perms,
LPSECURITY_ATTRIBUTES  sa = 0
 

Open up the named pipe on the in accordance with the flags.

Reimplemented in ACE_FIFO_Send, and ACE_FIFO_Send_Msg.

Definition at line 34 of file FIFO.cpp.

References ACE_TCHAR, ACE_TRACE, ACE_IPC_SAP::get_handle(), MAXPATHLEN, ACE_OS::mkfifo(), mode_t, ACE_IPC_SAP::set_handle(), and ACE_OS::strsncpy().

Referenced by ACE_FIFO(), ACE_FIFO_Send::open(), and ACE_FIFO_Recv::open().

00036 {
00037   ACE_TRACE ("ACE_FIFO::open");
00038   ACE_OS::strsncpy (this->rendezvous_, r, MAXPATHLEN);
00039 
00040   if ((flags & O_CREAT) != 0
00041       && ACE_OS::mkfifo (this->rendezvous_, perms) == -1
00042       && !(errno == EEXIST))
00043     return -1;
00044 
00045   this->set_handle (ACE_OS::open (this->rendezvous_, flags, 0, sa));
00046   return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
00047 }

ACE_INLINE int ACE_FIFO::remove void   ) 
 

Close down the ACE_FIFO and remove the rendezvous point from the file system.

Definition at line 18 of file FIFO.inl.

References ACE_TRACE, close(), and ACE_OS::unlink().

00019 {
00020   ACE_TRACE ("ACE_FIFO::remove");
00021   int const result = this->close ();
00022   return ACE_OS::unlink (this->rendezvous_) == -1 || result == -1 ? -1 : 0;
00023 }


Member Data Documentation

ACE_FIFO::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_IPC_SAP.

Reimplemented in ACE_FIFO_Recv, ACE_FIFO_Recv_Msg, ACE_FIFO_Send, and ACE_FIFO_Send_Msg.

Definition at line 61 of file FIFO.h.

ACE_TCHAR ACE_FIFO::rendezvous_[MAXPATHLEN + 1] [private]
 

Rendezvous point in the file system.

Definition at line 75 of file FIFO.h.

Referenced by get_local_addr().


The documentation for this class was generated from the following files:
Generated on Thu Nov 9 11:22:08 2006 for ACE by doxygen 1.3.6