• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //
2 // Copyright © 2019 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
8 #include <memory>
9 
10 namespace arm
11 {
12 
13 namespace pipe
14 {
15 
16 class IReadOnlyPacketBuffer // interface used by the read thread
17 {
18 public:
~IReadOnlyPacketBuffer()19     virtual ~IReadOnlyPacketBuffer() {}
20 
21     virtual const unsigned char* GetReadableData() const = 0;
22 
23     virtual unsigned int GetSize() const = 0;
24 
25     virtual void MarkRead() = 0;
26 };
27 
28 class IPacketBuffer : public IReadOnlyPacketBuffer // interface used by code that writes binary packets
29 {
30 public:
~IPacketBuffer()31     virtual ~IPacketBuffer() {}
32 
33     virtual void Commit(unsigned int size) = 0;
34 
35     virtual void Release() = 0;
36 
37     virtual unsigned char* GetWritableData() = 0;
38 
39     /// release the memory held and reset internal point to null.
40     /// After this function is invoked the PacketBuffer is unusable.
41     virtual void Destroy() = 0;
42 };
43 
44 using IPacketBufferPtr = std::unique_ptr<IPacketBuffer>;
45 
46 } // namespace pipe
47 
48 } // namespace arm
49