blob: 3fa5c608fee70f67be32aa9ef49c4539288b978e [file] [log] [blame]
Narumol Prangnawarat7be47ef2019-09-27 18:00:11 +01001//
2// Copyright © 2019 Arm Ltd. All rights reserved.
3// SPDX-License-Identifier: MIT
4//
5
6#pragma once
7
8#include "IPacketBuffer.hpp"
9
10#include <memory>
11
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000012namespace arm
Narumol Prangnawarat7be47ef2019-09-27 18:00:11 +010013{
14
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000015namespace pipe
Narumol Prangnawarat7be47ef2019-09-27 18:00:11 +010016{
17
18class PacketBuffer : public IPacketBuffer
19{
20public:
21 PacketBuffer(unsigned int maxSize);
22
23 ~PacketBuffer() {}
24
Matteo Martincigh76c50d82019-11-21 12:10:42 +000025 const unsigned char* GetReadableData() const override;
Narumol Prangnawarat7be47ef2019-09-27 18:00:11 +010026
27 unsigned int GetSize() const override;
28
29 void MarkRead() override;
30
31 void Commit(unsigned int size) override;
32
33 void Release() override;
34
35 unsigned char* GetWritableData() override;
36
Jim Flynn0204f092020-06-22 20:41:43 +010037 void Destroy() override;
38
Narumol Prangnawarat7be47ef2019-09-27 18:00:11 +010039private:
40 unsigned int m_MaxSize;
41 unsigned int m_Size;
42 std::unique_ptr<unsigned char[]> m_Data;
43};
44
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000045} // namespace pipe
Narumol Prangnawarat7be47ef2019-09-27 18:00:11 +010046
Cathal Corbett5aa9fd72022-02-25 15:33:28 +000047} // namespace arm