GNodeBase Class Reference

#include <nodesystem.h>

Inheritance diagram for GNodeBase:

Detailed Description

GNodeBase is the base class of node references. The whole hierarchy is

See also usernodes_nodes for a class diagram and more details. It is important to understand that GNodeBase and its subclasses are not nodes themselves, but references to nodes. Such a reference consists of a reference to the node system and the node path to the g-node within the node system.

Public Member Functions

 operator Bool () const
 
Bool IsEmpty () const
 
Bool IsPopulated () const
 
Bool IsValid () const
 
const NodeSystemInterface::ConstPtr & GetNodeSystem () const
 
const NodePath & GetPath () const
 
 operator const NodePath & () const
 
const InternedIdGetId () const
 
NODE_KIND GetKind () const
 
GNODE_FLAGS GetFlags () const
 
Bool operator== (const GNodeBase &other) const
 
Bool operator!= (const GNodeBase &other) const
 
HashInt GetHashCode () const
 
UniqueHash GetUniqueHashCode () const
 
String ToString (const FormatStatement *fs=nullptr) const
 

Protected Member Functions

 GNodeBase ()=default
 
 GNodeBase (NodeSystemInterface *system, const GNodeHandle &node)
 
 GNodeBase (NodeSystemInterface *system, GNodeHandle &&node)
 
void SetNodeSystem (NodeSystemInterface *sys)
 

Static Protected Member Functions

template<typename GNODE , typename PATH >
static Result< void > PrivateInitFromPath (GNODE &node, typename GNODE::NodeSystemCtorParam system, PATH &&path, NODE_KIND check)
 

Protected Attributes

NodeSystemInterface_system
 
GNodeHandle _node
 

Private Types

using NodeSystemCtorParam = NodeSystemInterface *
 

Private Member Functions

const GNodeHandleGetHandle () const
 
const ThreadReferencedErrorGetErrorStorage () const
 

Static Private Attributes

static const Bool MUTABLE
 
static const NODE_KIND KIND_MASK
 
static constexpr Bool HAS_ERROR
 

Friends

class NodeSystemImpl
 
class NodesLibImpl
 

Member Typedef Documentation

◆ NodeSystemCtorParam

Constructor & Destructor Documentation

◆ GNodeBase() [1/3]

GNodeBase ( )
protecteddefault

◆ GNodeBase() [2/3]

GNodeBase ( NodeSystemInterface system,
const GNodeHandle node 
)
protected

◆ GNodeBase() [3/3]

GNodeBase ( NodeSystemInterface system,
GNodeHandle &&  node 
)
protected

Member Function Documentation

◆ operator Bool()

operator Bool ( ) const
explicit

Checks if this is a non-null reference to a g-node in some node system.

Returns
True for a non-null reference, false otherwise.

◆ IsEmpty()

Bool IsEmpty ( ) const

Checks if this g-node is empty and contains no reference.

Returns
True if no node is referenced, false otherwise.

◆ IsPopulated()

Bool IsPopulated ( ) const

Checks if this is a non-null reference to a g-node in some node system.

Returns
True for a non-null reference, false otherwise.

◆ IsValid()

Bool IsValid ( ) const

Checks if this is a non-null reference to a g-node in some node system. Same as IsPopulated().

Returns
True for a non-null reference, false otherwise.

◆ GetNodeSystem()

const NodeSystemInterface::ConstPtr& GetNodeSystem ( ) const

Returns the node system of this node reference. For a null node a null reference is returned.

Returns
The node system of this g-node, or a null reference.

◆ GetPath()

const NodePath& GetPath ( ) const

Returns the path of this node reference. A g-node is identified by its owning node system and the path within that node system.

Returns
The path of the referenced g-node.

◆ operator const NodePath &()

operator const NodePath & ( ) const

Returns the path of this node reference. A g-node is identified by its owning node system and the path within that node system.

Returns
The path of the referenced g-node.

◆ GetId()

const InternedId& GetId ( ) const

Returns the identifier of this node reference. The identifier is the last element of the path, so it is only guaranteed to be unique among siblings of the referenced node, but not within the whole node system. For the root node (which has an empty path) the identifier is also empty.

Returns
Identifier of this g-node (last path element).

◆ GetHandle()

const GNodeHandle& GetHandle ( ) const
private

◆ GetKind()

NODE_KIND GetKind ( ) const

Returns the node kind of this g-node (whether it's a true node, a port list or a port).

Returns
The node kind of this g-node.

◆ GetFlags()

GNODE_FLAGS GetFlags ( ) const

Returns the GNODE_FLAGS of this g-node.

Returns
GNODE_FLAGS of this g-node.

◆ operator==()

Bool operator== ( const GNodeBase other) const

Checks if this g-node is the same as other.

Parameters
[in]otherAnother g-node.
Returns
True if this and other are the same g-node, false otherwise.

◆ operator!=()

Bool operator!= ( const GNodeBase other) const

Checks if this g-node and other denote different nodes.

Parameters
[in]otherAnother g-node.
Returns
True if this and other are different nodes, false otherwise.

◆ GetHashCode()

HashInt GetHashCode ( ) const

Returns the hash code of this @CLASS.

Returns
Hash code of this @CLASS.

◆ GetUniqueHashCode()

UniqueHash GetUniqueHashCode ( ) const

Returns the 128-bit hash value of this @CLASS. The implementation ensures uniform distribution, so for practical purposes you can safely assume that two objects are equal if their hash values are equal.

Returns
Hash value of this @CLASS.

◆ ToString()

String ToString ( const FormatStatement fs = nullptr) const

Returns a String representation of this @CLASS.

Parameters
[in]formatStatementNullptr or additional formatting instruction.
Returns
String representation of this @CLASS.

◆ GetErrorStorage()

const ThreadReferencedError& GetErrorStorage ( ) const
private

◆ SetNodeSystem()

void SetNodeSystem ( NodeSystemInterface sys)
protected

◆ PrivateInitFromPath()

static Result<void> PrivateInitFromPath ( GNODE &  node,
typename GNODE::NodeSystemCtorParam  system,
PATH &&  path,
NODE_KIND  check 
)
staticprotected

Friends And Related Function Documentation

◆ NodeSystemImpl

friend class NodeSystemImpl
friend

◆ NodesLibImpl

friend class NodesLibImpl
friend

Member Data Documentation

◆ MUTABLE

const Bool MUTABLE
staticprivate

◆ KIND_MASK

const NODE_KIND KIND_MASK
staticprivate

◆ HAS_ERROR

constexpr Bool HAS_ERROR
staticconstexprprivate

◆ _system

NodeSystemInterface* _system
protected

◆ _node

GNodeHandle _node
protected