Skip to content

scram::core::Node

An abstract base class that represents a node in a PDAG. More...

#include <pdag.h>

Inherits from scram::core::NodeParentManager, boost::noncopyable

Inherited by scram::core::Constant, scram::core::Gate, scram::core::Variable

Public Functions

Name
Node(Pdag * graph)<br>Creates a unique graph node as a member of a PDAG.
virtual~Node() =0<br>Abstract class.
Pdag &graph()
intindex() const
intorder() const
voidorder(int val)<br>Sets the order number for this node.
intopti_value() const
voidopti_value(int val)<br>Sets the optimization value for failure propagation.
boolVisit(int time)<br>Registers the visit time for this node upon graph traversal.
intEnterTime() const
intExitTime() const
intLastVisit() const
virtual intmin_time() const
virtual intmax_time() const
boolRevisited() const
boolVisited() const
voidClearVisits()<br>Clears all the visit information. Resets the visit times to 0s.
intpos_count() const
intneg_count() const
voidAddCount(bool positive)<br>Increases the count of this node.
voidResetCount()<br>Resets positive and negative counts of this node.

Additional inherited members

Public Types inherited from scram::core::NodeParentManager

Name
using std::pair< int, GateWeakPtr >Parent <br>Parent index and ptr.
using ext::linear_map< int, GateWeakPtr, ext::MoveEraser >ParentMap <br>A map type of parent gate positive indices and weak pointers to them.

Public Functions inherited from scram::core::NodeParentManager

Name
const ParentMap &parents() const

Protected Functions inherited from scram::core::NodeParentManager

Name
~NodeParentManager() =default

Friends inherited from scram::core::NodeParentManager

Name
classGate <br>The main manipulator of parent information.

Detailed Description

cpp
class scram::core::Node;

An abstract base class that represents a node in a PDAG.

Precondition: A node does not outlive its PDAG.

The index of the node is a unique identifier for the node. The node holds weak pointers to the parents that are managed by the parents.

Public Functions Documentation

function Node

cpp
explicit Node(
    Pdag * graph
)

Creates a unique graph node as a member of a PDAG.

Parameters:

  • graph The graph this node belongs to.

function ~Node

cpp
virtual ~Node() =0

Abstract class.

function graph

cpp
inline Pdag & graph()

Return: The host graph of the node.

function index

cpp
inline int index() const

Return: The index of this node.

function order

cpp
inline int order() const

Return: Assigned order for this node.

function order

cpp
inline void order(
    int val
)

Sets the order number for this node.

Parameters:

  • val Positive integer.

The order is interpreted by the assigner.

function opti_value

cpp
inline int opti_value() const

Return: Optimization value for failure propagation.

function opti_value

cpp
inline void opti_value(
    int val
)

Sets the optimization value for failure propagation.

Parameters:

  • val Value that makes sense to the caller.

function Visit

cpp
inline bool Visit(
    int time
)

Registers the visit time for this node upon graph traversal.

Parameters:

  • time The current visit time of this node. It must be positive.

Return:

  • true if this node was previously visited.
  • false if this is visited and re-visited only once.

This information can be used to detect dependencies.

function EnterTime

cpp
inline int EnterTime() const

Return:

  • The time when this node was first encountered or entered.
  • 0 if no enter time is registered.

function ExitTime

cpp
inline int ExitTime() const

Return:

  • The exit time upon traversal of the graph.
  • 0 if no exit time is registered.

function LastVisit

cpp
inline int LastVisit() const

Return:

  • The last time this node was visited.
  • 0 if no last time is registered.

function min_time

cpp
inline virtual int min_time() const

Return:

  • The minimum time of the visit.
  • 0 if no time is registered.

Reimplemented by: scram::core::Gate::min_time

function max_time

cpp
inline virtual int max_time() const

Return:

  • The maximum time of the visit.
  • 0 if no time is registered.

Reimplemented by: scram::core::Gate::max_time

function Revisited

cpp
inline bool Revisited() const

Return:

  • false if this node was only visited once upon graph traversal.
  • true if this node was revisited at least one more time.

function Visited

cpp
inline bool Visited() const

Return:

  • true if this node was visited at least once.
  • false if this node was never visited upon traversal.

function ClearVisits

cpp
inline void ClearVisits()

Clears all the visit information. Resets the visit times to 0s.

function pos_count

cpp
inline int pos_count() const

Return: The positive count of this node.

function neg_count

cpp
inline int neg_count() const

Return: The negative count of this node.

function AddCount

cpp
inline void AddCount(
    bool positive
)

Increases the count of this node.

Parameters:

  • positive Indication of a positive node.

function ResetCount

cpp
inline void ResetCount()

Resets positive and negative counts of this node.


Updated on 2025-11-11 at 16:51:08 +0000