序列化后如何抓取字节数组?
How to grab byte array after serialization?
我正在使用 Google 的 Flatbuffer。我为 C++ 创建了一个简单的模式,它只将名称和 ID 作为字段。通过 CreateDetails() 函数创建自动生成的代码和 运行 字段后,如何让字节数组传递到 ActiveMQ?我四处搜索,但找不到太多关于字节数组的信息。
我的架构:
table details {
name:string;
id: int;
};
root_type details;
我的 .cpp 应用程序:
auto name = builder.CreateString("some text here");
auto id = 25;
auto detail = CreateDetails(builder, name, id);
builder.Finish(detail);
现在,根据我的理解,示例消息应该被序列化,但我不确定如何将序列化数据作为字节数组获取。我能够访问根并沿着树向下查看数据,但我想将整个消息作为字节数组获取。
拜托,谢谢!
builder.GetBufferPointer()
builder.GetSize()
我正在使用 Google 的 Flatbuffer。我为 C++ 创建了一个简单的模式,它只将名称和 ID 作为字段。通过 CreateDetails() 函数创建自动生成的代码和 运行 字段后,如何让字节数组传递到 ActiveMQ?我四处搜索,但找不到太多关于字节数组的信息。
我的架构:
table details {
name:string;
id: int;
};
root_type details;
我的 .cpp 应用程序:
auto name = builder.CreateString("some text here");
auto id = 25;
auto detail = CreateDetails(builder, name, id);
builder.Finish(detail);
现在,根据我的理解,示例消息应该被序列化,但我不确定如何将序列化数据作为字节数组获取。我能够访问根并沿着树向下查看数据,但我想将整个消息作为字节数组获取。
拜托,谢谢!
builder.GetBufferPointer()
builder.GetSize()