本文整理汇总了C++中Inventory::serialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Inventory::serialize方法的具体用法?C++ Inventory::serialize怎么用?C++ Inventory::serialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::serialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendDetachedInventory
void Server::sendDetachedInventory(const std::string &name, u16 peer_id)
{
if(m_detached_inventories.count(name) == 0){
errorstream<<FUNCTION_NAME<<": \""<<name<<"\" not found"<<std::endl;
return;
}
Inventory *inv = m_detached_inventories[name];
std::ostringstream os(std::ios_base::binary);
inv->serialize(os);
MSGPACK_PACKET_INIT(TOCLIENT_DETACHED_INVENTORY, 2);
PACK(TOCLIENT_DETACHED_INVENTORY_NAME, name);
PACK(TOCLIENT_DETACHED_INVENTORY_DATA, os.str());
if (peer_id != PEER_ID_INEXISTENT)
{
// Send as reliable
m_clients.send(peer_id, 0, buffer, true);
}
else
{
m_clients.sendToAll(0,buffer,true);
}
}
示例2: serializeBody
void FurnaceNodeMetadata::serializeBody(std::ostream &os)
{
m_inventory->serialize(os);
os<<itos(m_fuel_totaltime*10)<<" ";
os<<itos(m_fuel_time*10)<<" ";
os<<itos(m_src_totaltime*10)<<" ";
os<<itos(m_src_time*10)<<" ";
os<<serializeJsonString(m_infotext);
}