FlowArithmeticCalculator 1.0.0
Flow Arithmetic Calculator
Loading...
Searching...
No Matches
AddBlock.h
Go to the documentation of this file.
1#ifndef BUSINESS_LOGIC_ELEMENTS_IMPL_ADD_BLOCK_H
2#define BUSINESS_LOGIC_ELEMENTS_IMPL_ADD_BLOCK_H
3
5#include "logging/Loggable.h"
6#include "typenames.h"
7#include "utils/misc.h"
8
13 class AddBlock final : public business_logic::Loggable<AddBlock>,
15 public:
17 int cx,
18 int cy,
22
23 std::string getSelfId() const override { return selfId; }
24
25 void calculateOutputValues() override;
26
27 protected:
29
30 std::string selfId;
31
32 static constexpr int ADD_BLOCK_WIDTH = 120;
33 static constexpr int ADD_BLOCK_HEIGHT = 120;
34
35 const std::vector<business_logic::elements::structures::Port>& getInputPorts()
36 const override {
37 return inputPorts;
38 }
39
40 const std::vector<business_logic::elements::structures::Port>& getOutputPorts()
41 const override {
42 return outputPorts;
43 }
44
48
49 static const std::vector<business_logic::elements::structures::Port> inputPorts;
50 static const std::vector<business_logic::elements::structures::Port> outputPorts;
51 };
52} // namespace business_logic::elements::blocks
53
54#endif // BUSINESS_LOGIC_ELEMENTS_IMPL_ADD_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.
A block that adds two input values together and outputs their sum.
Definition AddBlock.h:14
std::string getSelfId() const override
Definition AddBlock.h:23
static const std::vector< business_logic::elements::structures::Port > inputPorts
Definition AddBlock.h:49
const std::vector< business_logic::elements::structures::Port > & getOutputPorts() const override
Gets the output ports of the block.
Definition AddBlock.h:40
void calculateOutputValues() override
Calculates the output port values based on input port values.
Definition AddBlock.cpp:21
static const std::vector< business_logic::elements::structures::Port > outputPorts
Definition AddBlock.h:50
const std::vector< business_logic::elements::structures::Port > & getInputPorts() const override
Gets the input ports of the block.
Definition AddBlock.h:35
business_logic::elements::blocks::BlockType getBlockType() const override
Gets the type of the block.
Definition AddBlock.h:45
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
business_logic::delegate::INewBlockChoiceDelegate * newBlockChoiceDelegate
Definition BaseBlock.h:295
business_logic::delegate::IWindowDelegate * windowDelegate
Definition BaseBlock.h:307
The base classes and structs for elements.
BlockType
The available block types.
Definition BlockType.h:10