Avoid importing the std namespace

This commit is contained in:
Tiago Gomes
2013-02-07 13:37:15 +00:00
parent 7b60e88545
commit bb7a530da3
49 changed files with 939 additions and 908 deletions

View File

@@ -22,8 +22,8 @@ BayesBallGraph::addNode (BBNode* n)
void
BayesBallGraph::addEdge (VarId vid1, VarId vid2)
{
unordered_map<VarId, BBNode*>::iterator it1;
unordered_map<VarId, BBNode*>::iterator it2;
std::unordered_map<VarId, BBNode*>::iterator it1;
std::unordered_map<VarId, BBNode*>::iterator it2;
it1 = varMap_.find (vid1);
it2 = varMap_.find (vid2);
assert (it1 != varMap_.end());
@@ -37,7 +37,7 @@ BayesBallGraph::addEdge (VarId vid1, VarId vid2)
const BBNode*
BayesBallGraph::getNode (VarId vid) const
{
unordered_map<VarId, BBNode*>::const_iterator it;
std::unordered_map<VarId, BBNode*>::const_iterator it;
it = varMap_.find (vid);
return it != varMap_.end() ? it->second : 0;
}
@@ -47,7 +47,7 @@ BayesBallGraph::getNode (VarId vid) const
BBNode*
BayesBallGraph::getNode (VarId vid)
{
unordered_map<VarId, BBNode*>::const_iterator it;
std::unordered_map<VarId, BBNode*>::const_iterator it;
it = varMap_.find (vid);
return it != varMap_.end() ? it->second : 0;
}
@@ -77,13 +77,13 @@ BayesBallGraph::clear (void)
void
BayesBallGraph::exportToGraphViz (const char* fileName)
{
ofstream out (fileName);
std::ofstream out (fileName);
if (!out.is_open()) {
cerr << "Error: couldn't open file '" << fileName << "'." ;
std::cerr << "Error: couldn't open file '" << fileName << "'." ;
return;
}
out << "digraph {" << endl;
out << "ranksep=1" << endl;
out << "digraph {" << std::endl;
out << "ranksep=1" << std::endl;
for (size_t i = 0; i < nodes_.size(); i++) {
out << nodes_[i]->varId() ;
out << " [" ;
@@ -91,16 +91,16 @@ BayesBallGraph::exportToGraphViz (const char* fileName)
if (nodes_[i]->hasEvidence()) {
out << ",style=filled, fillcolor=yellow" ;
}
out << "]" << endl;
out << "]" << std::endl;
}
for (size_t i = 0; i < nodes_.size(); i++) {
const vector<BBNode*>& childs = nodes_[i]->childs();
const std::vector<BBNode*>& childs = nodes_[i]->childs();
for (size_t j = 0; j < childs.size(); j++) {
out << nodes_[i]->varId() << " -> " << childs[j]->varId();
out << " [style=bold]" << endl ;
out << " [style=bold]" << std::endl;
}
}
out << "}" << endl;
out << "}" << std::endl;
out.close();
}