Ninja
Public Types | Public Member Functions | Public Attributes | Static Public Attributes
State Struct Reference

Global state (file status, loaded rules) for a single run. More...

#include <state.h>

List of all members.

Public Types

typedef ExternalStringHashMap
< Node * >::Type 
Paths
 Mapping of path -> Node.

Public Member Functions

bool AddDefault (StringPiece path, string *error)
EdgeAddEdge (const Rule *rule)
void AddIn (Edge *edge, StringPiece path)
void AddOut (Edge *edge, StringPiece path)
void AddPool (Pool *pool)
void AddRule (const Rule *rule)
vector< Node * > DefaultNodes (string *error)
void Dump ()
 Dump the nodes and Pools (useful for debugging).
NodeGetNode (StringPiece path)
NodeLookupNode (StringPiece path) const
PoolLookupPool (const string &pool_name)
const RuleLookupRule (const string &rule_name)
void Reset ()
 Reset state.
vector< Node * > RootNodes (string *error)
NodeSpellcheckNode (const string &path)
 State ()

Public Attributes

BindingEnv bindings_
vector< Node * > defaults_
vector< Edge * > edges_
 All the edges of the graph.
Paths paths_
map< string, Pool * > pools_
 All the pools used in the graph.
map< string, const Rule * > rules_
 All the rules used in the graph.

Static Public Attributes

static Pool kConsolePool
static Pool kDefaultPool
static const Rule kPhonyRule

Detailed Description

Global state (file status, loaded rules) for a single run.

Definition at line 83 of file state.h.


Member Typedef Documentation

Mapping of path -> Node.

Definition at line 119 of file state.h.


Constructor & Destructor Documentation

Definition at line 75 of file state.cc.

References AddPool(), AddRule(), kConsolePool, kDefaultPool, and kPhonyRule.


Member Function Documentation

bool State::AddDefault ( StringPiece  path,
string *  error 
)

Definition at line 166 of file state.cc.

References StringPiece::AsString(), defaults_, and LookupNode().

Referenced by ManifestParser::ParseDefault().

Edge * State::AddEdge ( const Rule rule)
void State::AddIn ( Edge edge,
StringPiece  path 
)

Definition at line 148 of file state.cc.

References Node::AddOutEdge(), GetNode(), and Edge::inputs_.

Referenced by ManifestParser::ParseEdge().

void State::AddOut ( Edge edge,
StringPiece  path 
)
void State::AddPool ( Pool pool)

Definition at line 93 of file state.cc.

References LookupPool(), Pool::name(), and pools_.

Referenced by ManifestParser::ParsePool(), and State().

void State::AddRule ( const Rule rule)

Definition at line 81 of file state.cc.

References LookupRule(), Rule::name(), and rules_.

Referenced by ManifestParser::ParseRule(), and State().

vector< Node * > State::DefaultNodes ( string *  error)

Definition at line 194 of file state.cc.

References defaults_, and RootNodes().

void State::Dump ( )

Dump the nodes and Pools (useful for debugging).

Definition at line 205 of file state.cc.

References Node::dirty(), Node::id(), Node::path(), paths_, pools_, and Node::status_known().

Node * State::LookupNode ( StringPiece  path) const

Definition at line 123 of file state.cc.

References METRIC_RECORD, and paths_.

Referenced by AddDefault(), Builder::AddTarget(), Cleaner::CleanTarget(), Cleaner::CleanTargets(), and GetNode().

Pool * State::LookupPool ( const string &  pool_name)

Definition at line 98 of file state.cc.

References pools_.

Referenced by AddPool(), ManifestParser::ParseEdge(), and ManifestParser::ParsePool().

const Rule * State::LookupRule ( const string &  rule_name)
void State::Reset ( )

Reset state.

Keeps all nodes and edges, but restores them to the state where we haven't yet examined the disk for dirty state.

Definition at line 198 of file state.cc.

References edges_, and paths_.

vector< Node * > State::RootNodes ( string *  error)
Returns:
the root node(s) of the graph. (Root nodes have no output edges).
Parameters:
errorwhere to write the error message if somethings went wrong.

Definition at line 176 of file state.cc.

References edges_.

Referenced by DefaultNodes().

Node * State::SpellcheckNode ( const string &  path)

Definition at line 131 of file state.cc.

References EditDistance(), and paths_.


Member Data Documentation

Definition at line 131 of file state.h.

Referenced by AddEdge(), and ManifestParser::ManifestParser().

Definition at line 132 of file state.h.

Referenced by AddDefault(), and DefaultNodes().

vector<Edge*> State::edges_

All the edges of the graph.

Definition at line 129 of file state.h.

Referenced by AddEdge(), Cleaner::CleanAll(), Cleaner::DoCleanRule(), LoadManifests(), Reset(), RootNodes(), TEST_F(), and WriteTestData().

Definition at line 85 of file state.h.

Referenced by State(), and Edge::use_console().

Definition at line 84 of file state.h.

Referenced by AddEdge(), and State().

const Rule State::kPhonyRule [static]

Definition at line 86 of file state.h.

Referenced by ImplicitDepLoader::CreatePhonyInEdge(), Edge::is_phony(), and State().

Definition at line 120 of file state.h.

Referenced by Dump(), GetNode(), LookupNode(), Reset(), and SpellcheckNode().

map<string, Pool*> State::pools_

All the pools used in the graph.

Definition at line 126 of file state.h.

Referenced by AddPool(), Dump(), and LookupPool().

map<string, const Rule*> State::rules_

All the rules used in the graph.

Definition at line 123 of file state.h.

Referenced by AddRule(), and LookupRule().


The documentation for this struct was generated from the following files: