]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm/tools/lldb/include/lldb/Host/Pipe.h
MFhead @ r276594
[FreeBSD/FreeBSD.git] / contrib / llvm / tools / lldb / include / lldb / Host / Pipe.h
1 //===-- Pipe.h --------------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9
10 #ifndef liblldb_Pipe_h_
11 #define liblldb_Pipe_h_
12 #if defined(__cplusplus)
13
14 #include <stdarg.h>
15 #include <stdio.h>
16 #include <sys/types.h>
17
18 #include "lldb/lldb-private.h"
19
20 namespace lldb_private {
21
22 //----------------------------------------------------------------------
23 /// @class Pipe Pipe.h "lldb/Host/Pipe.h"
24 /// @brief A class that abtracts unix style pipes.
25 ///
26 /// A class that abstracts the LLDB core from host pipe functionality.
27 //----------------------------------------------------------------------
28 class Pipe
29 {
30 public:
31     static int kInvalidDescriptor;
32     
33     Pipe();
34     
35     ~Pipe();
36     
37     bool
38     Open();
39
40     bool
41     IsValid() const;
42     
43     bool
44     ReadDescriptorIsValid() const;
45
46     bool
47     WriteDescriptorIsValid() const;
48
49     int
50     GetReadFileDescriptor() const;
51     
52     int
53     GetWriteFileDescriptor() const;
54     
55     // Close both descriptors
56     void
57     Close();
58
59     bool
60     CloseReadFileDescriptor();
61     
62     bool
63     CloseWriteFileDescriptor();
64
65     int
66     ReleaseReadFileDescriptor();
67     
68     int
69     ReleaseWriteFileDescriptor();
70
71     size_t
72     Read (void *buf, size_t size);
73
74     size_t
75     Write (const void *buf, size_t size);
76 private:
77     int m_fds[2];
78 };
79
80 } // namespace lldb_private
81
82 #endif  // #if defined(__cplusplus)
83 #endif  // liblldb_Pipe_h_