Ninja
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | List of all members
State Struct Reference

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

#include <state.h>

Public Types

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

Public Member Functions

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

Public Attributes

BindingEnv bindings_
 
std::vector< Node * > defaults_
 
std::vector< Edge * > edges_
 All the edges of the graph. More...
 
Paths paths_
 
std::map< std::string, Pool * > pools_
 All the pools used in the graph. More...
 

Static Public Attributes

static Pool kConsolePool
 
static Pool kDefaultPool
 
static const Rule kPhonyRule
 

Detailed Description

Global state (file status) for a single run.

Definition at line 84 of file state.h.

Member Typedef Documentation

◆ Paths

Mapping of path -> Node.

Definition at line 117 of file state.h.

Constructor & Destructor Documentation

◆ State()

State::State ( )

Definition at line 77 of file state.cc.

Member Function Documentation

◆ AddDefault()

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

Definition at line 153 of file state.cc.

References StringPiece::AsString().

Referenced by ManifestParser::ParseDefault().

◆ AddEdge()

Edge * State::AddEdge ( const Rule rule)

Definition at line 95 of file state.cc.

References Edge::env_, kDefaultPool, Edge::pool_, and Edge::rule_.

Referenced by ManifestParser::ParseEdge().

◆ AddIn()

void State::AddIn ( Edge edge,
StringPiece  path,
uint64_t  slash_bits 
)

Definition at line 138 of file state.cc.

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

Referenced by ManifestParser::ParseEdge().

◆ AddOut()

bool State::AddOut ( Edge edge,
StringPiece  path,
uint64_t  slash_bits 
)

Definition at line 144 of file state.cc.

References Node::in_edge(), Edge::outputs_, and Node::set_in_edge().

Referenced by ManifestParser::ParseEdge().

◆ AddPool()

void State::AddPool ( Pool pool)

Definition at line 83 of file state.cc.

References Pool::name().

Referenced by ManifestParser::ParsePool().

◆ DefaultNodes()

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

Definition at line 181 of file state.cc.

◆ Dump()

void State::Dump ( )

Dump the nodes and Pools (useful for debugging).

Definition at line 195 of file state.cc.

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

◆ GetNode()

Node * State::GetNode ( StringPiece  path,
uint64_t  slash_bits 
)

◆ LookupNode()

Node * State::LookupNode ( StringPiece  path) const

◆ LookupPool()

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

Definition at line 88 of file state.cc.

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

◆ Reset()

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 185 of file state.cc.

References Edge::VisitNone.

◆ RootNodes()

vector< Node * > State::RootNodes ( std::string *  error) const
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 163 of file state.cc.

◆ SpellcheckNode()

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

Definition at line 121 of file state.cc.

References EditDistance().

Member Data Documentation

◆ bindings_

BindingEnv State::bindings_

◆ defaults_

std::vector<Node*> State::defaults_

Definition at line 127 of file state.h.

◆ edges_

std::vector<Edge*> State::edges_

◆ kConsolePool

Pool State::kConsolePool
static

Definition at line 86 of file state.h.

Referenced by Edge::use_console().

◆ kDefaultPool

Pool State::kDefaultPool
static

Definition at line 85 of file state.h.

Referenced by AddEdge().

◆ kPhonyRule

const Rule State::kPhonyRule
static

Definition at line 87 of file state.h.

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

◆ paths_

Paths State::paths_

Definition at line 118 of file state.h.

Referenced by VerifyGraph().

◆ pools_

std::map<std::string, Pool*> State::pools_

All the pools used in the graph.

Definition at line 121 of file state.h.


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