]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - include/lldb/Host/PipeBase.h
Import LLDB as of upstream SVN 241361 (git 612c075f)
[FreeBSD/FreeBSD.git] / include / lldb / Host / PipeBase.h
1 //===-- PipeBase.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_Host_PipeBase_h_
11 #define liblldb_Host_PipeBase_h_
12
13 #include <chrono>
14 #include <string>
15
16 #include "lldb/Core/Error.h"
17 #include "llvm/ADT/SmallVector.h"
18 #include "llvm/ADT/StringRef.h"
19
20 namespace lldb_private
21 {
22 class PipeBase
23 {
24   public:
25     virtual ~PipeBase();
26
27     virtual Error CreateNew(bool child_process_inherit) = 0;
28     virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0;
29     virtual Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char>& name) = 0;
30
31     virtual Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) = 0;
32
33     Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit);
34     virtual Error OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) = 0;
35
36     virtual bool CanRead() const = 0;
37     virtual bool CanWrite() const = 0;
38
39     virtual int GetReadFileDescriptor() const = 0;
40     virtual int GetWriteFileDescriptor() const = 0;
41     virtual int ReleaseReadFileDescriptor() = 0;
42     virtual int ReleaseWriteFileDescriptor() = 0;
43     virtual void CloseReadFileDescriptor() = 0;
44     virtual void CloseWriteFileDescriptor() = 0;
45
46     // Close both descriptors
47     virtual void Close() = 0;
48
49     // Delete named pipe.
50     virtual Error Delete(llvm::StringRef name) = 0;
51
52     virtual Error Write(const void *buf, size_t size, size_t &bytes_written) = 0;
53     virtual Error ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) = 0;
54     Error Read(void *buf, size_t size, size_t &bytes_read);
55 };
56 }
57
58 #endif