32std::vector<NAV::Node*> m_nodes;
 
   41#if !defined(WIN32) && !defined(_WIN32) && !defined(__WIN32) 
 
   66    m_nodes.push_back(node);
 
   71        pin.parentNode = node;
 
   75        pin.parentNode = node;
 
   78    m_NextId = std::max(m_NextId, 
size_t(node->
id) + 1);
 
   81        m_NextId = std::max(m_NextId, 
size_t(pin.id) + 1);
 
   85        m_NextId = std::max(m_NextId, 
size_t(pin.id) + 1);
 
 
   96        pin.parentNode = node;
 
  100        pin.parentNode = node;
 
  105        m_NextId = std::max(m_NextId, 
size_t(pin.id) + 1);
 
  109        m_NextId = std::max(m_NextId, 
size_t(pin.id) + 1);
 
 
  115    LOG_TRACE(
"called for node with id {}", 
size_t(nodeId));
 
  117    auto it = std::ranges::find_if(m_nodes, [nodeId](
const auto& node) { 
return node->id == nodeId; });
 
  118    if (it != m_nodes.end())
 
  130            if (inputPin.isPinLinked())
 
  132                inputPin.deleteLink();
 
  137            if (outputPin.isPinLinked())
 
  139                outputPin.deleteLinks();
 
 
  160    while (!m_nodes.empty())
 
 
  173    m_NextId = std::max(m_NextId, 
size_t(linkId) + 1);
 
 
  179    LOG_TRACE(
"called for pin ({}) of type ({}) for node [{}]", name, std::string(pinType), node->
nameId());
 
  182        idx = 
static_cast<int>(node->
inputPins.size());
 
  184    idx = std::min(idx, 
static_cast<int>(node->
inputPins.size()));
 
  185    auto iter = std::next(node->
inputPins.begin(), idx);
 
  189    node->
inputPins.at(
static_cast<size_t>(idx)).callback = callback;
 
  190    if (firable != 
nullptr)
 
  192        node->
inputPins.at(
static_cast<size_t>(idx)).firable = firable;
 
  194    node->
inputPins.at(
static_cast<size_t>(idx)).dataIdentifier = dataIdentifier;
 
  195    node->
inputPins.at(
static_cast<size_t>(idx)).priority = priority;
 
  199    return &node->
inputPins.at(
static_cast<size_t>(idx));
 
 
  204    LOG_TRACE(
"called for pin ({}) of type ({}) for node [{}]", name, std::string(pinType), node->
nameId());
 
  207        idx = 
static_cast<int>(node->
outputPins.size());
 
  209    idx = std::min(idx, 
static_cast<int>(node->
outputPins.size()));
 
  210    auto iter = std::next(node->
outputPins.begin(), idx);
 
  214    node->
outputPins.at(
static_cast<size_t>(idx)).data = data;
 
  215    node->
outputPins.at(
static_cast<size_t>(idx)).dataIdentifier = dataIdentifier;
 
  219    return &node->
outputPins.at(
static_cast<size_t>(idx));
 
 
  241    LOG_DEBUG(
"Erasing pin at idx {}", pinIndex);
 
 
  262    return { GetNextId() };
 
 
  267    return { GetNextId() };
 
 
  272    return { GetNextId() };
 
 
  277    for (
auto& node : m_nodes)
 
 
  290    if (!
id) { 
return nullptr; }
 
  292    for (
auto& node : m_nodes)
 
  295        for (
auto& pin : node->outputPins)
 
  297            if (pin.id == 
id) { 
return &pin; }
 
 
  306    if (!
id) { 
return nullptr; }
 
  308    for (
auto& node : m_nodes)
 
  311        for (
auto& pin : node->inputPins)
 
  313            if (pin.id == 
id) { 
return &pin; }
 
 
  323    for (
auto* node : m_nodes)
 
  327            node->callbacksEnabled = 
true;
 
 
  335    for (
auto* node : m_nodes)
 
  337        node->callbacksEnabled = 
false;
 
 
  344    for (
auto* node : m_nodes)
 
  346        for (
auto& inputPin : node->inputPins)
 
  348            inputPin.queue.clear();
 
 
  356    bool nodeCouldNotInitialize = 
false;
 
  360    for (
auto* node : m_nodes)
 
  362        if (node && node->kind != 
Node::Kind::GroupBox && !node->isDisabled() && !node->isInitialized())
 
  364            if (!node->doInitialize(
true))
 
  366                LOG_ERROR(
"Node '{}' could not initialize.", node->nameId());
 
  367                nodeCouldNotInitialize = 
true;
 
  372    return !nodeCouldNotInitialize;
 
 
  379    for (
auto* node : m_nodes)
 
  381        if (node && node->kind != 
Node::Kind::GroupBox && !node->isDisabled() && !node->isInitialized())
 
  383            node->doInitialize();
 
 
  392std::vector<std::pair<ax::NodeEditor::PinId, NAV::InputPin::WatcherCallback>> watcherPinList;
 
  393std::vector<std::pair<ax::NodeEditor::LinkId, NAV::InputPin::WatcherCallback>> watcherLinkList;
 
  395std::function<void()> preInitCallback = 
nullptr;
 
  396std::function<void()> cleanupCallback = 
