summaryrefslogtreecommitdiff
path: root/ace/Pipe.h
blob: 8316820d356f6f9b8ce2c45af415ad773dbde5a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// -*- C++ -*-

//==========================================================================
/**
 *  @file    Pipe.h
 *
 *  $Id$
 *
 *  @author Doug Schmidt
 */
//==========================================================================


#ifndef ACE_PIPE_H
#define ACE_PIPE_H

#include /**/ "ace/pre.h"

#include "ace/ACE_export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "ace/Default_Constants.h"

/**
 * @class ACE_Pipe
 *
 * @brief Provides a bidirectional "pipe" abstraction that is portable
 * to Windows NT, SVR4 UNIX, and BSD UNIX.
 *
 * Uses "name" for lookup in the ACE service repository. Obtains
 * the object and returns it as the appropriate type.
 */
class ACE_Export ACE_Pipe
{
public:
  // = Initialization and termination.
  /// Default constructor (does nothing...).
  ACE_Pipe (void);

  /// Open the pipe and initialize the handles.
  ACE_Pipe (ACE_HANDLE handles[2]);

  /// Initialize the <ACE_Pipe> from the <read> and <write> handles.
  ACE_Pipe (ACE_HANDLE read, ACE_HANDLE write);

  /// Default dtor.  It doesn't close the handles for you.
  ~ACE_Pipe (void);

  /// Open the pipe and initialize the handles.
  int open (ACE_HANDLE handles[2]);

  /// Open the pipe, setting the buffer size to the maximum.
  int open (int buffer_size = ACE_DEFAULT_MAX_SOCKET_BUFSIZ);

  /// Close down the pipe HANDLEs;
  int close (void);

  // = Accessors.

  /**
   * This is the "read" side of the pipe.  Note, however, that
   * processes can also write to this handle as well since pipes are
   * bi-directional.
   */
  ACE_HANDLE read_handle (void) const;

  /**
   * This is the "write" side of the pipe.  Note, however, that
   * processes can also read to this handle as well since pipes are
   * bi-directional.
   */
  ACE_HANDLE write_handle (void) const;

  /// Dump the state of the object.
  void dump (void) const;

private:
  ACE_HANDLE handles_[2];
};

#if defined (__ACE_INLINE__)
#include "ace/Pipe.inl"
#endif /* __ACE_INLINE__ */

#include /**/ "ace/post.h"

#endif /* ACE_PIPE_H */