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


C++ Name类代码示例

本文整理汇总了C++中Name的典型用法代码示例。如果您正苦于以下问题:C++ Name类的具体用法?C++ Name怎么用?C++ Name使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Name类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

void
CertificateCacheTtl::remove(const Name& certificateName)
{
  Name name = certificateName.getPrefix(-1);
  Cache::iterator it = m_cache.find(name);
  if (it != m_cache.end())
    m_cache.erase(it);
}
开发者ID:nsol-nmsu,项目名称:ndn-cxx,代码行数:8,代码来源:certificate-cache-ttl.cpp

示例2: computeHash

// Interface of different hash functions
size_t
computeHash(const Name& prefix)
{
  prefix.wireEncode();  // guarantees prefix's wire buffer is not empty

  size_t hashValue = 0;
  size_t hashUpdate = 0;

  for (Name::const_iterator it = prefix.begin(); it != prefix.end(); it++)
    {
      const char* wireFormat = reinterpret_cast<const char*>( it->wire() );
      hashUpdate = CityHash::compute(wireFormat, it->size());
      hashValue ^= hashUpdate;
    }

  return hashValue;
}
开发者ID:danposch,项目名称:NFD,代码行数:18,代码来源:name-tree.cpp

示例3: HELIUM_TRACE

bool Helium::AssetIdentifier::Identify( Reflect::Object* object, Name& identity )
{
	Asset *pAsset = Reflect::SafeCast<Asset>(object);

	if ( pAsset )
	{
		identity.Set(pAsset->GetPath().ToString());
		HELIUM_TRACE( TraceLevels::Info, TXT( "Identifying object [%s]\n" ), identity.Get() );
		return true;
	}
	else if ( object )
	{
		HELIUM_TRACE( TraceLevels::Info, TXT( "Deferring identification of object of type [%s]\n" ), object->GetMetaClass()->m_Name );
	}

	return false;
}
开发者ID:justinliew,项目名称:Helium,代码行数:17,代码来源:AssetLoader.cpp

示例4: remove

