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

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 Methods

int open (const ACE_TCHAR *rendezvous, int flags, int perms, LPSECURITY_ATTRIBUTES sa=0)
 Open up the named pipe on the <rendezvous> in accordance with the flags. More...

int close (void)
 Close down the ACE_FIFO without removing the rendezvous point. More...

int remove (void)
 Close down the ACE_FIFO and remove the rendezvous point from the file system. More...

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

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


Public Attributes

 ACE_ALLOC_HOOK_DECLARE
 Declare the dynamic allocation hooks. More...


Protected Methods

 ACE_FIFO (void)
 Default constructor. More...

 ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, int perms, LPSECURITY_ATTRIBUTES sa=0)
 Open up the named pipe on the <rendezvous> in accordance with the flags. More...


Private Attributes

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


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 34 of file FIFO.h.


Constructor & Destructor Documentation

ACE_FIFO::ACE_FIFO void    [protected]
 

Default constructor.

Definition at line 58 of file FIFO.cpp.

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

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

Open up the named pipe on the <rendezvous> in accordance with the flags.

Definition at line 48 of file FIFO.cpp.

References ACE_ERROR, ACE_LIB_TEXT, ACE_TCHAR, ACE_TRACE, LM_ERROR, and open.

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


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 64 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.

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

void ACE_FIFO::dump void    const
 

Dump the state of an object.

Reimplemented from ACE_IPC_SAP.

Reimplemented in ACE_FIFO_Recv.

Definition at line 17 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.

00018 {
00019   ACE_TRACE ("ACE_FIFO::dump");
00020 
00021   ACE_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
00022   ACE_DEBUG ((LM_DEBUG, ACE_LIB_TEXT ("rendezvous_ = %s"), this->rendezvous_));
00023   ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
00024 }

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

Return the local address of this endpoint.

Definition at line 7 of file FIFO.i.

References ACE_TCHAR, ACE_TRACE, and rendezvous_.

00008 {
00009   ACE_TRACE ("ACE_FIFO::get_local_addr");
00010   r = this->rendezvous_;
00011   return 0;
00012 }

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

Open up the named pipe on the <rendezvous> in accordance with the flags.

Reimplemented in ACE_FIFO_Send.

Definition at line 27 of file FIFO.cpp.

References ACE_TCHAR, ACE_TRACE, ACE_IPC_SAP::get_handle, MAXPATHLEN, ACE_OS::mkfifo, ACE_OS::open, ACE_IPC_SAP::set_handle, and ACE_OS_String::strsncpy.

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

00029 {
00030   ACE_TRACE ("ACE_FIFO::open");
00031   ACE_OS::strsncpy (this->rendezvous_, r, MAXPATHLEN);
00032 
00033 #if defined (ACE_PSOS_DIAB_MIPS)
00034   if ( ACE_OS::mkfifo (this->rendezvous_, perms) == -1
00035       && !(errno == EEXIST))
00036     return -1;
00037 #else
00038   if ((flags & O_CREAT) != 0
00039       && ACE_OS::mkfifo (this->rendezvous_, perms) == -1
00040       && !(errno == EEXIST))
00041     return -1;
00042 #endif
00043 
00044   this->set_handle (ACE_OS::open (this->rendezvous_, flags, 0, sa));
00045   return this->get_handle () == ACE_INVALID_HANDLE ? -1 : 0;
00046 }

ACE_INLINE int ACE_FIFO::remove void   
 

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

Definition at line 15 of file FIFO.i.

References ACE_TRACE, close, and ACE_OS::unlink.

00016 {
00017   ACE_TRACE ("ACE_FIFO::remove");
00018   int result = this->close ();
00019   return ACE_OS::unlink (this->rendezvous_) == -1 || result == -1 ? -1 : 0;
00020 }


Member Data Documentation

ACE_FIFO::ACE_ALLOC_HOOK_DECLARE
 

Declare the dynamic allocation hooks.

Reimplemented from ACE_IPC_SAP.

Reimplemented in ACE_FIFO_Recv.

Definition at line 56 of file FIFO.h.

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

Rendezvous point in the file system.

Definition at line 70 of file FIFO.h.

Referenced by get_local_addr.


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