Ninja
Public Member Functions | Private Attributes | List of all members
Node Struct Reference

Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc. More...

#include <graph.h>

Public Member Functions

void AddOutEdge (Edge *edge)
 
bool dirty () const
 
void Dump (const char *prefix="") const
 
bool exists () const
 
int id () const
 
Edgein_edge () const
 
void MarkDirty ()
 
void MarkMissing ()
 Mark the Node as already-stat()ed and missing. More...
 
TimeStamp mtime () const
 
 Node (const string &path, unsigned int slash_bits)
 
const vector< Edge * > & out_edges () const
 
const string & path () const
 
string PathDecanonicalized () const
 Get |path()| but use slash_bits to convert back to original slash styles. More...
 
void ResetState ()
 Mark as not-yet-stat()ed and not dirty. More...
 
void set_dirty (bool dirty)
 
void set_id (int id)
 
void set_in_edge (Edge *edge)
 
unsigned int slash_bits () const
 
bool Stat (DiskInterface *disk_interface, string *err)
 Return false on error. More...
 
bool StatIfNecessary (DiskInterface *disk_interface, string *err)
 Return false on error. More...
 
bool status_known () const
 

Private Attributes

bool dirty_
 Dirty is true when the underlying file is out-of-date. More...
 
int id_
 A dense integer id for the node, assigned and used by DepsLog. More...
 
Edgein_edge_
 The Edge that produces this Node, or NULL when there is no known edge to produce it. More...
 
TimeStamp mtime_
 Possible values of mtime_: -1: file hasn't been examined 0: we looked, and file doesn't exist >0: actual file's mtime. More...
 
vector< Edge * > out_edges_
 All Edges that use this Node as an input. More...
 
string path_
 
unsigned int slash_bits_
 Set bits starting from lowest for backslashes that were normalized to forward slashes by CanonicalizePath. More...
 

Detailed Description

Information about a node in the dependency graph: the file, whether it's dirty, mtime, etc.

Definition at line 35 of file graph.h.

Constructor & Destructor Documentation

Node::Node ( const string &  path,
unsigned int  slash_bits 
)
inline

Definition at line 36 of file graph.h.

Member Function Documentation

void Node::AddOutEdge ( Edge edge)
inline
bool Node::dirty ( ) const
inline

Definition at line 79 of file graph.h.

Referenced by Plan::AddSubTarget(), Plan::CleanNode(), Dump(), and State::Dump().

void Node::Dump ( const char *  prefix = "") const

Definition at line 364 of file graph.cc.

References dirty(), Edge::Dump(), in_edge(), mtime(), out_edges(), and path().

bool Node::exists ( ) const
inline

Definition at line 65 of file graph.h.

Referenced by DependencyScan::RecomputeOutputDirty().

int Node::id ( ) const
inline

Definition at line 86 of file graph.h.

Referenced by State::Dump(), DepsLog::GetDeps(), DepsLog::Load(), and DepsLog::RecordDeps().

Edge* Node::in_edge ( ) const
inline
void Node::MarkDirty ( )
inline
void Node::MarkMissing ( )
inline

Mark the Node as already-stat()ed and missing.

Definition at line 61 of file graph.h.

Referenced by BuildTest::Dirty().

TimeStamp Node::mtime ( ) const
inline
const vector<Edge*>& Node::out_edges ( ) const
inline

Definition at line 89 of file graph.h.

Referenced by Plan::CleanNode(), Dump(), Plan::NodeFinished(), and VerifyGraph().

const string& Node::path ( ) const
inline
string Node::PathDecanonicalized ( ) const

Get |path()| but use slash_bits to convert back to original slash styles.

Definition at line 350 of file graph.cc.

References path_, and slash_bits_.

void Node::ResetState ( )
inline

Mark as not-yet-stat()ed and not dirty.

Definition at line 55 of file graph.h.

void Node::set_dirty ( bool  dirty)
inline

Definition at line 80 of file graph.h.

Referenced by Plan::CleanNode().

void Node::set_id ( int  id)
inline

Definition at line 87 of file graph.h.

Referenced by DepsLog::Load(), and DepsLog::RecordId().

void Node::set_in_edge ( Edge edge)
inline

Definition at line 84 of file graph.h.

Referenced by State::AddOut(), and ImplicitDepLoader::CreatePhonyInEdge().

unsigned int Node::slash_bits ( ) const
inline

Definition at line 76 of file graph.h.

bool Node::Stat ( DiskInterface disk_interface,
string *  err 
)

Return false on error.

Definition at line 30 of file graph.cc.

References METRIC_RECORD, mtime_, path_, and DiskInterface::Stat().

bool Node::StatIfNecessary ( DiskInterface disk_interface,
string *  err 
)
inline

Return false on error.

Definition at line 48 of file graph.h.

bool Node::status_known ( ) const
inline

Definition at line 69 of file graph.h.

Referenced by State::Dump().

Member Data Documentation

bool Node::dirty_
private

Dirty is true when the underlying file is out-of-date.

But note that Edge::outputs_ready_ is also used in judging which edges to build.

Definition at line 110 of file graph.h.

int Node::id_
private

A dense integer id for the node, assigned and used by DepsLog.

Definition at line 120 of file graph.h.

Edge* Node::in_edge_
private

The Edge that produces this Node, or NULL when there is no known edge to produce it.

Definition at line 114 of file graph.h.

TimeStamp Node::mtime_
private

Possible values of mtime_: -1: file hasn't been examined 0: we looked, and file doesn't exist >0: actual file's mtime.

Definition at line 105 of file graph.h.

Referenced by Stat().

vector<Edge*> Node::out_edges_
private

All Edges that use this Node as an input.

Definition at line 117 of file graph.h.

string Node::path_
private

Definition at line 95 of file graph.h.

Referenced by PathDecanonicalized(), and Stat().

unsigned int Node::slash_bits_
private

Set bits starting from lowest for backslashes that were normalized to forward slashes by CanonicalizePath.

See |PathDecanonicalized|.

Definition at line 99 of file graph.h.

Referenced by PathDecanonicalized().


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