LLDB mainline
IOObject.h
Go to the documentation of this file.
1//===-- IOObject.h ----------------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_UTILITY_IOOBJECT_H
10#define LLDB_UTILITY_IOOBJECT_H
11
12#include <cstdarg>
13#include <cstdio>
14#include <sys/types.h>
15
16#include "lldb/lldb-private.h"
17#include "lldb/lldb-types.h"
18
19namespace lldb_private {
20
21class IOObject {
22public:
23 enum FDType {
24 eFDTypeFile, // Other FD requiring read/write
25 eFDTypeSocket, // Socket requiring send/recv
26 };
27
28 // A handle for integrating with the host event loop model.
30
32
33 IOObject(FDType type) : m_fd_type(type) {}
34 virtual ~IOObject();
35
36 virtual Status Read(void *buf, size_t &num_bytes) = 0;
37 virtual Status Write(const void *buf, size_t &num_bytes) = 0;
38 virtual bool IsValid() const = 0;
39 virtual Status Close() = 0;
40
41 FDType GetFdType() const { return m_fd_type; }
42
44
45protected:
47
48private:
49 IOObject(const IOObject &) = delete;
50 const IOObject &operator=(const IOObject &) = delete;
51};
52} // namespace lldb_private
53
54#endif
IOObject(const IOObject &)=delete
virtual bool IsValid() const =0
virtual Status Close()=0
virtual WaitableHandle GetWaitableHandle()=0
IOObject(FDType type)
Definition IOObject.h:33
virtual Status Read(void *buf, size_t &num_bytes)=0
virtual Status Write(const void *buf, size_t &num_bytes)=0
static const WaitableHandle kInvalidHandleValue
Definition IOObject.h:31
const IOObject & operator=(const IOObject &)=delete
lldb::file_t WaitableHandle
Definition IOObject.h:29
FDType GetFdType() const
Definition IOObject.h:41
An error handling class.
Definition Status.h:118
A class that represents a running process on the host machine.
int file_t
Definition lldb-types.h:59