本文整理汇总了C++中Packer::packInt方法的典型用法代码示例。如果您正苦于以下问题:C++ Packer::packInt方法的具体用法?C++ Packer::packInt怎么用?C++ Packer::packInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packer
的用法示例。
在下文中一共展示了Packer::packInt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SCI_Group_operate_ext
int SCI_Group_operate_ext(sci_group_t group, int num_bes, int *be_list,
sci_op_t op, sci_group_t *newgroup)
{
if (gCtrlBlock->getMyRole() == CtrlBlock::INVALID)
return SCI_ERR_UNINTIALIZED;
if (gCtrlBlock->getMyRole() != CtrlBlock::FRONT_END)
return SCI_ERR_INVALID_CALLER;
if (!gCtrlBlock->getRoutingList()->isGroupExist(group))
return SCI_ERR_GROUP_NOTFOUND;
assert(be_list);
for (int i=0; i<num_bes; i++) {
if (!gCtrlBlock->getTopology()->hasBE(be_list[i]))
return SCI_ERR_BACKEND_NOTFOUND;
}
int msgID;
try {
Packer packer;
packer.packInt((int) op);
packer.packInt((int) group);
packer.packInt(num_bes);
for (int i=0; i<num_bes; i++) {
packer.packInt(be_list[i]);
}
char *bufs[1];
int sizes[1];
bufs[0] = packer.getPackedMsg();
sizes[0] = packer.getPackedMsgLen();
msgID = gNotifier->allocate();
Message *msg = new Message();
gAllocator->allocateGroup(newgroup);
msg->build(SCI_FILTER_NULL, *newgroup, 1, bufs, sizes, Message::GROUP_OPERATE_EXT, 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;
}
示例2: SCI_Group_operate
int SCI_Group_operate(sci_group_t group1, sci_group_t group2,
sci_op_t op, sci_group_t *newgroup)
{
if (gCtrlBlock->getMyRole() == CtrlBlock::INVALID)
return SCI_ERR_UNINTIALIZED;
if (gCtrlBlock->getMyRole() != CtrlBlock::FRONT_END)
return SCI_ERR_INVALID_CALLER;
if (!gCtrlBlock->getRoutingList()->isGroupExist(group1))
return SCI_ERR_GROUP_NOTFOUND;
if (!gCtrlBlock->getRoutingList()->isGroupExist(group2))
return SCI_ERR_GROUP_NOTFOUND;
if ((op!=SCI_UNION) && (op!=SCI_INTERSECTION) && (op!=SCI_DIFFERENCE))
return SCI_ERR_INVALID_OPERATOR;
int msgID;
try {
Packer packer;
packer.packInt((int) op);
packer.packInt((int) group1);
packer.packInt((int) group2);
char *bufs[1];
int sizes[1];
bufs[0] = packer.getPackedMsg();
sizes[0] = packer.getPackedMsgLen();
msgID = gNotifier->allocate();
Message *msg = new Message();
gAllocator->allocateGroup(newgroup);
msg->build(SCI_FILTER_NULL, *newgroup, 1, bufs, sizes, Message::GROUP_OPERATE, 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;
}
示例3: 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;
}
示例4: 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;
}
示例5: 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;
}