1 // 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 12 namespace arm 13 { 14 15 namespace pipe 16 { 17 18 class PacketBuffer : public IPacketBuffer 19 { 20 public: 21 PacketBuffer(unsigned int maxSize); 22 ~PacketBuffer()23 ~PacketBuffer() {} 24 25 const unsigned char* GetReadableData() const override; 26 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 37 void Destroy() override; 38 39 private: 40 unsigned int m_MaxSize; 41 unsigned int m_Size; 42 std::unique_ptr<unsigned char[]> m_Data; 43 }; 44 45 } // namespace pipe 46 47 } // namespace arm 48