void
FilePrivateKeyStorage::deleteKeyPair(const Name& keyName)
{
  string keyUri = keyName.toUri();

  remove(nameTransform(keyUri, ".pub").c_str());
  remove(nameTransform(keyUri, ".pri").c_str());
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例5: producerDeniedRequest

 void producerDeniedRequest( const Name& producer_name,
                             const Name& request_name,
                             const string& why )
 {
      if( logging_enabled )
      {
          lock.lock();
          log_file << "Producer:Denied" << endl
                   << "{" << endl
                   << "    time     = " <<  time::system_clock::now() << endl
                   << "    producer = " << producer_name.toUri() << endl
                   << "    request  = " << request_name.toUri() << endl
                   << "    why      = " << why << endl
                   << "}" << endl;
          lock.unlock();
      }
 }
开发者ID:raystubbs,项目名称:NMSU-BigData-REU-NDN-Access-Control-Simulation,代码行数:17,代码来源:Coordinator.cpp

示例6: _LOG_ERROR

ActionItemPtr
ActionLog::AddRemoteAction(shared_ptr<Data> actionData)
{
  Name name = actionData->getName();
  // action name: /<device_name>/<appname>/action/<shared-folder>/<action-seq>

  uint64_t seqno = name.get(-1).toNumber();
  std::string sharedFolder = name.get(-2).toUri();

  if (sharedFolder != m_sharedFolderName) {
    _LOG_ERROR("Action doesn't belong to this shared folder");
    return ActionItemPtr();
  }

  if (name.get(-3).toUri() != "action") {
    _LOG_ERROR("not an action");
    return ActionItemPtr();
  }

  if (name.get(-4) != m_appName) {
    _LOG_ERROR("Action doesn't belong to this application");
    return ActionItemPtr();
  }

  Name deviceName = name.getSubName(0, name.size() - 4);

  _LOG_DEBUG("From [" << name << "] extracted deviceName: " << deviceName << ", sharedFolder: "
                      << sharedFolder
                      << ", seqno: "
                      << seqno);

  return AddRemoteAction(deviceName, seqno, actionData);
}
开发者ID:named-data,项目名称:ChronoShare,代码行数:33,代码来源:action-log.cpp

示例7: type_id_of

SceneTypeId SceneRegistry::type_id_of(Name type_name)
{
    auto it = _type_name_to_id.find(type_name);
    if (it == _type_name_to_id.end())
    {
        throw InvalidOperation(format("Unknown scene type '%s'", type_name.data()));
    }
    return it->second;
}
开发者ID:colinhect,项目名称:hect,代码行数:9,代码来源:SceneRegistry.cpp

示例8:

void
Tracer::onReceive(const Name& name)
{
    if (m_options.shouldPrintTimestamp) {
        std::cout << time::toIsoString(time::system_clock::now())  << " - ";
    }

    std::cout << "interest received: seq=" << name.at(-1).toUri() << std::endl;
}
开发者ID:shockjiang,项目名称:ndn-tools,代码行数:9,代码来源:tracer.cpp

示例9:

void
MemoryIdentityStorage::addIdentity(const Name& identityName)
{
  string identityUri = identityName.toUri();
  if (find(identityStore_.begin(), identityStore_.end(), identityUri) != identityStore_.end())
    return;

  identityStore_.push_back(identityUri);
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例10:

void
SecPublicInfoMemory::addIdentity(const Name& identityName)
{
  string identityUri = identityName.toUri();
  if (find(m_identityStore.begin(), m_identityStore.end(), identityUri) != m_identityStore.end())
    return;

  m_identityStore.push_back(identityUri);
}
开发者ID:PatrickGuo,项目名称:ndn-cxx-master,代码行数:9,代码来源:sec-public-info-memory.cpp

示例11: handleBreakTarget

 void handleBreakTarget(Name& name) {
   if (name.is()) {
     if (branchesSeen.find(name) == branchesSeen.end()) {
       name = Name();
     } else {
       branchesSeen.erase(name);
     }
   }
 }
开发者ID:aheejin,项目名称:binaryen,代码行数:9,代码来源:RemoveUnusedNames.cpp

示例12: Error

void
SecPublicInfoMemory::addIdentity(const Name& identityName)
{
  string identityUri = identityName.toUri();
  if (find(identityStore_.begin(), identityStore_.end(), identityUri) != identityStore_.end())
    throw Error("Identity already exists: " + identityUri);
  
  identityStore_.push_back(identityUri);
}
开发者ID:ltr120,项目名称:ndn-cpp,代码行数:9,代码来源:sec-public-info-memory.cpp

示例13:

ConstBufferPtr
SecTpmFile::exportPrivateKeyPkcs8FromTpm(const Name& keyName)
{
  OBufferStream privateKeyOs;
  CryptoPP::FileSource(m_impl->transformName(keyName.toUri(), ".pri").string().c_str(), true,
                       new CryptoPP::Base64Decoder(new CryptoPP::FileSink(privateKeyOs)));

  return privateKeyOs.buf();
}
开发者ID:named-data-ndnSIM,项目名称:ndn-cxx,代码行数:9,代码来源:sec-tpm-file.cpp

示例14: xl_enter_prefix

void xl_enter_prefix(Context *context, text name, native_fn fn, Tree *rtype,
                     TreeList &parameters, text symbol, text doc)
// ----------------------------------------------------------------------------
//   Enter a prefix into the context (called from .tbl files)
// ----------------------------------------------------------------------------
{
    if (parameters.size())
    {
        Tree *parmtree = xl_parameters_tree(parameters);
        Prefix *from = new Prefix(new Name(symbol), parmtree);
        Name *to = new Name(symbol);

        Rewrite *rw = context->Define(from, to);
        rw->native = fn;
        rw->type = rtype;

        Symbols *s = MAIN->globals;
        Rewrite *rw2 = s->EnterRewrite(from, to);
        rw2->type = rtype;
        to->code = fn;
        to->SetSymbols(s);
        xl_enter_builtin(MAIN, name, to, rw2->parameters, fn);

        xl_set_documentation(from, doc);
    }
    else
    {
        Name *n  = new Name(symbol);
        n->SetInfo<PrefixDefinitionsInfo>(new PrefixDefinitionsInfo());
        Rewrite *rw = context->Define(n, n);
        rw->native = fn;
        rw->type = rtype;

        Symbols *s = MAIN->globals;
        Rewrite *rw2 = s->EnterName(symbol, n, Rewrite::GLOBAL);
        rw2->type = rtype;
        n->code = fn;
        n->SetSymbols(s);
        TreeList noparms;
        xl_enter_builtin(MAIN, name, n, noparms, fn);

        xl_set_documentation(n, doc);
    }
}
开发者ID:c3d,项目名称:XL-programming-language,代码行数:44,代码来源:opcodes.cpp

示例15: NdnServer

		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


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