Ejemplo n.º 1
0
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_);
}
Ejemplo n.º 2
0
 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());
 }
Ejemplo n.º 3
0
    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();
        }}
    }
Ejemplo n.º 4
0
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());
}
Ejemplo n.º 5
0
    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);
        }
    }
Ejemplo n.º 6
0
    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];
    }
Ejemplo n.º 7
0
    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];
    }
Ejemplo n.º 8
0
    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;
    }
Ejemplo n.º 9
0
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);
}
Ejemplo n.º 10
0
// map of content features, key = id, value = ContentFeatures
void CNodeDefManager::msgpack_pack(msgpack::packer<msgpack::sbuffer> &pk) const
{
	std::vector<std::pair<int, const ContentFeatures*> > features_to_pack;
	for (size_t i = 0; i < m_content_features.size(); ++i) {
		if (i == CONTENT_IGNORE || i == CONTENT_AIR || i == CONTENT_UNKNOWN || m_content_features[i].name == "")
			continue;
		features_to_pack.push_back(std::make_pair(i, &m_content_features[i]));
	}
	pk.pack_map(features_to_pack.size());
	for (size_t i = 0; i < features_to_pack.size(); ++i)
		PACK(features_to_pack[i].first, *features_to_pack[i].second);
}
Ejemplo n.º 11
0
void ContentFeatures::msgpack_pack(msgpack::packer<msgpack::sbuffer> &pk) const
{
	pk.pack_map(38);
	PACK(CONTENTFEATURES_NAME, name);
	PACK(CONTENTFEATURES_GROUPS, groups);
	PACK(CONTENTFEATURES_DRAWTYPE, (int)drawtype);
	PACK(CONTENTFEATURES_VISUAL_SCALE, visual_scale);

	pk.pack((int)CONTENTFEATURES_TILEDEF);
	pk.pack_array(6);
	for (size_t i = 0; i < 6; ++i)
		pk.pack(tiledef[i]);

	pk.pack((int)CONTENTFEATURES_TILEDEF_SPECIAL);
	pk.pack_array(CF_SPECIAL_COUNT);
	for (size_t i = 0; i < CF_SPECIAL_COUNT; ++i)
		pk.pack(tiledef_special[i]);

	PACK(CONTENTFEATURES_ALPHA, alpha);
	PACK(CONTENTFEATURES_POST_EFFECT_COLOR, post_effect_color);
	PACK(CONTENTFEATURES_PARAM_TYPE, (int)param_type);
	PACK(CONTENTFEATURES_PARAM_TYPE_2, (int)param_type_2);
	PACK(CONTENTFEATURES_IS_GROUND_CONTENT, is_ground_content);
	PACK(CONTENTFEATURES_LIGHT_PROPAGATES, light_propagates);
	PACK(CONTENTFEATURES_SUNLIGHT_PROPAGATES, sunlight_propagates);
	PACK(CONTENTFEATURES_WALKABLE, walkable);
	PACK(CONTENTFEATURES_POINTABLE, pointable);
	PACK(CONTENTFEATURES_DIGGABLE, diggable);
	PACK(CONTENTFEATURES_CLIMBABLE, climbable);
	PACK(CONTENTFEATURES_BUILDABLE_TO, buildable_to);
	PACK(CONTENTFEATURES_LIQUID_TYPE, (int)liquid_type);
	PACK(CONTENTFEATURES_LIQUID_ALTERNATIVE_FLOWING, liquid_alternative_flowing);
	PACK(CONTENTFEATURES_LIQUID_ALTERNATIVE_SOURCE, liquid_alternative_source);
	PACK(CONTENTFEATURES_LIQUID_VISCOSITY, liquid_viscosity);
	PACK(CONTENTFEATURES_LIQUID_RENEWABLE, liquid_renewable);
	PACK(CONTENTFEATURES_LIGHT_SOURCE, light_source);
	PACK(CONTENTFEATURES_DAMAGE_PER_SECOND, damage_per_second);
	PACK(CONTENTFEATURES_NODE_BOX, node_box);
	PACK(CONTENTFEATURES_SELECTION_BOX, selection_box);
	PACK(CONTENTFEATURES_LEGACY_FACEDIR_SIMPLE, legacy_facedir_simple);
	PACK(CONTENTFEATURES_LEGACY_WALLMOUNTED, legacy_wallmounted);
	PACK(CONTENTFEATURES_SOUND_FOOTSTEP, sound_footstep);
	PACK(CONTENTFEATURES_SOUND_DIG, sound_dig);
	PACK(CONTENTFEATURES_SOUND_DUG, sound_dug);
	PACK(CONTENTFEATURES_RIGHTCLICKABLE, rightclickable);
	PACK(CONTENTFEATURES_DROWNING, drowning);
	PACK(CONTENTFEATURES_LEVELED, leveled);
	PACK(CONTENTFEATURES_WAVING, waving);
	PACK(CONTENTFEATURES_MESH, mesh);
	PACK(CONTENTFEATURES_COLLISION_BOX, collision_box);
}
Ejemplo n.º 12
0
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;
	}
}
Ejemplo n.º 13
0
void NodeBox::msgpack_pack(msgpack::packer<msgpack::sbuffer> &pk) const
{
	int map_size = 1;
	if (type == NODEBOX_FIXED || type == NODEBOX_LEVELED)
		map_size = 2;
	else if (type == NODEBOX_WALLMOUNTED)
		map_size = 4;

	pk.pack_map(map_size);
	PACK(NODEBOX_S_TYPE, (int)type);

	if(type == NODEBOX_FIXED || type == NODEBOX_LEVELED)
		PACK(NODEBOX_S_FIXED, fixed)
	else if(type == NODEBOX_WALLMOUNTED) {
		PACK(NODEBOX_S_WALL_TOP, wall_top);
		PACK(NODEBOX_S_WALL_BOTTOM, wall_bottom);
		PACK(NODEBOX_S_WALL_SIDE, wall_side);
	}
}
Ejemplo n.º 14
0
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());
	}
}
Ejemplo n.º 15
0
void	Server::Unit::serialize(msgpack::packer<msgpack::sbuffer>& packet) const
{
  packet.pack(_data);
  packet.pack(this->getPhysics());
}
Ejemplo n.º 16
0
 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);
   }
 }
