void MergeAllParents::mergeAll(std::pair<ParentsIterator,ParentsIterator> pair, VertexID child, set<VertexID> &A, set<VertexID> &B) { set<VertexID> parents2; set<VertexID> parents1; set<VertexID>::iterator pit,Aelt,Belt; ParentsIterator p,p_end,p2,p2_end; InEdgeIterator e,e_end; for (tie(p,p_end) = pair; p != p_end; p++) { if (*p != m_invartask) { parents1.insert(*p); } } for (pit=parents1.begin(); pit != parents1.end(); pit++) { addContainsTask(child,*pit); for (tie(p2,p2_end) = parents(*pit,*m_taskgraph); p2 != p2_end; p2++) { if (parents1.find(*pit) == parents1.end() && *p2 != m_invartask) parents2.insert(*p2); } // Add edge from parents^2 to child for(tie(e,e_end) = in_edges(*pit,*m_taskgraph); e != e_end; e++) { // Adding edge here invalidates pair iterators if (parents1.find(source(*e,*m_taskgraph)) == parents1.end()) { EdgeID newEdge = add_edge(source(*e,*m_taskgraph),child,m_taskgraph); ResultSet &set = getResultSet(newEdge,m_taskgraph); ResultSet &oldSet = getResultSet(*e,m_taskgraph); set.make_union(&oldSet); } } } // Add edge from new node to all in A for (Aelt=A.begin(); Aelt != A.end(); Aelt++) { add_edge(child,*Aelt,m_taskgraph); } // Can not iterate through pair since add_edge above invalidates that // iterator. for (pit=parents1.begin(); pit != parents1.end(); pit++) { if (B.find(*pit) == B.end() && *pit != m_invartask) { (*m_taskRemoved)[*pit] = true; clear_vertex(*pit,*m_taskgraph); remove_vertex(*pit,*m_taskgraph); } } // Remove edges from elts in B to child, the elts are already dupl. into child. for (Belt = B.begin(); Belt != B.end(); Belt++) { remove_edge(*Belt,child,*m_taskgraph); } }
SqlResultSet* MysqlStatement::executeQuery(const std::string& sql) throw (SqlException&) { lastUpdateCount_ = 0; if (0 != ::mysql_real_query(connection_->getConnection(), sql.c_str(), sql.size())) { THROW3(SqlException, ::mysql_error(connection_->getConnection()), ::mysql_errno(connection_->getConnection())); } return getResultSet(); }
EdgeID add_edge(VertexID parent, VertexID child, TaskGraph *tg, ResultSet &rset) { EdgeID e; bool edge_exist; tie(e,edge_exist)= edge(parent,child,*tg); if (edge_exist) { setCommCost(e,getCommCost(e,tg)+1,tg); ResultSet & s=getResultSet(e,tg); s.make_union(&rset); } else { bool succeed; tie(e,succeed) = boost::add_edge(parent,child,*tg); setCommCost(e,1,tg); setResultSet(e,rset,tg); } return e; }
EdgeID add_edge(VertexID parent, VertexID child, TaskGraph *tg, string * result,int prio) { EdgeID e; bool edge_exist; tie(e,edge_exist)= edge(parent,child,*tg); if (edge_exist) { setCommCost(e,getCommCost(e,tg)+1,tg); if (result) { ResultSet & s=getResultSet(e,tg); s.insert(pair<string,int>(*result,prio)); } } else { bool succeed; tie(e,succeed) = boost::add_edge(parent,child,*tg); setCommCost(e,1,tg); setResultSet(e,make_resultset(result,prio),tg); } return e; }
ResultSet* MySQLStatement::executeQuery(const std::string& sql) { doQuery(sql.c_str(), sql.length()); MYSQL* mysql = mysqlConn->getMySQLHandle(); return getResultSet(); }