本文整理汇总了C++中Packer::packStr方法的典型用法代码示例。如果您正苦于以下问题:C++ Packer::packStr方法的具体用法?C++ Packer::packStr怎么用?C++ Packer::packStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packer
的用法示例。
在下文中一共展示了Packer::packStr方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Message
Message * Topology::packMsg()
{
Packer packer;
packer.packInt(agentID);
packer.packInt(fanOut);
packer.packInt(level);
packer.packInt(height);
packer.packStr(bePath);
packer.packStr(agentPath);
BEMap::iterator it;
packer.packInt(beMap.size());
for (it = beMap.begin(); it != beMap.end(); ++it) {
packer.packInt((*it).first);
packer.packStr((*it).second);
}
char *bufs[1];
int sizes[1];
bufs[0] = packer.getPackedMsg();
sizes[0] = packer.getPackedMsgLen();
Message *msg = new Message(Message::CONFIG);
msg->build(SCI_FILTER_NULL, SCI_GROUP_ALL, 1, bufs, sizes, Message::CONFIG);
delete [] bufs[0];
return msg;
}
示例2: Message
Message * Filter::packMsg()
{
Packer packer;
packer.packInt(info.filter_id);
packer.packStr(info.so_file);
char *bufs[1];
int sizes[1];
bufs[0] = packer.getPackedMsg();
sizes[0] = packer.getPackedMsgLen();
Message *msg = new Message();
msg->build(info.filter_id, SCI_GROUP_ALL, 1, bufs, sizes, Message::FILTER_LOAD);
delete [] bufs[0];
return msg;
}
示例3: SCI_BE_add
int SCI_BE_add(sci_be_t *be)
{
if (gCtrlBlock->getMyRole() == CtrlBlock::INVALID)
return SCI_ERR_UNINTIALIZED;
if (gCtrlBlock->getMyRole() != CtrlBlock::FRONT_END)
return SCI_ERR_INVALID_CALLER;
if (be->id >= 0) { // user-assigned back end id
if (gCtrlBlock->getTopology()->hasBE(be->id))
return SCI_ERR_BACKEND_EXISTED;
} else { // SCI allocated back end id
gAllocator->allocateBE(&(be->id));
}
int msgID;
try {
Packer packer;
packer.packStr(be->hostname);
packer.packInt(be->level);
char *bufs[1];
int sizes[1];
bufs[0] = packer.getPackedMsg();
sizes[0] = packer.getPackedMsgLen();
Message *msg = new Message();
msgID = gNotifier->allocate();
msg->build(SCI_FILTER_NULL, (sci_group_t) (be->id), 1, bufs, sizes, Message::BE_ADD, msgID);
delete [] bufs[0];
gCtrlBlock->getRouterInQueue()->produce(msg);
} catch (std::bad_alloc) {
return SCI_ERR_NO_MEM;
}
int rc;
gNotifier->freeze(msgID, &rc);
return rc;
}