本文整理汇总了C++中msgpack::packer类的典型用法代码示例。如果您正苦于以下问题:C++ packer类的具体用法?C++ packer怎么用?C++ packer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了packer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pack
void compressive_storage::pack(
msgpack::packer<msgpack::sbuffer>& packer) const {
packer.pack_array(4);
packer.pack(static_cast<const storage&>(*this));
packer.pack(mine_);
packer.pack(status_);
packer.pack(*compressor_);
}
示例2: pack
static inline
void
pack(msgpack::packer<Stream>& target, const raft::log_entry<StateMachine>& source) {
target.pack_array(2);
target << source.term();
type_traits<value_type>::pack(target, source.value());
}
示例3: pack
static inline
void
pack(msgpack::packer<Stream>& packer, const Json::Value& source) {
switch(source.type()) {
case Json::objectValue: {
packer.pack_map(source.size());
const Json::Value::Members keys(source.getMemberNames());
for(auto it = keys.begin(); it != keys.end(); ++it) {
packer << *it;
pack(packer, source[*it]);
}
} break;
case Json::arrayValue: {
packer.pack_array(source.size());
for(auto it = source.begin(); it != source.end(); ++it) {
pack(packer, *it);
}
} break;
case Json::booleanValue: {
packer << source.asBool();
} break;
case Json::stringValue: {
packer << source.asString();
} break;
case Json::realValue: {
packer << source.asDouble();
} break;
case Json::intValue: {
packer << source.asLargestInt();
} break;
case Json::uintValue: {
packer << source.asLargestUInt();
} break;
case Json::nullValue: {
packer << msgpack::type::nil();
}}
}
示例4: msgpack_pack
void Settings::msgpack_pack(msgpack::packer<msgpack::sbuffer> &pk) const
{
Json::Value json;
toJson(json);
std::ostringstream os(std::ios_base::binary);
os << json;
pk.pack(os.str());
}
示例5: pack
static inline
void
pack(msgpack::packer<Stream>& target, const std::vector<T>& source) {
target.pack_array(source.size());
for(auto it = source.begin(); it != source.end(); ++it) {
type_traits<T>::pack(target, *it);
}
}
示例6: pack
static inline
void
pack(msgpack::packer<Stream>& packer,
const unique_id_t& source)
{
packer.pack_array(2);
packer << source.uuid[0];
packer << source.uuid[1];
}
示例7: pack
static inline
void
pack(msgpack::packer<Stream>& packer,
const unique_id_t& object)
{
packer.pack_array(2);
packer << object.uuid[0];
packer << object.uuid[1];
}
示例8: pack
static inline
void
pack(msgpack::packer<Stream>& packer,
const api::policy_t& source)
{
packer.pack_array(3);
packer << source.urgent;
packer << source.timeout;
packer << source.deadline;
}
示例9: msgpack_pack
void TileDef::msgpack_pack(msgpack::packer<msgpack::sbuffer> &pk) const
{
pk.pack_map(8);
PACK(TILEDEF_NAME, name);
PACK(TILEDEF_ANIMATION_TYPE, (int)animation.type);
PACK(TILEDEF_ANIMATION_ASPECT_W, animation.aspect_w);
PACK(TILEDEF_ANIMATION_ASPECT_H, animation.aspect_h);
PACK(TILEDEF_ANIMATION_LENGTH, animation.length);
PACK(TILEDEF_BACKFACE_CULLING, backface_culling);
PACK(TILEDEF_TILEABLE_VERTICAL, tileable_vertical);
PACK(TILEDEF_TILEABLE_HORIZONTAL, tileable_horizontal);
}
示例10: msgpack_pack
void PointedThing::msgpack_pack(msgpack::packer<msgpack::sbuffer> &pk) const {
static int sizes[3] = {1, 3, 2};
int t = static_cast<int>(type);
pk.pack_map(sizes[t]);
PACK(POINTEDTHING_TYPE, t);
switch (type) {
case POINTEDTHING_NOTHING:
break;
case POINTEDTHING_NODE:
PACK(POINTEDTHING_UNDER, node_undersurface);
PACK(POINTEDTHING_ABOVE, node_abovesurface);
break;
case POINTEDTHING_OBJECT:
PACK(POINTEDTHING_OBJECT_ID, object_id);
break;
}
}
示例11: save
void Chunk::save(msgpack::packer<Poco::DeflatingOutputStream>& o) const
{
const bool has_meshes = false;
uint32_t array_size = 3;
if(has_meshes) array_size += 1;
o.pack_array(array_size);
const bool is_solid = this->solid_block != nullptr;
o.pack(is_solid);
if(is_solid)
{
o.pack(this->solid_block);
}
else
{
o.pack(this->blocks);
}
o.pack(has_meshes);
if(has_meshes)
{
o.pack(this->get_meshes());
}
}
示例12:
void Server::Unit::serialize(msgpack::packer<msgpack::sbuffer>& packet) const
{
packet.pack(_data);
packet.pack(this->getPhysics());
}
示例13: pack
void pack(msgpack::packer<msgpack::sbuffer>& packer) const {
packer.pack_array(mixables_.size());
for (size_t i = 0; i < mixables_.size(); ++i) {
mixables_[i]->pack(packer);
}
}
示例14: pack
static void pack(
msgpack::packer<Stream>& o,
const Tuple& v) {
StdTuplePacker<Stream, Tuple, N-1>::pack(o, v);
o.pack(std::get<N-1>(v));
}
示例15: pack
void local_storage::pack(msgpack::packer<msgpack::sbuffer>& packer) const {
packer.pack(*this);
}