当前位置: 首页>>代码示例>>C++>>正文


C++ Name::appendNumber方法代码示例

本文整理汇总了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;
}
开发者ID:cawka,项目名称:NFD,代码行数:29,代码来源:cs-benchmark.cpp

示例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;
		};
开发者ID:hult1989,项目名称:ndn-client-server,代码行数:44,代码来源:testServer.cpp

示例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);
  }
}
开发者ID:bruinfish,项目名称:ChronoSync,代码行数:19,代码来源:logic.cpp


注:本文中的Name::appendNumber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。