/****************************************************************************** 版权所有 (C), 2019-2029, SDC OS 开源软件小组所有 ****************************************************************************** 文 件 名 : proto_buffer.h 版 本 号 : 初稿 作 者 : athina 生成日期 : 2020年7月4日 最近修改 : 功能描述 : 消息数组封装 函数列表 : 修改历史 : 1.日 期 : 2020年7月4日 作 者 : athina 修改内容 : 创建文件 ******************************************************************************/ #ifndef __PROTO_STREAM_H__ #define __PROTO_STREAM_H__ #include #include namespace HWYolov3App { class ProtoBuffer { public: ProtoBuffer(void); virtual ~ProtoBuffer(void); size_t GetUsed(void) const; size_t GetSize(void) const; const uint8_t* GetData(void) const; bool Full(void) const; bool Empty(void) const; int32_t WriteBytes(const void *buf, size_t len); void Clear(void); friend ProtoBuffer& operator<<(ProtoBuffer &is, uint8_t i); friend ProtoBuffer& operator<<(ProtoBuffer &is, uint16_t i); friend ProtoBuffer& operator<<(ProtoBuffer &is, uint32_t i); friend ProtoBuffer& operator<<(ProtoBuffer &is, uint64_t i); friend ProtoBuffer& operator<<(ProtoBuffer &is, const std::string &s); private: static const int MAX_BUF_SIZE = 4096; typedef std::array Array; Array m_array; size_t m_used; }; } #endif /* __PROTO_STREAM_H__ */