本文整理汇总了C++中Name::appendNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Name::appendNumber方法的具体用法?C++ Name::appendNumber怎么用?C++ Name::appendNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Name
的用法示例。
在下文中一共展示了Name::appendNumber方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeInterestWorkload
// find(rightmost) hit
BOOST_FIXTURE_TEST_CASE(Rightmost, CsBenchmarkFixture)
{
constexpr size_t N_CHILDREN = 10;
constexpr size_t N_INTERESTS = CS_CAPACITY / N_CHILDREN;
constexpr size_t REPEAT = 4;
std::vector<shared_ptr<Interest>> interestWorkload = makeInterestWorkload(N_INTERESTS);
for (auto&& interest : interestWorkload) {
interest->setChildSelector(1);
for (size_t j = 0; j < N_CHILDREN; ++j) {
Name name = interest->getName();
name.appendNumber(j);
shared_ptr<Data> data = makeData(name);
cs.insert(*data, false);
}
}
BOOST_REQUIRE(cs.size() == N_INTERESTS * N_CHILDREN);
time::microseconds d = timedRun([&] {
for (size_t j = 0; j < REPEAT; ++j) {
for (const auto& interest : interestWorkload) {
find(*interest);
}
}
});
std::cout << "find(rightmost) " << (N_INTERESTS * N_CHILDREN * REPEAT) << ": " << d << std::endl;
}
示例2: fin
NdnServer(std::string fileName, size_t segSize, size_t contentsize, int signORnot){
using namespace std;
isSign = signORnot;
ifstream fin(fileName.c_str(), fstream::binary);
fin.seekg(0, fin.end);
m_FileSize = fin.tellg();
fin.seekg(0, fin.beg);
fin.read(fileBuffer, m_FileSize);
fin.close();
m_SegmentSize = segSize * 1024;
m_ContentSize = contentsize * 1024;
m_TotalPacketNum = m_FileSize / m_ContentSize + 1;
cout << "Finish reading file\n";
std::cout << "Total file size:\t" << m_FileSize << std::endl ;
std::cout << "m_SegmentSize is:\t" << m_SegmentSize << std::endl ;
std::cout << "m_TotalSegNum is:\t" << m_FileSize / m_SegmentSize + 1 << std::endl ;
std::cout << "m_ContentSize is:\t" << m_ContentSize << std::endl ;
std::cout << "Total packet num is:\t" << m_FileSize / m_ContentSize + 1 << std::endl ;
timeval start, end;
gettimeofday(&start, 0);
for(int id = 0;id < m_TotalPacketNum; id++){
Name fileName = Name("askfile");
fileName.appendNumber(xxx);
fileName.appendSegment(1024);
fileName.appendSegmentOffset(id);
shared_ptr<Data> data = make_shared<Data>(fileName);
if(isSign == 1)
m_keyChain.sign(*data);
else
m_keyChain.signWithSha256(*data);
m_store.push_back(data);
if(id == m_TotalPacketNum - 1)
std::cout <<"Finish signing last datapacket\n";
}
gettimeofday(&end, 0);
double totalTime =(1000000.0 * (end.tv_sec - start.tv_sec) + end.tv_usec - start.tv_usec ) / 1000000;
std::cout << "Signing cost is:\t" << totalTime <<" s" << std::endl;
};
示例3: reset
void
Logic::addUserNode(const Name& userPrefix, const Name& signingId)
{
if (userPrefix == EMPTY_NAME)
return;
if (m_defaultUserPrefix == EMPTY_NAME) {
m_defaultUserPrefix = userPrefix;
m_defaultSigningId = signingId;
}
if (m_nodeList.find(userPrefix) == m_nodeList.end()) {
m_nodeList[userPrefix].userPrefix = userPrefix;
m_nodeList[userPrefix].signingId = signingId;
Name sessionName = userPrefix;
sessionName.appendNumber(ndn::time::toUnixTimestamp(ndn::time::system_clock::now()).count());
m_nodeList[userPrefix].sessionName = sessionName;
m_nodeList[userPrefix].seqNo = 0;
reset(false);
}
}