本文整理汇总了C++中NodeID::__set_count方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeID::__set_count方法的具体用法?C++ NodeID::__set_count怎么用?C++ NodeID::__set_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeID
的用法示例。
在下文中一共展示了NodeID::__set_count方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findSucc
void findSucc(NodeID& _return, const std::string& key) {
NodeID pred;
findPred(pred, key);
if (pred.id == current.id)
{
_return = successor;
_return.__set_count(pred.count);
return;
}
shared_ptr<DHTNodeClient> client(connectClientAgency(pred.ip, pred.port));
client->getNodeSucc(_return);
_return.__set_count(pred.count);
}
示例2: findPred
void findPred(NodeID& _return, const std::string& key) {
string left = current.id;
string middle = key;
string right = successor.id;
/*
bool flag;
flag = right > left ? (middle > left && middle <= right)
: ((middle > left && middle > right) ||
(middle < left && middle <= right));
**/
if (keyCompare(current.id, key, successor.id)) {
_return = current;
_return.__set_count(0);
return ;
}
for(int i = 255; i >= 0; i--) {
if (ftable[i].id.empty()) continue;
if (keyCompare(current.id, ftable[i].id, key)) {
boost::shared_ptr<TSocket> socket(new TSocket(ftable[i].ip.c_str(),
ftable[i].port));
boost::shared_ptr<TTransport> transport(new TBufferedTransport(socket));
boost::shared_ptr<TProtocol> protocol(new TBinaryProtocol(transport));
boost::shared_ptr<DHTNodeClient> client(new DHTNodeClient(protocol));
transport->open();
try {
client->findPred(_return, key);
} catch (...) {
client = boost::shared_ptr<DHTNodeClient>();
transport->close();
}
transport->close();
_return.__set_count(_return.count + 1);
return ;
}
}
assert(false);
}