diff options
Diffstat (limited to 'src/state.h')
-rw-r--r-- | src/state.h | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/state.h b/src/state.h index 918fe09..7e3aead 100644 --- a/src/state.h +++ b/src/state.h @@ -39,7 +39,7 @@ struct Rule; /// completes). struct Pool { explicit Pool(const string& name, int depth) - : name_(name), current_use_(0), depth_(depth) { } + : name_(name), current_use_(0), depth_(depth), delayed_(&WeightedEdgeCmp) { } // A depth of 0 is infinite bool is_valid() const { return depth_ >= 0; } @@ -66,9 +66,7 @@ struct Pool { /// Dump the Pool and its edges (useful for debugging). void Dump() const; -private: - int UnitsWaiting() { return delayed_.size(); } - + private: string name_; /// |current_use_| is the total of the weights of the edges which are @@ -76,7 +74,10 @@ private: int current_use_; int depth_; - deque<Edge*> delayed_; + static bool WeightedEdgeCmp(const Edge* a, const Edge* b); + + typedef set<Edge*,bool(*)(const Edge*, const Edge*)> DelayedEdges; + DelayedEdges delayed_; }; /// Global state (file status, loaded rules) for a single run. @@ -92,7 +93,7 @@ struct State { void AddPool(Pool* pool); Pool* LookupPool(const string& pool_name); - Edge* AddEdge(const Rule* rule, Pool* pool); + Edge* AddEdge(const Rule* rule); Node* GetNode(StringPiece path); Node* LookupNode(StringPiece path); |