Ejemplo n.º 17
0
 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));
 }
Ejemplo n.º 18
0
 static void pack (
     msgpack::packer<Stream>& o,
     const Tuple& v) {
     o.pack(std::get<0>(v));
 }
Ejemplo n.º 19
0
void local_storage::pack(msgpack::packer<msgpack::sbuffer>& packer) const {
  packer.pack(*this);
}
void sparse_matrix_storage::pack(msgpack::packer<msgpack::sbuffer>& packer)
    const {
  packer.pack(*this);
}
Ejemplo n.º 21
0
void simple_storage::pack(msgpack::packer<msgpack::sbuffer>& packer) const {
  packer.pack_array(2);
  packer.pack(static_cast<const storage&>(*this));
  packer.pack(mine_);
}
void recommender_mock_storage::pack(
    msgpack::packer<msgpack::sbuffer>& packer) const {
  packer.pack(*this);
}
Ejemplo n.º 23
0
 void msgpack_pack(msgpack::packer<Buffer>& packer) const {
   packer.pack_array(2);
   packer.pack(static_cast<uint8_t>(type_));
   packer.pack(static_cast<uint64_t>(bit_vector_length_));
 }
void inverted_index_storage::pack(
    msgpack::packer<msgpack::sbuffer>& packer) const {
  packer.pack(*this);
}
Ejemplo n.º 25
0
 void pack(msgpack::packer<Buffer>& packer) const {
   packer.pack(*this);
 }