#pragma once #include #include #include #include "Export.hpp" #include "PortType.hpp" #include "NodeData.hpp" #include "memory.hpp" namespace QtNodes { class Connection; class NodeDataModel; /// Contains vectors of connected input and output connections. /// Stores bool for reacting on hovering connections class NodeState { public: enum ReactToConnectionState { REACTING, NOT_REACTING }; public: NodeState(std::unique_ptr const& model); public: using ConnectionPtrSet = std::unordered_map; /// Returns vector of connections ID. /// Some of them can be empty (null) std::vector const& getEntries(PortType) const; std::vector& getEntries(PortType); ConnectionPtrSet connections(PortType portType, PortIndex portIndex) const; void setConnection(PortType portType, PortIndex portIndex, Connection& connection); void eraseConnection(PortType portType, PortIndex portIndex, QUuid id); ReactToConnectionState reaction() const; PortType reactingPortType() const; NodeDataType reactingDataType() const; void setReaction(ReactToConnectionState reaction, PortType reactingPortType = PortType::None, NodeDataType reactingDataType = NodeDataType()); bool isReacting() const; void setResizing(bool resizing); bool resizing() const; private: std::vector _inConnections; std::vector _outConnections; ReactToConnectionState _reaction; PortType _reactingPortType; NodeDataType _reactingDataType; bool _resizing; }; }