Turn EGNode to be a nested class inside ElimGraph

This commit is contained in:
Tiago Gomes 2013-02-20 13:49:01 +00:00
parent 8ca379c74a
commit 9a68d95c18
2 changed files with 22 additions and 24 deletions

View File

@ -166,7 +166,7 @@ ElimGraph::addNode (EGNode* n)
EGNode*
ElimGraph::EGNode*
ElimGraph::getEGNode (VarId vid) const
{
std::unordered_map<VarId, EGNode*>::const_iterator it;
@ -176,7 +176,7 @@ ElimGraph::getEGNode (VarId vid) const
EGNode*
ElimGraph::EGNode*
ElimGraph::getLowestCostNode (void) const
{
EGNode* bestNode = 0;

View File

@ -13,28 +13,6 @@
namespace Horus {
class EGNode;
typedef TinySet<EGNode*> EGNeighs;
class EGNode : public Var {
public:
EGNode (VarId vid, unsigned range) : Var (vid, range) { }
void addNeighbor (EGNode* n) { neighs_.insert (n); }
void removeNeighbor (EGNode* n) { neighs_.remove (n); }
bool isNeighbor (EGNode* n) const { return neighs_.contains (n); }
const EGNeighs& neighbors (void) const { return neighs_; }
private:
EGNeighs neighs_;
};
class ElimGraph {
public:
enum ElimHeuristic {
@ -63,6 +41,26 @@ class ElimGraph {
static void setElimHeuristic (ElimHeuristic eh) { elimHeuristic_ = eh; }
private:
class EGNode;
typedef TinySet<EGNode*> EGNeighs;
class EGNode : public Var {
public:
EGNode (VarId vid, unsigned range) : Var (vid, range) { }
void addNeighbor (EGNode* n) { neighs_.insert (n); }
void removeNeighbor (EGNode* n) { neighs_.remove (n); }
bool isNeighbor (EGNode* n) const { return neighs_.contains (n); }
const EGNeighs& neighbors (void) const { return neighs_; }
private:
EGNeighs neighs_;
};
void addEdge (EGNode* n1, EGNode* n2);
unsigned getNeighborsCost (const EGNode* n) const;