DebugServer2
Loading...
Searching...
No Matches
QueueChannel.h
1//
2// Copyright (c) 2014-present, Facebook, Inc.
3// All rights reserved.
4//
5// This source code is licensed under the University of Illinois/NCSA Open
6// Source License found in the LICENSE file in the root directory of this
7// source tree. An additional grant of patent rights can be found in the
8// PATENTS file in the same directory.
9//
10
11#pragma once
12
13#include "DebugServer2/Core/MessageQueue.h"
14#include "DebugServer2/Host/Channel.h"
15#include "DebugServer2/Types.h"
16
17#include <string>
18
19namespace ds2 {
20namespace Host {
21
22class QueueChannel : public Channel {
23public:
24 Channel *_remote;
25 MessageQueue _queue;
26
27public:
28 QueueChannel(Channel *remote);
29 ~QueueChannel() override;
30
31public:
32 inline Channel *remote() const {
33 return const_cast<QueueChannel *>(this)->_remote;
34 }
35 inline MessageQueue &queue() const {
36 return const_cast<QueueChannel *>(this)->_queue;
37 }
38
39public:
40 void close() override;
41
42public:
43 bool connected() const override;
44
45public:
46 bool wait(int ms = -1) override;
47
48public:
49 ssize_t send(void const *buffer, size_t length) override;
50 ssize_t receive(void *buffer, size_t length) override;
51
52public:
53 bool receive(std::string &buffer) override;
54};
55} // namespace Host
56} // namespace ds2
Definition Channel.h:18
Definition QueueChannel.h:22
Definition MessageQueue.h:22