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)
 
const vector< Edge * > & out_edges () const
 
const string & path () const
 
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)
 
bool Stat (DiskInterface *disk_interface)
 Return true if the file exists (mtime_ got a value). More...
 
bool StatIfNecessary (DiskInterface *disk_interface)
 Return true if we needed to stat. 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_
 

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)
inlineexplicit

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 76 of file graph.h.

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

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

Definition at line 318 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 83 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

Definition at line 78 of file graph.h.

Referenced by Plan::CleanNode(), and BuildTest::Dirty().

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 86 of file graph.h.

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

const string& Node::path ( ) const
inline
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 77 of file graph.h.

Referenced by Plan::CleanNode().

void Node::set_id ( int  id)
inline

Definition at line 84 of file graph.h.

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

void Node::set_in_edge ( Edge edge)
inline

Definition at line 81 of file graph.h.

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

bool Node::Stat ( DiskInterface disk_interface)

Return true if the file exists (mtime_ got a value).

Definition at line 30 of file graph.cc.

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

bool Node::StatIfNecessary ( DiskInterface disk_interface)
inline

Return true if we needed to stat.

Definition at line 47 of file graph.h.

Referenced by Builder::AddTarget().

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 102 of file graph.h.

int Node::id_
private

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

Definition at line 112 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 106 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 97 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 109 of file graph.h.

string Node::path_
private

Definition at line 92 of file graph.h.

Referenced by Stat().


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