FlowArithmeticCalculator 1.0.0
Flow Arithmetic Calculator
Loading...
Searching...
No Matches
MonitorBlock.h
Go to the documentation of this file.
1#ifndef BUSINESS_LOGIC_ELEMENTS_IMPL_MONITOR_BLOCK_H
2#define BUSINESS_LOGIC_ELEMENTS_IMPL_MONITOR_BLOCK_H
3
4#include <iomanip>
5#include <sstream>
6
7#include "constants.h"
10#include "logging/Loggable.h"
11#include "utils/misc.h"
12
19 class MonitorBlock final : public business_logic::Loggable<MonitorBlock>,
21 public:
32 int cx,
33 int cy,
37
45 std::optional<std::string> getValueToRenderAboveBlock(
46 [[maybe_unused]] bool isHovered) override;
47
48 std::string getSelfId() const override { return selfId; }
49
50 void calculateOutputValues() override {
51 // do nothing
52 }
53
54 protected:
55 // since Loggable is a template base class, the compiler does not see Logger::logger in the
56 // current scope; so as not to use this->logger explicitly each time, the below brings it to
57 // the current scope explicitly
59
63 std::string selfId;
64
68 static constexpr int MONITOR_BLOCK_WIDTH = 120;
69
73 static constexpr int MONITOR_BLOCK_HEIGHT = 120;
74
78 const std::vector<business_logic::elements::structures::Port>& getInputPorts()
79 const override {
80 return inputPorts;
81 }
82
86 const std::vector<business_logic::elements::structures::Port>& getOutputPorts()
87 const override {
88 return outputPorts;
89 }
90
97
101 static const std::vector<business_logic::elements::structures::Port> inputPorts;
102
106 static const std::vector<business_logic::elements::structures::Port> outputPorts;
107 };
108} // namespace business_logic::elements::blocks
109
110#endif // BUSINESS_LOGIC_ELEMENTS_IMPL_MONITOR_BLOCK_H
Class that provides a logger for the given class; automatically deduces the logger.
Definition Loggable.h:37
Delegate that is notified when a new block is chosen to be added to the canvas.
The base class for all blocks, containing common functionality and members.
Definition BaseBlock.h:36
business_logic::delegate::IBlockLifecycleManagerDelegate * blockLifecycleManagerDelegate
Definition BaseBlock.h:301
std::shared_ptr< spdlog::logger > logger
Definition BaseBlock.h:285
virtual bool isHovered(int x, int y) const
Checks if the block is hovered over by the mouse.
Definition BaseBlock.h:85
business_logic::delegate::INewBlockChoiceDelegate * newBlockChoiceDelegate
Definition BaseBlock.h:295
business_logic::delegate::IWindowDelegate * windowDelegate
Definition BaseBlock.h:307
A monitor block that displays the value of its input port.
static const std::vector< business_logic::elements::structures::Port > inputPorts
const std::vector< business_logic::elements::structures::Port > & getInputPorts() const override
Gets the input ports of the block.
static const std::vector< business_logic::elements::structures::Port > outputPorts
std::optional< std::string > getValueToRenderAboveBlock(bool isHovered) override
Wrapper that gets the value of the output port above the block; if the input port is not connected,...
business_logic::elements::blocks::BlockType getBlockType() const override
Gets the type of the block.
const std::vector< business_logic::elements::structures::Port > & getOutputPorts() const override
Gets the output ports of the block.
void calculateOutputValues() override
Calculates the output port values based on input port values.
The base classes and structs for elements.
BlockType
The available block types.
Definition BlockType.h:10