nullptr;
 
  400void NAV::NodeManager::RegisterWatcherCallbackToInputPin(ax::NodeEditor::PinId 
id, 
const InputPin::WatcherCallback& callback)
 
  402    watcherPinList.emplace_back(
id, callback);
 
  405void NAV::NodeManager::RegisterWatcherCallbackToLink(ax::NodeEditor::LinkId 
id, 
const InputPin::WatcherCallback& callback)
 
  407    watcherLinkList.emplace_back(
id, callback);
 
  410void NAV::NodeManager::ApplyWatcherCallbacks()
 
  412    for (
auto& [linkId, callback] : watcherLinkList)
 
  414        for (
auto& node : m_nodes)
 
  416            for (
size_t pinIdx = 0; pinIdx < node->inputPins.size(); pinIdx++)
 
  418                auto& pin = node->inputPins[pinIdx];
 
  419                if (pin.isPinLinked() && pin.link.linkId == linkId)
 
  421                    LOG_DEBUG(
"Adding watcher callback on node '{}' on pin with index {}", pin.parentNode->nameId(), pinIdx);
 
  422                    pin.watcherCallbacks.emplace_back(callback);
 
  428    for (
auto& [
id, callback] : watcherPinList)
 
  430        for (
auto& node : m_nodes)
 
  432            for (
size_t pinIdx = 0; pinIdx < node->inputPins.size(); pinIdx++)
 
  434                auto& pin = node->inputPins[pinIdx];
 
  437                    LOG_DEBUG(
"Adding watcher callback on node '{}' on pin with index {}", pin.parentNode->nameId(), pinIdx);
 
  438                    pin.watcherCallbacks.emplace_back(callback);
 
  445void NAV::NodeManager::RegisterPreInitCallback(std::function<
void()> callback)
 
  447    preInitCallback = std::move(callback);
 
  450void NAV::NodeManager::CallPreInitCallback()
 
  458void NAV::NodeManager::RegisterCleanupCallback(std::function<
void()> callback)
 
  460    cleanupCallback = std::move(callback);
 
  462void NAV::NodeManager::CallCleanupCallback()
 
  470void NAV::NodeManager::ClearRegisteredCallbacks()
 
  472    watcherPinList.clear();
 
  473    watcherLinkList.clear();
 
  474    preInitCallback = 
nullptr;
 
  475    cleanupCallback = 
nullptr;
 
#define LOG_DEBUG
Debug information. Should not be called on functions which receive observations (spamming)
#define LOG_ERROR
Error occurred, which stops part of the program to work, but not everything.
#define LOG_TRACE
Detailled info to trace the execution of the program. Should not be called on functions which receive...
Utility class which specifies available nodes.
Abstract parent class for all nodes.
bool isInitialized() const
Checks if the node is initialized.
bool doDeinitialize(bool wait=false)
Asks the node worker to deinitialize the node.
std::vector< OutputPin > outputPins
List of output pins.
size_t outputPinIndexFromId(ax::NodeEditor::PinId pinId) const
Returns the index of the pin.
std::vector< InputPin > inputPins
List of input pins.
std::string nameId() const
Node name and id.
size_t inputPinIndexFromId(ax::NodeEditor::PinId pinId) const
Returns the index of the pin.
ax::NodeEditor::NodeId id
Unique Id of the Node.
void deleteLinks()
Disconnects all links.
std::variant< const void *, const bool *, const int *, const float *, const double *, const std::string *, PeekPollDataFunc, PollDataFunc > PinData
Possible Types represented by an output pin.
Node * parentNode
Reference to the parent node.
ax::NodeEditor::PinId id
Unique Id of the Pin.
void ClearAllNodeQueues()
Clears all nodes queues.
OutputPin * CreateOutputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier, OutputPin::PinData data=static_cast< void * >(nullptr), int idx=-1)
Create an Output Pin object.
ax::NodeEditor::LinkId GetNextLinkId()
Generates a new link id.
bool showFlowWhenNotifyingValueChange
Flag if notifyOutputValueChanged & notifyInputValueChanged triggers a GUI Flow event.
bool DeleteOutputPin(OutputPin &pin)
Deletes the output pin. Invalidates the pin reference given.
bool DeleteNode(ax::NodeEditor::NodeId nodeId)
Delete the node provided by id.
InputPin * FindInputPin(ax::NodeEditor::PinId id)
Finds the Pin for the PinId.
void InitializeAllNodesAsync()
Initializes all nodes in a separate thread.
void UpdateNode(Node *node)
Update the provided node object.
void AddLink(ax::NodeEditor::LinkId linkId)
Adds the link.
OutputPin * FindOutputPin(ax::NodeEditor::PinId id)
Finds the Pin for the PinId.
void EnableAllCallbacks()
Enables all Node callbacks.
void DisableAllCallbacks()
Disables all Node callbacks.
ax::NodeEditor::NodeId GetNextNodeId()
Generates a new node id.
bool InitializeAllNodes()
Initializes all nodes.
bool DeleteInputPin(InputPin &pin)
Deletes the input pin. Invalidates the pin reference given.
void DeleteAllNodes()
Delete all nodes.
const std::vector< Node * > & m_Nodes()
List of all registered Nodes.
void AddNode(Node *node)
Add the provided node object to the list of nodes.
ax::NodeEditor::PinId GetNextPinId()
Generates a new pin id.
Node * FindNode(ax::NodeEditor::NodeId id)
Finds the Node for the NodeId.
bool showFlowWhenInvokingCallbacks
Flag if invokeCallbacks triggers a GUI Flow event.
InputPin * CreateInputPin(Node *node, const char *name, Pin::Type pinType, const std::vector< std::string > &dataIdentifier={}, InputPin::Callback callback=static_cast< InputPin::FlowFirableCallbackFunc >(nullptr), InputPin::FlowFirableCheckFunc firable=nullptr, int priority=0, int idx=-1)
Create an Input Pin object.
bool saveLastActions
Whether actions should be saved to the last actions list.
void ApplyChanges()
Signals that there have been changes to the flow.
@ GroupBox
Group box which can group other nodes and drag them together.
Type of the data on the Pin.