0.2.0
Loading...
Searching...
No Matches
Pin.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
13
14#pragma once
15
16#include <imgui_node_editor.h>
17
18#include <nlohmann/json.hpp>
19using json = nlohmann::json;
20
21#include <string>
22#include <variant>
23#include <vector>
24#include <memory>
25#include <tuple>
26#include <mutex>
27#include <atomic>
28#include <condition_variable>
29
30#include "util/Logger.hpp"
33
34namespace NAV
35{
36class Node;
37class NodeData;
38class InputPin;
39class OutputPin;
40
42class Pin
43{
44 public:
46 struct Type
47 {
61
63 constexpr Type() = default;
64
67 constexpr Type(Value type) // NOLINT(hicpp-explicit-conversions, google-explicit-constructor)
68 : value(type)
69 {}
70
73 explicit Type(const std::string& typeString)
74 {
75 if (typeString == "Flow")
76 {
77 value = Type::Flow;
78 }
79 else if (typeString == "Bool")
80 {
81 value = Type::Bool;
82 }
83 else if (typeString == "Int")
84 {
85 value = Type::Int;
86 }
87 else if (typeString == "Float")
88 {
89 value = Type::Float;
90 }
91 else if (typeString == "String")
92 {
93 value = Type::String;
94 }
95 else if (typeString == "Object")
96 {
97 value = Type::Object;
98 }
99 else if (typeString == "Matrix")
100 {
101 value = Type::Matrix;
102 }
103 else if (typeString == "Delegate")
104 {
105 value = Type::Delegate;
106 }
107 }
108
110 explicit operator Value() const { return value; }
112 explicit operator bool() = delete;
117 {
118 value = v;
119 return *this;
120 }
121
122 friend constexpr bool operator==(const Pin::Type& lhs, const Pin::Type& rhs);
123 friend constexpr bool operator!=(const Pin::Type& lhs, const Pin::Type& rhs);
124
125 friend constexpr bool operator==(const Pin::Type& lhs, const Pin::Type::Value& rhs);
126 friend constexpr bool operator==(const Pin::Type::Value& lhs, const Pin::Type& rhs);
127 friend constexpr bool operator!=(const Pin::Type& lhs, const Pin::Type::Value& rhs);
128 friend constexpr bool operator!=(const Pin::Type::Value& lhs, const Pin::Type& rhs);
129
132 explicit operator std::string() const
133 {
134 switch (value)
135 {
136 case Type::None:
137 return "None";
138 case Type::Flow:
139 return "Flow";
140 case Type::Bool:
141 return "Bool";
142 case Type::Int:
143 return "Int";
144 case Type::Float:
145 return "Float";
146 case Type::String:
147 return "String";
148 case Type::Object:
149 return "Object";
150 case Type::Matrix:
151 return "Matrix";
152 case Type::Delegate:
153 return "Delegate";
154 }
155 return "";
156 }
157
158 private:
160 Value value = Value::None;
161 };
162
164 struct Kind
165 {
167 enum Value : uint8_t
168 {
172 };
173
175 Kind() = default;
176
179 constexpr Kind(Value kind) // NOLINT(hicpp-explicit-conversions, google-explicit-constructor)
180 : value(kind)
181 {}
182
185 explicit Kind(const std::string& kindString)
186 {
187 if (kindString == "Input")
188 {
189 value = Kind::Input;
190 }
191 else if (kindString == "Output")
192 {
193 value = Kind::Output;
194 }
195 }
196
198 explicit operator Value() const { return value; }
200 explicit operator bool() = delete;
205 {
206 value = v;
207 return *this;
208 }
209
210 friend constexpr bool operator==(const Pin::Kind& lhs, const Pin::Kind& rhs);
211 friend constexpr bool operator!=(const Pin::Kind& lhs, const Pin::Kind& rhs);
212
213 friend constexpr bool operator==(const Pin::Kind& lhs, const Pin::Kind::Value& rhs);
214 friend constexpr bool operator==(const Pin::Kind::Value& lhs, const Pin::Kind& rhs);
215 friend constexpr bool operator!=(const Pin::Kind& lhs, const Pin::Kind::Value& rhs);
216 friend constexpr bool operator!=(const Pin::Kind::Value& lhs, const Pin::Kind& rhs);
217
220 explicit operator std::string() const
221 {
222 switch (value)
223 {
224 case Kind::None:
225 return "None";
226 case Kind::Input:
227 return "Input";
228 case Kind::Output:
229 return "Output";
230 }
231 }
232
233 private:
235 Value value = Value::None;
236 };
237
239 struct Link
240 {
241 ax::NodeEditor::LinkId linkId = 0;
242 Node* connectedNode = nullptr;
243 ax::NodeEditor::PinId connectedPinId = 0;
244
245 protected:
247 Link() = default;
248
253 Link(ax::NodeEditor::LinkId linkId,
255 ax::NodeEditor::PinId connectedPinId)
257 };
258
259 // /// Callback function type to call when firable
260 // using OldFlowCallback = void (Node::*)(const std::shared_ptr<const NodeData>&, ax::NodeEditor::LinkId);
261 // /// Notify function type to call when the connected value changed
262 // using OldNotifyFunc = void (Node::*)(ax::NodeEditor::LinkId);
263 // /// FileReader pollData function type
264 // using OldPollDataFunc = std::shared_ptr<const NAV::NodeData> (Node::*)(bool);
265
272 Pin(ax::NodeEditor::PinId id, const char* name, Type type, Kind kind, Node* parentNode)
274
279 [[nodiscard]] static bool canCreateLink(const OutputPin& startPin, const InputPin& endPin);
280
285 [[nodiscard]] static bool dataIdentifierHaveCommon(const std::vector<std::string>& a, const std::vector<std::string>& b);
286
289 [[nodiscard]] ImColor getIconColor() const;
290
294 void drawPinIcon(bool connected, int alpha) const;
295
297 ax::NodeEditor::PinId id;
299 std::string name;
305 std::vector<std::string> dataIdentifier;
307 Node* parentNode = nullptr;
308
309 protected:
311 Pin() = default;
312
318 static bool createLink(OutputPin& startPin, InputPin& endPin, ax::NodeEditor::LinkId linkId = 0);
319
324 static bool recreateLink(OutputPin& startPin, InputPin& endPin);
325
329 static void deleteLink(OutputPin& startPin, InputPin& endPin);
330
331 private:
333 static constexpr int m_PinIconSize = 24;
334};
335
337class OutputPin : public Pin
338{
339 public:
345 OutputPin(ax::NodeEditor::PinId id, const char* name, Type type, Node* parentNode)
346 : Pin(id, name, type, Pin::Kind::Output, parentNode) {}
347
349 OutputPin() = default;
351 ~OutputPin() = default;
353 OutputPin(const OutputPin&) = delete;
355 OutputPin(OutputPin&& other) noexcept
356 : Pin(std::move(other)),
357 links(std::move(other.links)), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
358 data(other.data), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
359 noMoreDataAvailable(other.noMoreDataAvailable.load()), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
360 blocksConnectedNodeFromFinishing(other.blocksConnectedNodeFromFinishing.load()) // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
361 {}
363 OutputPin& operator=(const OutputPin&) = delete;
365 OutputPin& operator=(OutputPin&& other) noexcept
366 {
367 if (this != &other)
368 {
369 links = std::move(other.links);
370 data = other.data;
371 noMoreDataAvailable = other.noMoreDataAvailable.load();
372 blocksConnectedNodeFromFinishing = other.blocksConnectedNodeFromFinishing.load();
373 Pin::operator=(std::move(other));
374 }
375 return *this;
376 }
377
381 [[nodiscard]] bool canCreateLink(const InputPin& other) const;
382
385 [[nodiscard]] bool isPinLinked() const;
386
390 [[nodiscard]] bool isPinLinked(const InputPin& endPin) const;
391
396 bool createLink(InputPin& endPin, ax::NodeEditor::LinkId linkId = 0);
397
401 bool recreateLink(InputPin& endPin);
402
405 void deleteLink(InputPin& endPin);
406
409
411 struct OutgoingLink : public Link
412 {
414 OutgoingLink() = default;
415
420 OutgoingLink(ax::NodeEditor::LinkId linkId,
422 ax::NodeEditor::PinId connectedPinId)
424
426 [[nodiscard]] InputPin* getConnectedPin() const;
427
430 };
431
433 std::vector<OutgoingLink> links;
434
442 using PeekPollDataFunc = std::shared_ptr<const NAV::NodeData> (Node::*)(size_t, bool);
443
445 using PollDataFunc = std::shared_ptr<const NAV::NodeData> (Node::*)();
446
448 using PinData = std::variant<const void*, // Object/Matrix/Delegate
449 const bool*, // Bool
450 const int*, // Int
451 const float*, // Float
452 const double*, // Float
453 const std::string*, // String
454 PeekPollDataFunc, // Flow (FileReader poll data function with peeking)
455 PollDataFunc>; // Flow (FileReader poll data function)
456
458 PinData data = static_cast<void*>(nullptr);
459
461 std::mutex dataAccessMutex;
462
465
467 std::condition_variable dataAccessConditionVariable;
468
470 std::atomic<bool> noMoreDataAvailable = true;
471
473 std::atomic<bool> blocksConnectedNodeFromFinishing = true;
474
475 friend class Pin;
476 friend class InputPin;
477
478 private:
482 void connect(InputPin& endPin, ax::NodeEditor::LinkId linkId = 0);
483
486 void disconnect(InputPin& endPin);
487};
488
490class InputPin : public Pin
491{
492 public:
498 InputPin(ax::NodeEditor::PinId id, const char* name, Type type, Node* parentNode)
499 : Pin(id, name, type, Pin::Kind::Input, parentNode) {}
500
502 InputPin() = default;
504 ~InputPin() = default;
506 InputPin(const InputPin&) = delete;
508 InputPin(InputPin&& other) noexcept
509 : Pin(std::move(other)),
510 link(other.link), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
511 callback(other.callback), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
512 firable(other.firable), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
513 priority(other.priority), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
514 neededForTemporalQueueCheck(other.neededForTemporalQueueCheck), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
515 dropQueueIfNotFirable(other.dropQueueIfNotFirable), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
516 queueBlocked(other.queueBlocked), // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
517 queue(other.queue) // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
518 {}
520 InputPin& operator=(const InputPin&) = delete;
522 InputPin& operator=(InputPin&& other) noexcept
523 {
524 if (this != &other)
525 {
526 // copy if trivially-copyable, otherwise move
527 link = other.link;
528 callback = other.callback;
529 firable = other.firable;
530 priority = other.priority;
531 neededForTemporalQueueCheck = other.neededForTemporalQueueCheck;
532 dropQueueIfNotFirable = other.dropQueueIfNotFirable;
533 queueBlocked = other.queueBlocked;
534 queue = std::move(other.queue);
535 Pin::operator=(std::move(other));
536 }
537 return *this;
538 }
539
543 [[nodiscard]] bool canCreateLink(const OutputPin& other) const;
544
547 [[nodiscard]] bool isPinLinked() const;
548
553 bool createLink(OutputPin& startPin, ax::NodeEditor::LinkId linkId = 0);
554
558 bool recreateLink(OutputPin& startPin);
559
562
564 struct IncomingLink : public Link
565 {
567 IncomingLink() = default;
568
573 IncomingLink(ax::NodeEditor::LinkId linkId,
575 ax::NodeEditor::PinId connectedPinId)
577
579 [[nodiscard]] OutputPin* getConnectedPin() const;
580
582 template<typename T>
584 {
585 public:
590 ValueWrapper(const T* v, OutputPin* outputPin, bool& dataChangeNotification)
591 : v(v), outputPin(outputPin)
592 {
593 std::scoped_lock guard(outputPin->dataAccessMutex);
594 if (!dataChangeNotification)
595 {
596 outputPin->dataAccessCounter++;
597 }
598 dataChangeNotification = false; // We take 'ownership' of the incremented dataAccessCounter
599 }
602 {
603 if (outputPin)
604 {
605 std::scoped_lock guard(outputPin->dataAccessMutex);
606 if (outputPin->dataAccessCounter > 0)
607 {
608 outputPin->dataAccessCounter--;
609 if (outputPin->dataAccessCounter == 0)
610 {
611 outputPin->dataAccessConditionVariable.notify_all();
612 }
613 }
614 }
615 }
616
619 : v(other.v), outputPin(other.outputPin)
620 {
621 std::scoped_lock guard(outputPin->dataAccessMutex);
622 outputPin->dataAccessCounter++;
623 }
625 ValueWrapper(ValueWrapper&& other) noexcept
626 : v(std::move(other.v)), outputPin(std::move(other.outputPin)) {}
629 {
630 if (this != &other)
631 {
632 v = other.v;
633 outputPin = other.outputPin;
634 std::scoped_lock guard(outputPin->dataAccessMutex);
635 outputPin->dataAccessCounter++;
636 }
637 return *this;
638 }
641 {
642 if (this != &other)
643 {
644 v = std::move(other.v);
645 outputPin = std::move(other.outputPin);
646 }
647 return *this;
648 }
649
651 const T* v;
652
653 private:
655 OutputPin* outputPin;
656 };
657
661 template<typename T>
662 [[nodiscard]] std::optional<ValueWrapper<T>> getValue() const
663 {
664 if (auto* connectedPin = getConnectedPin())
665 {
666 // if (!connectedPin->parentNode->isInitialized()) { return nullptr; } // TODO: Check this here (Problem: member access into incomplete type 'NAV::Node')
667
668 auto outgoingLink = std::find_if(connectedPin->links.begin(), connectedPin->links.end(), [&](const OutputPin::OutgoingLink& link) {
669 return link.linkId == linkId;
670 });
671
672 // clang-format off
673 if constexpr (std::is_same_v<T, bool>
674 || std::is_same_v<T, int>
675 || std::is_same_v<T, float>
676 || std::is_same_v<T, double>
677 || std::is_same_v<T, std::string>) // clang-format on
678 {
679 if (const auto* pVal = std::get_if<const T*>(&(connectedPin->data));
680 pVal && *pVal)
681 {
682 return ValueWrapper<T>(*pVal, connectedPin, outgoingLink->dataChangeNotification);
683 }
684 }
685 else
686 {
687 if (const auto* pVal = std::get_if<const void*>(&(connectedPin->data));
688 pVal && *pVal)
689 {
690 return ValueWrapper<T>(static_cast<const T*>(*pVal), connectedPin, outgoingLink->dataChangeNotification);
691 }
692 }
693 }
694
695 return std::nullopt;
696 }
697 };
698
701
704
708 using FlowFirableCallbackFunc = void (Node::*)(NodeDataQueue&, size_t);
712 using DataChangedNotifyFunc = void (Node::*)(const InsTime&, size_t);
714 using Callback = std::variant<FlowFirableCallbackFunc, // Flow: Callback function type to call when firable
715 DataChangedNotifyFunc>; // Other: Notify function type to call when the connected value changed
716
719
721 using FlowFirableCheckFunc = bool (*)(const Node*, const InputPin&);
722
724 FlowFirableCheckFunc firable = [](const Node*, const InputPin& inputPin) { return !inputPin.queue.empty() && !inputPin.queueBlocked; };
725
727 int priority = 0;
728
731
734
736 bool queueBlocked = false;
737
740
741#ifdef TESTING
745 using FlowFirableWatcherCallbackFunc = std::function<void(const Node*, const NodeDataQueue&, size_t)>;
749 using DataChangedWatcherNotifyFunc = std::function<void(const Node*, const InsTime&, size_t)>;
750
752 using WatcherCallback = std::variant<FlowFirableWatcherCallbackFunc, // Flow: Callback function type to call when firable
753 DataChangedWatcherNotifyFunc>; // Other: Notify function type to call when the connected value changed
754
756 std::vector<WatcherCallback> watcherCallbacks;
757#endif
758
759 friend class Pin;
760 friend class OutputPin;
761
762 private:
766 void connect(OutputPin& startPin, ax::NodeEditor::LinkId linkId = 0);
767
769 void disconnect();
770};
771
776constexpr bool operator==(const Pin::Kind& lhs, const Pin::Kind& rhs) { return lhs.value == rhs.value; }
781constexpr bool operator!=(const Pin::Kind& lhs, const Pin::Kind& rhs) { return !(lhs == rhs); }
782
787constexpr bool operator==(const Pin::Kind& lhs, const Pin::Kind::Value& rhs) { return lhs.value == rhs; }
792constexpr bool operator==(const Pin::Kind::Value& lhs, const Pin::Kind& rhs) { return lhs == rhs.value; }
797constexpr bool operator!=(const Pin::Kind& lhs, const Pin::Kind::Value& rhs) { return !(lhs == rhs); }
802constexpr bool operator!=(const Pin::Kind::Value& lhs, const Pin::Kind& rhs) { return !(lhs == rhs); }
803
808constexpr bool operator==(const Pin::Type& lhs, const Pin::Type& rhs) { return lhs.value == rhs.value; }
813constexpr bool operator!=(const Pin::Type& lhs, const Pin::Type& rhs) { return !(lhs == rhs); }
814
819constexpr bool operator==(const Pin::Type& lhs, const Pin::Type::Value& rhs) { return lhs.value == rhs; }
824constexpr bool operator==(const Pin::Type::Value& lhs, const Pin::Type& rhs) { return lhs == rhs.value; }
829constexpr bool operator!=(const Pin::Type& lhs, const Pin::Type::Value& rhs) { return !(lhs == rhs); }
834constexpr bool operator!=(const Pin::Type::Value& lhs, const Pin::Type& rhs) { return !(lhs == rhs); }
835
839void to_json(json& j, const OutputPin& pin);
843void from_json(const json& j, OutputPin& pin);
844
848void to_json(json& j, const InputPin& pin);
852void from_json(const json& j, InputPin& pin);
853
854} // namespace NAV
nlohmann::json json
json namespace
Definition FlowManager.hpp:21
The class is responsible for all time-related tasks.
void from_json(const json &j, ImColor &color)
Converts the provided json object into a color.
void to_json(json &j, const ImColor &color)
Converts the provided color into a json object.
Utility class for logging to console and file.
Thread-safe deque.
Input pins of nodes.
Definition Pin.hpp:491
InputPin(const InputPin &)=delete
Copy constructor.
IncomingLink link
Info to identify the linked pin.
Definition Pin.hpp:700
InputPin(ax::NodeEditor::PinId id, const char *name, Type type, Node *parentNode)
Constructor.
Definition Pin.hpp:498
bool createLink(OutputPin &startPin, ax::NodeEditor::LinkId linkId=0)
Creates a link from this pin to another, calling all node specific callbacks.
bool isPinLinked() const
Checks if the pin is linked.
bool recreateLink(OutputPin &startPin)
Destroys and recreates a link from this pin to another.
Callback callback
Callback to call when the node is firable or when it should be notified of data change.
Definition Pin.hpp:718
FlowFirableCheckFunc firable
Function to check if the callback is firable.
Definition Pin.hpp:724
void(Node::*)(NodeDataQueue &, size_t) FlowFirableCallbackFunc
Definition Pin.hpp:708
std::variant< FlowFirableCallbackFunc, DataChangedNotifyFunc > Callback
Callback function types.
Definition Pin.hpp:714
bool(*)(const Node *, const InputPin &) FlowFirableCheckFunc
Function type to call when checking if a pin is firable.
Definition Pin.hpp:721
void(Node::*)(const InsTime &, size_t) DataChangedNotifyFunc
Definition Pin.hpp:712
InputPin & operator=(const InputPin &)=delete
Copy assignment operator.
void deleteLink()
Disconnects the link.
InputPin()=default
Default constructor (for serialization)
bool queueBlocked
If true no more messages are accepted to the queue.
Definition Pin.hpp:736
bool canCreateLink(const OutputPin &other) const
Checks if this pin can connect to the provided pin.
InputPin & operator=(InputPin &&other) noexcept
Move assignment operator.
Definition Pin.hpp:522
~InputPin()=default
Destructor.
InputPin(InputPin &&other) noexcept
Move constructor.
Definition Pin.hpp:508
bool neededForTemporalQueueCheck
Whether it should be checked for temporal ordering.
Definition Pin.hpp:730
int priority
Priority when checking firable condition related to other pins (higher priority gets triggered first)
Definition Pin.hpp:727
NodeDataQueue queue
Queue with received data.
Definition Pin.hpp:739
bool dropQueueIfNotFirable
If true, drops elements from the queue if not firable, otherwise sleeps the worker.
Definition Pin.hpp:733
The class is responsible for all time-related tasks.
Definition InsTime.hpp:667
Abstract parent class for all nodes.
Definition Node.hpp:86
Output pins of nodes.
Definition Pin.hpp:338
OutputPin(ax::NodeEditor::PinId id, const char *name, Type type, Node *parentNode)
Constructor.
Definition Pin.hpp:345
bool recreateLink(InputPin &endPin)
Destroys and recreates a link from this pin to another.
std::mutex dataAccessMutex
Mutex to interact with the data object and also the dataAccessCounter variable.
Definition Pin.hpp:461
bool createLink(InputPin &endPin, ax::NodeEditor::LinkId linkId=0)
Creates a link from this pin to another, calling all node specific callbacks.
void deleteLink(InputPin &endPin)
Disconnects the link.
void deleteLinks()
Disconnects all links.
OutputPin(const OutputPin &)=delete
Copy constructor.
std::shared_ptr< const NAV::NodeData >(Node::*)(size_t, bool) PeekPollDataFunc
FileReader/Simulator peekPollData function type for nodes with more than one polling pin.
Definition Pin.hpp:442
OutputPin & operator=(const OutputPin &)=delete
Copy assignment operator.
std::condition_variable dataAccessConditionVariable
Condition variable to signal that the data was read by connected nodes (used for non-flow pins)
Definition Pin.hpp:467
size_t dataAccessCounter
Counter for data accessing.
Definition Pin.hpp:464
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.
Definition Pin.hpp:448
OutputPin()=default
Default constructor (for serialization)
OutputPin & operator=(OutputPin &&other) noexcept
Move assignment operator.
Definition Pin.hpp:365
PinData data
Pointer to data (owned by this node) which is transferred over this pin.
Definition Pin.hpp:458
OutputPin(OutputPin &&other) noexcept
Move constructor.
Definition Pin.hpp:355
bool isPinLinked() const
Checks if the pin is linked.
std::vector< OutgoingLink > links
Info to identify the linked pins.
Definition Pin.hpp:433
bool isPinLinked(const InputPin &endPin) const
Checks if the pin is linked to the other pin.
std::shared_ptr< const NAV::NodeData >(Node::*)() PollDataFunc
FileReader/Simulator pollData function type for nodes with a single poll pin.
Definition Pin.hpp:445
std::atomic< bool > blocksConnectedNodeFromFinishing
Flag, whether connected nodes can finish with this pin not being finished yet (needed to make a loop ...
Definition Pin.hpp:473
std::atomic< bool > noMoreDataAvailable
Flag set, when no more data is available on this pin.
Definition Pin.hpp:470
bool canCreateLink(const InputPin &other) const
Checks if this pin can connect to the provided pin.
~OutputPin()=default
Destructor.
Pins in the GUI for information exchange.
Definition Pin.hpp:43
static bool canCreateLink(const OutputPin &startPin, const InputPin &endPin)
Checks if pins can connect.
Node * parentNode
Reference to the parent node.
Definition Pin.hpp:307
std::string name
Name of the Pin.
Definition Pin.hpp:299
void drawPinIcon(bool connected, int alpha) const
Draw the Pin Icon.
ax::NodeEditor::PinId id
Unique Id of the Pin.
Definition Pin.hpp:297
std::vector< std::string > dataIdentifier
One or multiple Data Identifiers (Unique name which is used for data flows)
Definition Pin.hpp:305
Type type
Type of the Pin.
Definition Pin.hpp:301
static bool createLink(OutputPin &startPin, InputPin &endPin, ax::NodeEditor::LinkId linkId=0)
Create a Link between the two given pins.
static void deleteLink(OutputPin &startPin, InputPin &endPin)
Disconnects the link.
Pin(ax::NodeEditor::PinId id, const char *name, Type type, Kind kind, Node *parentNode)
Constructor.
Definition Pin.hpp:272
static bool dataIdentifierHaveCommon(const std::vector< std::string > &a, const std::vector< std::string > &b)
Checks if the first list of data identifiers has a common entry with the second.
Kind kind
Kind of the Pin (Input/Output)
Definition Pin.hpp:303
ImColor getIconColor() const
Get the Icon Color object.
static bool recreateLink(OutputPin &startPin, InputPin &endPin)
Destroys and recreates a link from this pin to another.
Pin()=default
Default constructor.
bool operator==(const ImVec4 &lhs, const ImVec4 &rhs)
Equal comparison operator.
bool operator!=(const ImVec4 &lhs, const ImVec4 &rhs)
Unequal comparison operator.
Kind of the Pin (Input/Output)
Definition Pin.hpp:165
Kind & operator=(Value v)
Assignment operator from Value type.
Definition Pin.hpp:204
constexpr Kind(Value kind)
Implicit Constructor from Value type.
Definition Pin.hpp:179
Value
Kind of the Pin (Input/Output)
Definition Pin.hpp:168
@ Input
Input Pin.
Definition Pin.hpp:171
@ Output
Output Pin.
Definition Pin.hpp:170
@ None
None.
Definition Pin.hpp:169
friend constexpr bool operator!=(const Pin::Kind &lhs, const Pin::Kind &rhs)
Inequal compares Pin::Kind values.
Definition Pin.hpp:781
friend constexpr bool operator==(const Pin::Kind &lhs, const Pin::Kind &rhs)
Equal compares Pin::Kind values.
Definition Pin.hpp:776
Kind()=default
Default Constructor.
Kind(const std::string &kindString)
Constructor from std::string.
Definition Pin.hpp:185
Type of the data on the Pin.
Definition Pin.hpp:47
Value
Type of the data on the Pin.
Definition Pin.hpp:50
@ Delegate
Reference to the Node object.
Definition Pin.hpp:59
@ None
Not initialized.
Definition Pin.hpp:51
@ Matrix
Matrix Object.
Definition Pin.hpp:58
@ Int
Integer Number.
Definition Pin.hpp:54
@ Float
Floating Point Number.
Definition Pin.hpp:55
@ String
std::string
Definition Pin.hpp:56
@ Flow
NodeData Trigger.
Definition Pin.hpp:52
@ Bool
Boolean.
Definition Pin.hpp:53
@ Object
Generic Object.
Definition Pin.hpp:57
constexpr Type(Value type)
Implicit Constructor from Value type.
Definition Pin.hpp:67
friend constexpr bool operator!=(const Pin::Type &lhs, const Pin::Type &rhs)
Inequal compares Pin::Type values.
Definition Pin.hpp:813
Type(const std::string &typeString)
Constructor from std::string.
Definition Pin.hpp:73
friend constexpr bool operator==(const Pin::Type &lhs, const Pin::Type &rhs)
Equal compares Pin::Type values.
Definition Pin.hpp:808
Type & operator=(Value v)
Assignment operator from Value type.
Definition Pin.hpp:116
constexpr Type()=default
Default Constructor.