本文整理汇总了C++中boost::unordered_set::count方法的典型用法代码示例。如果您正苦于以下问题:C++ unordered_set::count方法的具体用法?C++ unordered_set::count怎么用?C++ unordered_set::count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boost::unordered_set
的用法示例。
在下文中一共展示了unordered_set::count方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deep_equals
bool WRLDRecord::deep_equals(Record *master, RecordOp &read_self, RecordOp &read_master, boost::unordered_set<Record *> &identical_records)
{
//Precondition: equals has been run for these records and returned true
// all child records have been visited
const WRLDRecord *master_wrld = (WRLDRecord *)master;
if(CELLS.size() > master_wrld->CELLS.size())
return false;
if(CELL != NULL)
{
if(master_wrld->CELL != NULL)
{
if(identical_records.count(CELL) == 0)
return false;
}
else
return false;
}
for(uint32_t ListIndex = 0; ListIndex < CELLS.size(); ++ListIndex)
if(identical_records.count(CELLS[ListIndex]) == 0)
return false;
return true;
}
示例2: sanity_checks
void sanity_checks() {
ASSERT_TRUE(cm.begin() == cm.end());
for (size_t i = 0;i < NINS; ++i) {
um.insert(17 * i);
}
graphlab::thread_group thrgroup;
for (size_t i = 0; i < 10; ++i) {
thrgroup.launch(boost::bind(parallel_inserter,
i * NINS/10,
(i + 1) * NINS / 10));
}
thrgroup.join();
std::cout << "Size: " << cm.size() << std::endl;
std::cout << "Capacity: " << cm.capacity() << std::endl;
std::cout << "Load Factor: " << cm.load_factor() << std::endl;
for (size_t i = 0;i < NINS; ++i) {
if (cm.get_sync(17 * i).first == false) {
std::cout << cm.count(17 * i) << "\n";
std::cout << "Failure on: " << 17 * i << std::endl;
assert(cm.get_sync(17 * i).first == true);
}
assert(um.count(17 * i) == 1);
}
assert(cm.size() == NINS);
assert(um.size() == NINS);
for (size_t i = 0;i < NINS; i+=2) {
um.erase(17*i);
}
for (size_t i = 0; i < 10; ++i) {
thrgroup.launch(boost::bind(parallel_erase,
i * NINS/10,
(i + 1) * NINS / 10));
}
thrgroup.join();
for (size_t i = 0;i < NINS; i+=2) {
assert(cm.get_sync(17*i).first == (bool)(i % 2));
assert(um.count(17*i) == i % 2);
}
assert(cm.size() == NINS / 2);
assert(um.size() == NINS / 2);
}
示例3: writeEGDot
void writeEGDot(SmartGraph& g, SmartGraph::EdgeMap<double>& length,
ostream& out, SmartGraph::NodeMap<IndexPair>& edgePairs,
boost::unordered_set<unsigned>& matched)
{
out << "graph name {" << endl;
out << " node [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
for (SmartGraph::NodeIt n(g); n != INVALID; ++n)
{
IndexPair p = edgePairs[n];
if(p.first != p.second)
out << " n" << g.id(n) << " [ label=\"" << p.first << ":" << p.second << "\" ]; " << endl;
else
out << " n" << g.id(n) << " [ shape=triangle, label=\"" << p.first << "\" ]; \n";
}
out << " edge [ shape=ellipse, fontname=Helvetica, fontsize=10 ];" << endl;
for (SmartGraph::EdgeIt e(g); e != INVALID; ++e)
{
string extra = "";
if(matched.count(g.id(e)))
extra = "style = bold, ";
out << " n" << g.id(g.u(e)) << " -- " << " n" << g.id(g.v(e))
<< " [ " << extra << "label=\"" << length[e] << "\" ]; " << endl;
}
out << "}" << endl;
}
示例4:
TKmerMapSimple
kmerify_graph_simple(String<TVertexDescriptor const> const & order,
TGraph const & graph,
std::vector<VertexLabels> & vertex_vector,
boost::unordered_set<TVertexDescriptor> const & free_nodes,
boost::unordered_map< std::pair<TVertexDescriptor, TVertexDescriptor>, boost::dynamic_bitset<> > & edge_ids,
int const & kmer_size
)
{
TKmerMapSimple kmer_map;
for (Iterator<String<TVertexDescriptor const> const>::Type it = begin(order) ; it != end(order) ; ++it)
{
TVertexDescriptor const & source_vertex = *it;
if (free_nodes.count(source_vertex) == 0)
{
boost::dynamic_bitset<> id_bits(edge_ids.begin()->second.size());
id_bits.flip();
check_kmers_simple(vertex_vector[source_vertex].dna, graph, source_vertex, vertex_vector, free_nodes, edge_ids, id_bits, kmer_map, static_cast<std::size_t>(kmer_size));
}
}
return kmer_map;
}
示例5: checkKmers
TKmerMap
kmerifyGraph(String<TVertexDescriptor const> const & order,
TGraph const & graph,
std::vector<VertexLabels> & vertex_vector,
boost::unordered_set<TVertexDescriptor> const & free_nodes,
boost::unordered_map< std::pair<TVertexDescriptor, TVertexDescriptor>, boost::dynamic_bitset<> > & edge_ids,
int const & kmer_size
)
{
TKmerMap kmer_map;
for (Iterator<String<TVertexDescriptor const> const>::Type it = begin(order) ; it != end(order) ; ++it)
{
TVertexDescriptor const & source_vertex = *it;
if (free_nodes.count(source_vertex) == 0)
{
boost::dynamic_bitset<> id_bits(edge_ids.begin()->second.size());
id_bits.flip();
checkKmers(vertex_vector[source_vertex].dna, source_vertex, source_vertex, graph, vertex_vector, free_nodes, edge_ids, id_bits, kmer_map, static_cast<std::size_t>(kmer_size));
// std::cout << "source_vertex = " << source_vertex << " kmer_map.size() = " << kmer_map.size() << " kmer_size = " << kmer_size;
// std::cout << " vertex_vector[source_vertex].level = " << vertex_vector[source_vertex].level << std::endl;
}
}
return kmer_map;
}
示例6: new_kmer
void
checkKmers(DnaString const & kmer,
TVertexDescriptor const & starting_vertex,
TVertexDescriptor const & source_vertex,
TGraph const & graph,
std::vector<VertexLabels> & vertex_vector,
boost::unordered_set<TVertexDescriptor> const & free_nodes,
boost::unordered_map< std::pair<TVertexDescriptor, TVertexDescriptor>, boost::dynamic_bitset<> > & edge_ids,
boost::dynamic_bitset<> const & id_bits,
TKmerMap & kmer_map,
std::size_t const & kmer_size
)
{
if (id_bits.none())
return;
if (length(kmer) == kmer_size)
{
KmerLabels new_kmer_label =
{
starting_vertex,
source_vertex,
id_bits
};
if (kmer_map.count(kmer) == 0)
{
std::vector<KmerLabels> new_vector(1, new_kmer_label);
kmer_map[kmer] = new_vector;
}
else
{
kmer_map[kmer].push_back(new_kmer_label);
}
return;
}
for (Iterator<TGraph, OutEdgeIterator>::Type out_edge_iterator (graph, source_vertex) ; !atEnd(out_edge_iterator) ; ++out_edge_iterator)
{
DnaString new_kmer(kmer);
TVertexDescriptor const & target_vertex = targetVertex(out_edge_iterator);
boost::dynamic_bitset<> new_id_bits(id_bits);
if (free_nodes.count(target_vertex) == 0)
{
seqan::appendValue(new_kmer, vertex_vector[target_vertex].dna);
std::pair<TVertexDescriptor, TVertexDescriptor> edge_pair(source_vertex, target_vertex);
if (edge_ids.count(edge_pair) == 1)
{
new_id_bits = id_bits & edge_ids[edge_pair];
}
}
checkKmers(new_kmer, starting_vertex, target_vertex, graph, vertex_vector, free_nodes, edge_ids, new_id_bits, kmer_map, kmer_size);
}
}
示例7: deep_equals
bool WRLDRecord::deep_equals(Record *master, RecordOp &read_self, RecordOp &read_master, boost::unordered_set<Record *> &identical_records)
{
//Precondition: equals has been run for these records and returned true
// all child records have been visited
const WRLDRecord *master_wrld = (WRLDRecord *)master;
if(CELLS.size() > master_wrld->CELLS.size())
return false;
if(ROAD != NULL)
{
if(master_wrld->ROAD != NULL)
{
if(identical_records.count(ROAD) == 0)
return false;
}
else
return false;
}
if(CELL != NULL)
{
if(master_wrld->CELL != NULL)
{
if(identical_records.count(CELL) == 0)
return false;
}
else
return false;
}
for(uint32_t ListIndex = 0; ListIndex < CELLS.size(); ++ListIndex)
if(identical_records.count(CELLS[ListIndex]) == 0)
return false;
//The cell and all its contents are dupes, so remove the child records from identical_records
// This prevents Bash from trying to double delete records (first the cell, and later a child that was in the cell)
identical_records.erase(ROAD);
identical_records.erase(CELL);
for(uint32_t ListIndex = 0; ListIndex < CELLS.size(); ++ListIndex)
identical_records.erase(CELLS[ListIndex]);
return true;
}
示例8: deep_equals
bool DIALRecord::deep_equals(Record *master, RecordOp &read_self, RecordOp &read_master, boost::unordered_set<Record *> &identical_records)
{
//Precondition: equals has been run for these records and returned true
// all child records have been visited
if(INFO.size() > ((DIALRecord *)master)->INFO.size())
return false;
for(uint32_t ListIndex = 0; ListIndex < INFO.size(); ++ListIndex)
if(identical_records.count(INFO[ListIndex]) == 0)
return false;
return true;
}
示例9: deep_equals
bool CELLRecord::deep_equals(Record *master, RecordOp &read_self, RecordOp &read_master, boost::unordered_set<Record *> &identical_records)
{
//Precondition: equals has been run for these records and returned true
// all child records have been visited
CELLRecord *master_cell = (CELLRecord *)master;
Record *parent_wrld = GetParentRecord(), *master_wrld = master_cell->GetParentRecord();
//Check to make sure the CELLs are attached at the same spot
if(parent_wrld != NULL)
{
if(master_wrld != NULL)
{
if(parent_wrld->formID != master_wrld->formID)
return false;
}
else
return false;
}
else if(master_wrld != NULL)
return false;
if(ACHR.size() > master_cell->ACHR.size())
return false;
if(ACRE.size() > master_cell->ACRE.size())
return false;
if(REFR.size() > master_cell->REFR.size())
return false;
if(PGRE.size() > master_cell->PGRE.size())
return false;
if(PMIS.size() > master_cell->PMIS.size())
return false;
if(PBEA.size() > master_cell->PBEA.size())
return false;
if(PFLA.size() > master_cell->PFLA.size())
return false;
if(PCBE.size() > master_cell->PCBE.size())
return false;
if(NAVM.size() > master_cell->NAVM.size())
return false;
if(LAND != NULL)
{
if(master_cell->LAND != NULL)
{
if(identical_records.count(LAND) == 0)
return false;
}
else
return false;
}
for(uint32_t ListIndex = 0; ListIndex < ACHR.size(); ++ListIndex)
if(identical_records.count(ACHR[ListIndex]) == 0)
return false;
for(uint32_t ListIndex = 0; ListIndex < ACRE.size(); ++ListIndex)
if(identical_records.count(ACRE[ListIndex]) == 0)
return false;
for(uint32_t ListIndex = 0; ListIndex < REFR.size(); ++ListIndex)
if(identical_records.count(REFR[ListIndex]) == 0)
return false;
for(uint32_t ListIndex = 0; ListIndex < PGRE.size(); ++ListIndex)
if(identical_records.count(PGRE[ListIndex]) == 0)
return false;
for(uint32_t ListIndex = 0; ListIndex < PMIS.size(); ++ListIndex)
if(identical_records.count(PMIS[ListIndex]) == 0)
return false;
for(uint32_t ListIndex = 0; ListIndex < PBEA.size(); ++ListIndex)
if(identical_records.count(PBEA[ListIndex]) == 0)
return false;
for(uint32_t ListIndex = 0; ListIndex < PFLA.size(); ++ListIndex)
if(identical_records.count(PFLA[ListIndex]) == 0)
return false;
for(uint32_t ListIndex = 0; ListIndex < PCBE.size(); ++ListIndex)
if(identical_records.count(PCBE[ListIndex]) == 0)
return false;
for(uint32_t ListIndex = 0; ListIndex < NAVM.size(); ++ListIndex)
if(identical_records.count(NAVM[ListIndex]) == 0)
return false;
return true;
}