Node¶
High-level node management utilities.
Overview¶
Typical use cases:
Managing hierarchical node structures.
Header¶
<RaeptorCogs/Node.hpp>
Metadata¶
- Author
Estorc
- Version
v1.0
- Copyright
Copyright (c) 2025 Estorc MIT License.
Structs¶
Struct |
Description |
|---|---|
|
RegisterNode struct. |
-
template<typename Derived, typename Base>
struct RegisterNode : public Base¶ RegisterNode struct.
Template struct to register a derived node type and update its class IDs.
class MyNode : public RaeptorCogs::RegisterNode<MyNode, RaeptorCogs::Node> {};
- Template Parameters:
Derived – The derived node type.
Base – The base node type.
Classes¶
Class |
Description |
|---|---|
|
Node class. |
-
class Node¶
Node class.
Represents a node in a hierarchical structure and provides utilities for managing parent-child relationships and type identification.
class MyNode : public RaeptorCogs::RegisterNode<MyNode, RaeptorCogs::Node> {}; RaeptorCogs::Node* root = new RaeptorCogs::Node(); RaeptorCogs::Node* child = new MyNode(); root->addChild(child); bool isMyNode = child->isInstanceOf<MyNode>(); // true
Subclassed by RaeptorCogs::RegisterNode< Component, Node >, RaeptorCogs::RegisterNode< Graphic2D, Node >
Public Functions
-
inline virtual BitArray getClassIds() const¶
Get the class IDs BitArray for this node.
- Returns:
BitArray representing the class IDs of this node.
-
template<typename T>
inline bool isInstanceOf() const¶ Check if this node is an instance of the specified type.
bool isMyNode = node->isInstanceOf<MyNode>(); // true if node is of type MyNode
- Template Parameters:
T – The type to check against.
- Returns:
true if this node is an instance of type T, false otherwise.
-
void addChild(Node *child)¶
Add a child node.
Note
Sets the parent of the child node to this node.
- Parameters:
child – Pointer to the child node to add.
-
void removeChild(Node *child)¶
Remove a child node.
Note
Sets the parent of the child node to nullptr.
- Parameters:
child – Pointer to the child node to remove.
Public Static Functions
Protected Functions
Private Members
-
inline virtual BitArray getClassIds() const¶