Ninja
Public Member Functions | Static 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, uint64_t 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)
 
uint64_t 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
 

Static Public Member Functions

static string PathDecanonicalized (const string &path, uint64_t slash_bits)
 

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_
 
uint64_t 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 37 of file graph.h.

Constructor & Destructor Documentation

◆ Node()

Node::Node ( const string &  path,
uint64_t  slash_bits 
)
inline

Definition at line 38 of file graph.h.

Member Function Documentation

◆ AddOutEdge()

void Node::AddOutEdge ( Edge edge)
inline

◆ dirty()

bool Node::dirty ( ) const
inline

Definition at line 86 of file graph.h.

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

◆ Dump()

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

Definition at line 443 of file graph.cc.

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

◆ exists()

bool Node::exists ( ) const
inline

Definition at line 67 of file graph.h.

Referenced by DependencyScan::RecomputeDirty(), and DependencyScan::RecomputeOutputDirty().

◆ id()

int Node::id ( ) const
inline

Definition at line 93 of file graph.h.

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

◆ in_edge()

Edge* Node::in_edge ( ) const
inline

◆ MarkDirty()

void Node::MarkDirty ( )
inline

◆ MarkMissing()

void Node::MarkMissing ( )
inline

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

Definition at line 63 of file graph.h.

Referenced by BuildTest::Dirty().

◆ mtime()

TimeStamp Node::mtime ( ) const
inline

◆ out_edges()

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

Definition at line 96 of file graph.h.

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

◆ path()

const string& Node::path ( ) const
inline

◆ PathDecanonicalized() [1/2]

string Node::PathDecanonicalized ( ) const
inline

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

Definition at line 77 of file graph.h.

◆ PathDecanonicalized() [2/2]

string Node::PathDecanonicalized ( const string &  path,
uint64_t  slash_bits 
)
static

Definition at line 429 of file graph.cc.

References path(), and slash_bits().

◆ ResetState()

void Node::ResetState ( )
inline

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

Definition at line 57 of file graph.h.

◆ set_dirty()

void Node::set_dirty ( bool  dirty)
inline

Definition at line 87 of file graph.h.

Referenced by Plan::CleanNode(), and DependencyScan::RecomputeDirty().

◆ set_id()

void Node::set_id ( int  id)
inline

Definition at line 94 of file graph.h.

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

◆ set_in_edge()

void Node::set_in_edge ( Edge edge)
inline

Definition at line 91 of file graph.h.

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

◆ slash_bits()

uint64_t Node::slash_bits ( ) const
inline

Definition at line 82 of file graph.h.

Referenced by PathDecanonicalized().

◆ Stat()

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

Return false on error.

Definition at line 30 of file graph.cc.

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

◆ StatIfNecessary()

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

Return false on error.

Definition at line 50 of file graph.h.

Referenced by DependencyScan::RecomputeDirty().

◆ status_known()

bool Node::status_known ( ) const
inline

Definition at line 71 of file graph.h.

Referenced by State::Dump(), and DependencyScan::RecomputeDirty().

Member Data Documentation

◆ dirty_

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

◆ id_

int Node::id_
private

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

Definition at line 127 of file graph.h.

◆ in_edge_

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

◆ mtime_

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

Referenced by Stat().

◆ out_edges_

vector<Edge*> Node::out_edges_
private

All Edges that use this Node as an input.

Definition at line 124 of file graph.h.

◆ path_

string Node::path_
private

Definition at line 102 of file graph.h.

Referenced by Stat().

◆ slash_bits_

uint64_t Node::slash_bits_
private

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

See |PathDecanonicalized|.

Definition at line 106 of file graph.h.


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