36 bool Serialize(
const std::shared_ptr<T> &proto,
const std::string &msg_name);
39 return frames_[index].buf_;
43 return frames_[index].buf_len_;
53 std::vector<Buf> frames_;
58 for (
auto frame : frames_) {
65 const std::string &msg_name) {
66 bsize msg_len =
static_cast<bsize>(proto->ByteSizeLong());
67 char *tmp =
new char[msg_len]();
68 if (!proto->SerializeToArray(tmp, static_cast<int>(msg_len))) {
73 bsize frame_index = 0;
74 uint32_t total_frames =
static_cast<uint32_t
>(msg_len /
FRAME_SIZE +
77 while (offset < msg_len) {
84 header.
SetMsgID(proto->header().sequence_num());
93 buf.buf_ =
new char[cpy_size + header_size];
94 buf.buf_len_ = cpy_size + header_size;
96 memcpy(buf.buf_ + header_size, tmp + frame_index * FRAME_SIZE, cpy_size);
97 frames_.push_back(buf);
const char * GetSerializedBuf(size_t index) const
Definition: bridge_proto_serialized_buf.h:38
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
char * GetFrame(size_t index)
bool Serialize(const std::shared_ptr< T > &proto, const std::string &msg_name)
Definition: bridge_proto_serialized_buf.h:64
uint32_t bsize
Definition: bridge_header_item.h:24
Definition: bridge_proto_serialized_buf.h:30
size_t GetSerializedBufCount() const
Definition: bridge_proto_serialized_buf.h:41
#define FREE_ARRY(arry)
Definition: macro.h:24
BridgeProtoSerializedBuf()
Definition: bridge_proto_serialized_buf.h:32
~BridgeProtoSerializedBuf()
Definition: bridge_proto_serialized_buf.h:57
size_t GetSerializedBufSize(size_t index) const
Definition: bridge_proto_serialized_buf.h:42
constexpr uint32_t FRAME_SIZE
Definition: macro.h:36
uint32_t hsize
Definition: bridge_header.h:27