1#ifndef BUSINESS_LOGIC_INPUT_CONNECT_PORTS_INTERACTION_H
2#define BUSINESS_LOGIC_INPUT_CONNECT_PORTS_INTERACTION_H
33 logger->info(
"Interaction is invalid, resetting");
43 blockLifecycleManagerDelegate) {
47 "Interaction handling new event; it was already started, completing it");
51 .
block = block, .port = port});
66 logger->warn(
"Connection is invalid: start and end blocks are the same");
70 "This connection is invalid. A valid connection must "
71 "be between an input and output port of different blocks.");
76 logger->warn(
"Connection is invalid: connection already exists");
79 "Such a connection already exists.");
84 "Connection is invalid: input port is already connected to "
89 "The chosen input port is already connected.");
92 "Connection created between port '{}' (block {}) and port '{}' "
98 endSide.value().block->getSelfId());
108 "Invalid connection: start side and end side are not valid port types");
111 "Invalid connection",
112 "This connection is invalid. A valid connection must "
113 "be between an input and output port (the order is "
122 logger->info(
"Interaction handling new event; it was not started, starting it");
126 .
block = block, .port = port});
133 [[maybe_unused]]
const std::optional<
142 [[maybe_unused]]
const std::optional<
160 std::optional<business_logic::elements::structures::BlocksConnectionSide>
startSide;
165 std::optional<business_logic::elements::structures::BlocksConnectionSide>
endSide;
Class that provides a logger for the given class; automatically deduces the logger.
std::shared_ptr< spdlog::logger > logger
Delegate that manages the lifecycles of blocks.
virtual bool isInputConnected(const business_logic::elements::structures::BlocksConnectionSide &side) const =0
Checks if the input port is connected to anything.
virtual void onPortsConnected(const business_logic::elements::structures::BlocksConnectionSide &source, const business_logic::elements::structures::BlocksConnectionSide &dest)=0
Invoked when a connection is made between two ports + blocks (sides)
virtual bool hasConnectionBetween(const business_logic::elements::structures::BlocksConnectionSide &source, const business_logic::elements::structures::BlocksConnectionSide &dest) const =0
Checks if there is a connection between two entities.
The delegate for the window.
virtual void showWarning(const std::string &title, const std::string &message)=0
Show a warning message.
The base class for all blocks, containing common functionality and members.
A side of a connection between two ports.
business_logic::elements::blocks::BaseBlock * block
The block.
Represents a port on a block.