本文整理汇总了C++中std::multimap::find方法的典型用法代码示例。如果您正苦于以下问题:C++ multimap::find方法的具体用法?C++ multimap::find怎么用?C++ multimap::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类std::multimap
的用法示例。
在下文中一共展示了multimap::find方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteChildProcessEntry
void DebugInfoXmlWriter::WriteChildProcessEntry(const Debug::DebugeeInfo& debuggeeInfo, const std::multimap<DWORD, DWORD>& mmapChildProcesses, DWORD dwProcessId)
{
m_spWriter->WriteStartElement(_T("process"));
if (dwProcessId == 0)
m_spWriter->WriteAttributeString(_T("image-name"), _T("debugger"));
else
{
CString cszText; cszText.Format(_T("0x%08x"), dwProcessId);
m_spWriter->WriteAttributeString(_T("pid"), cszText);
if (debuggeeInfo.IsProcessInfoAvail(dwProcessId))
{
const Debug::ProcessInfo processInfo = debuggeeInfo.GetProcessInfo(dwProcessId);
m_spWriter->WriteAttributeString(_T("image-name"), processInfo.ImageName());
}
else
m_spWriter->WriteAttributeString(_T("image-name"), _T("unknown"));
}
m_spWriter->WriteStartElementEnd();
// find all child entries
std::multimap<DWORD, DWORD>::const_iterator iter = mmapChildProcesses.find(dwProcessId);
while (iter != mmapChildProcesses.end() && iter->first == dwProcessId)
{
WriteChildProcessEntry(debuggeeInfo, mmapChildProcesses, iter->second);
++iter;
}
m_spWriter->WriteEndElement();
}
示例2: GenerateConnections
void PatternLink::GenerateConnections( const std::multimap<lem::UCString,const Word_Form*> & points, SynPatternResult * cur_result ) const
{
typedef std::multimap<lem::UCString,const Word_Form*>::const_iterator IT;
IT it_from = points.find( from_marker );
if( it_from==points.end() )
{
lem::MemFormatter mem;
mem.printf( "Can not find node %us.%us to create link head", from_marker.c_str(), from_node.c_str() );
throw lem::E_BaseException( mem.string() );
}
const Word_Form * node0 = it_from->second;
std::pair<IT,IT> pit = points.equal_range( to_marker );
if( pit.first==points.end() && !optional_to_node )
{
lem::MemFormatter mem;
mem.printf( "Can not find node %us to create link tail", to_marker.c_str() );
throw lem::E_BaseException( mem.string() );
}
for( IT it=pit.first; it!=pit.second; ++it )
{
const Solarix::Word_Form * node1 = it->second;
PatternLinkEdge new_edge( node0, link_type, node1 );
cur_result->AddLinkageEdge( new_edge );
}
return;
}
示例3: GetMatches
void PeakMatchingResults::GetMatches(std::vector<int> &vectFeatureIndices, std::vector<int> &vectMassTagIndices,
std::vector<int> &vectProteinIndices , const std::vector<MultiAlignEngine::MassTags::Protein>* &vectProteins,
const std::vector<MultiAlignEngine::MassTags::MassTag>* &vectMasstags) const
{
// The mass tag database has stored in it all the proteins and mass tags corresponding to the matches.
// So thats where we need to get all the data from.
int numMatches = (int) mvectPeakMatches.size();
std::set <int> massTagID;
stdext::hash_map <int, int > massTagSeen;
// first get all mass tags in the matches into the set of mass tags.
for (int matchNum = 0; matchNum < numMatches; matchNum++)
{
PeakMatch match = mvectPeakMatches[matchNum];
massTagSeen.insert(std::pair<int,int>(match.mintMasstagID, matchNum));
}
// copy hash to mass tag vector
std::vector<int> vectMassTagIDs;
vectMassTagIDs.reserve(massTagSeen.size());
for (stdext::hash_map <int, int >::iterator massTagIter = massTagSeen.begin();
massTagIter != massTagSeen.end(); massTagIter++)
{
vectMassTagIDs.push_back((*massTagIter).first);
}
vectMasstags = mobjMasstagDB.GetMassTagVector();
vectProteins = mobjMasstagDB.GetProteinVector();
const std::multimap<int,int> mapMassTagId2ProteinIndex = mobjMasstagDB.GetMassTagId2ProteinIndexMap();
const stdext::hash_map <int, int > hashMapMassTagId2Index = mobjMasstagDB.GetMassTagId2IndexHash();
// now the relevant mass tags are copied, their ids are copied, the protein names are copied.
// So lets create the table of matches using the three vectors vectFeatureIndices, vectMassTagIndices and
// vectProteinIndices. Basically, vectFeatureIndices will have the index of the ms feature in a peak match.
// the vectMassTagIndices will have the corresponding massTagID, and vectProteinIndices will have the corresponding
// parent protein.
for (std::multimap<int,int>::const_iterator featureIter = mmapFeatureIndex2PeakMatch.begin(); featureIter != mmapFeatureIndex2PeakMatch.end();
featureIter++)
{
int featureIndex = (*featureIter).first;
int peakMatchIndex = (*featureIter).second;
PeakMatch pkMatch = mvectPeakMatches[peakMatchIndex];
int massTagID = pkMatch.mintMasstagID;
stdext::hash_map <int, int>::const_iterator massTagIterHash = hashMapMassTagId2Index.find(massTagID);
int massTagIndex = (*massTagIterHash).second;
// now go through each of the parent proteins of this massTagID and push the triplet into their
// corresponding vectors
for (std::multimap<int,int>::const_iterator massTagIter = mapMassTagId2ProteinIndex.find(massTagID);
massTagIter != mapMassTagId2ProteinIndex.end();
massTagIter++)
{
if ((*massTagIter).first != massTagID)
break;
vectFeatureIndices.push_back(featureIndex);
vectMassTagIndices.push_back(massTagIndex);
vectProteinIndices.push_back((*massTagIter).second);
}
}
}
示例4: getRouteSrc
//get the node id for the source operation of this routing node
int getRouteSrc(int id)
{
std::multimap<int, int>::iterator it = in_edge.find(id);
if(getNodeType(it->second) != route)
return it->second;
else
getRouteSrc(it->second);
}
示例5: search
bool Semantic::search(string name){
for(mi = Symbols.find(name);mi != Symbols.end();mi++){
return true;
}
return false;
}
示例6: checkScope
string Semantic::checkScope(string name, string currScope){
for(mi=Symbols.find(name);mi!= Symbols.end();++mi){
if(mi->second.scope==currScope){
return mi->second.type;
}
}
return "Error";
}
示例7: getScope
string Semantic::getScope(string name){
mi = Symbols.find(name);
if(mi!=Symbols.end()){
return mi->second.scope;
}
else{
return "Error";
}
}
示例8: GetPersistentData
PersistentDataItem World::GetPersistentData(const std::string &key)
{
if (!BuildPersistentCache())
return PersistentDataItem();
auto it = persistent_index.find(key);
if (it != persistent_index.end())
return GetPersistentData(it->second);
return PersistentDataItem();
}
示例9: sort_by_location
static void sort_by_location(std::multimap<std::string, Species> location_map,
std::vector<Species>& species, const std::string location="")
{
std::multimap<std::string, Species>::iterator itr;
while ((itr = location_map.find(location)) != location_map.end())
{
const Species sp((*itr).second);
species.push_back(sp);
sort_by_location(location_map, species, sp.serial());
location_map.erase(itr);
}
}
示例10: value_of
std::size_t NodeListT::value_of(const std::multimap<UnitID, NodeListT::SuperInfoT> &supersets, const UnitID &train, const NodeListT::times_t &value, bool neg) const
{
std::size_t length = lengths.find(train)->second;
const SuperInfoT& sinf = supersets.find(train)->second;
// actually, it's just (value - sinf.station_no % length),
// but lenght is added to avoid % on negative numbers
// the associate braces avoid getting negative temporaries
return (neg)
? (((length + sinf.station_no) - value) % length)
: (((length + value) - sinf.station_no) % length);
}
示例11: save_molecular_type_recursively
static void save_molecular_type_recursively(const Species& location,
std::multimap<Species, const MolecularTypeBase*>& location_map,
Tspace_& space, H5::Group* root)
{
std::multimap<Species, const MolecularTypeBase*>::iterator itr;
while ((itr = location_map.find(location)) != location_map.end())
{
const MolecularTypeBase* mtb((*itr).second);
const Species species(mtb->species());
save_molecular_type(mtb, space.list_voxels_exact(species), root);
save_molecular_type_recursively(species, location_map, space, root);
location_map.erase(itr);
}
}
示例12: getType
string Semantic::getType(string name,string scope){
mi = Symbols.find(name);
for(mi=Symbols.begin();mi!= Symbols.end();++mi){
cout<<mi->first<<":"<<mi->second.scope<<"\n";
if(mi->second.scope==scope){
return mi->second.type;
}
}
return "Error";
}
示例13: addDeviceEventProc
void AudioOutputDeviceManager::addDeviceEventProc(
int _card
, std::multimap< int, const AudioOutputDevice * > & _devices
)
{
if( _devices.find( _card ) != _devices.end() ) {
return;
}
DeviceNameHints hints(
_card
);
const auto & HINTS = hints.get();
for( int i = 0 ; HINTS[ i ] != nullptr ; i++ ) {
const auto HINT = HINTS[ i ];
if( isOutputDevice( HINT ) == false ) {
continue;
}
DeviceDescription description(
HINT
);
DeviceName name(
HINT
);
const auto DEVICE = new AudioOutputDevice(
description.get()
, name.get()
);
_devices.insert(
std::multimap< int, const AudioOutputDevice * >::value_type(
_card
, DEVICE
)
);
this->callConnectEventHandler(
*DEVICE
);
}
}
示例14: findMatchedLyricTimes
std::vector<std::pair<ReducedFraction, ReducedFraction> > findMatchedLyricTimes(
const std::multimap<ReducedFraction, MidiChord> &chords,
const std::multimap<ReducedFraction, std::string> &lyricTrack)
{
// <chord quantized on time, chord original on time>
std::vector<std::pair<ReducedFraction, ReducedFraction> > matchedLyricTimes;
for (const auto &chord: chords) {
for (const auto ¬e: chord.second.notes) {
if (lyricTrack.find(note.origOnTime) != lyricTrack.end()) {
matchedLyricTimes.push_back({chord.first, note.origOnTime});
break;
}
}
}
return matchedLyricTimes;
}
示例15: dfs_visit
static void dfs_visit(MetaClass *u, const std::multimap<MetaClass*, MetaClass*> &adjacents,
std::set<MetaClass*> &visited, std::list<MetaClass*> &sorted)
{
visited.insert(u);
std::multimap<MetaClass*, MetaClass*>::const_iterator iter= adjacents.find(u);
while (iter != adjacents.end() && iter->first == u)
{
MetaClass *v= iter->second;
if (visited.find(v) == visited.end())
dfs_visit(v, adjacents, visited, sorted);
++iter;
}
sorted.push_front(u);
}