summaryrefslogtreecommitdiffstats
path: root/src/state.h
diff options
context:
space:
mode:
authorRobert Iannucci <robbie@rail.com>2012-10-01 20:51:00 (GMT)
committerRobert A Iannucci Jr <iannucci@chromium.org>2012-11-09 04:25:39 (GMT)
commit8775c4d1e3630230dcea202f2d1647e56a81c20f (patch)
treec603c0d2f6063647703ef00dbf3c1c2e9e377a79 /src/state.h
parent93e509469953a90f31afc838536b82568da397b2 (diff)
downloadNinja-8775c4d1e3630230dcea202f2d1647e56a81c20f.zip
Ninja-8775c4d1e3630230dcea202f2d1647e56a81c20f.tar.gz
Ninja-8775c4d1e3630230dcea202f2d1647e56a81c20f.tar.bz2
Pull out base changes to state
Diffstat (limited to 'src/state.h')
-rw-r--r--src/state.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/state.h b/src/state.h
index 026acf3..38fc74f 100644
--- a/src/state.h
+++ b/src/state.h
@@ -27,16 +27,36 @@ struct Edge;
struct Node;
struct Rule;
+/// A pool for delayed edges
+struct Pool {
+ explicit Pool(const string& name, int depth)
+ : name_(name), depth_(depth) { }
+
+ // A depth of 0 is infinite
+ bool isValid() const { return depth_ >= 0; }
+ int depth() const { return depth_; }
+ string name() const { return name_; }
+
+private:
+ string name_;
+
+ int depth_;
+};
+
/// Global state (file status, loaded rules) for a single run.
struct State {
static const Rule kPhonyRule;
+ static const Pool kDefaultPool;
State();
void AddRule(const Rule* rule);
const Rule* LookupRule(const string& rule_name);
- Edge* AddEdge(const Rule* rule);
+ void AddPool(const Pool* pool);
+ const Pool* LookupPool(const string& pool_name);
+
+ Edge* AddEdge(const Rule* rule, const Pool* pool);
Node* GetNode(StringPiece path);
Node* LookupNode(StringPiece path);
@@ -65,6 +85,9 @@ struct State {
/// All the rules used in the graph.
map<string, const Rule*> rules_;
+ /// All the pools used in the graph.
+ map<string, const Pool*> pools_;
+
/// All the edges of the graph.
vector<Edge*> edges_;