Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / ace / FIFO.h
blobf738aa783d4cec8782a74ca90355c4c3c50c4ec2
1 // -*- C++ -*-
3 //==========================================================================
4 /**
5 * @file FIFO.h
7 * @author Doug Schmidt
8 */
9 //==========================================================================
12 #ifndef ACE_FIFO_H
13 #define ACE_FIFO_H
14 #include /**/ "ace/pre.h"
16 #include /**/ "ace/ACE_export.h"
18 #if !defined (ACE_LACKS_PRAGMA_ONCE)
19 # pragma once
20 #endif /* ACE_LACKS_PRAGMA_ONCE */
22 #include "ace/IPC_SAP.h"
23 #include "ace/os_include/os_limits.h"
25 ACE_BEGIN_VERSIONED_NAMESPACE_DECL
27 /**
28 * @class ACE_FIFO
30 * @brief Abstract base class for UNIX FIFOs
32 * UNIX FIFOs are also known Named Pipes, which are totally
33 * unrelated to Windows Named Pipes. If you want to use a local
34 * IPC mechanism that will be portable to both UNIX and Windows,
35 * take a look at the ACE_Pipe or ACE_SPIPE_Stream classes.
37 class ACE_Export ACE_FIFO : public ACE_IPC_SAP
39 public:
40 /**
41 * Open up the named pipe (FIFO) on the @a rendezvous point in accordance
42 * with the @a flags.
44 * If @a flags contains @c O_CREAT open() will attempt to call mkfifo()
45 * to create the FIFO before opening it. In this case, this method
46 * will not fail simply because the fifo already exists.
48 * @retval 0 for success
49 * @retval -1 for error; errno contains the error code.
51 int open (const ACE_TCHAR *rendezvous, int flags, mode_t perms,
52 LPSECURITY_ATTRIBUTES sa = 0);
54 /// Close down the ACE_FIFO without removing the rendezvous point.
55 int close ();
57 /// Close down the ACE_FIFO and remove the rendezvous point from the
58 /// file system.
59 int remove ();
61 /// Return the local address of this endpoint.
62 int get_local_addr (const ACE_TCHAR *&rendezvous) const;
64 /// Dump the state of an object.
65 void dump () const;
67 /// Declare the dynamic allocation hooks.
68 ACE_ALLOC_HOOK_DECLARE;
70 protected:
71 /**
72 * Protected constructors ensure this class cannot be used directly.
73 * User code must use ACE_FIFO_Send and/or ACE_FIFO_Recv.
75 //@{
76 /// Default constructor.
77 ACE_FIFO ();
79 /// Open up the named pipe on the @a rendezvous in accordance with the
80 /// flags.
81 ACE_FIFO (const ACE_TCHAR *rendezvous, int flags, mode_t perms,
82 LPSECURITY_ATTRIBUTES sa = 0);
83 //@}
85 private:
86 /// Rendezvous point in the file system.
87 ACE_TCHAR rendezvous_[MAXPATHLEN + 1];
90 ACE_END_VERSIONED_NAMESPACE_DECL
92 #if defined (__ACE_INLINE__)
93 #include "ace/FIFO.inl"
94 #endif /* __ACE_INLINE__ */
96 #include /**/ "ace/post.h"
97 #endif /* ACE_FIFO_H */