FlowArithmeticCalculator 1.0.0
Flow Arithmetic Calculator
Loading...
Searching...
No Matches
PowerBlock.cpp
Go to the documentation of this file.
1#include "PowerBlock.h"
2
3#include <cmath>
4
6
8 int cx,
9 int cy,
13 : BaseBlock(cx,
14 cy,
15 POWER_BLOCK_WIDTH,
16 POWER_BLOCK_HEIGHT,
17 newBlockChoiceDelegate,
18 blockLifecycleManagerDelegate,
19 windowDelegate,
20 logger),
21 selfId(business_logic::stringifyAddressOf(this)) {}
22
24 // NOLINTNEXTLINE
25 this->portValues[&outputPorts[0]] = boost::multiprecision::pow(
26 this->getPortValue(&inputPorts[0]), this->getPortValue(&inputPorts[1]));
27 }
28
29 const std::vector<business_logic::elements::structures::Port> PowerBlock::inputPorts = {
32 };
33
34 const std::vector<business_logic::elements::structures::Port> PowerBlock::outputPorts = {
36 };
37
38} // namespace business_logic::elements::blocks
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
const FloatingPoint & getPortValue(const structures::Port *port) const
Gets the value of the port.
std::unordered_map< const structures::Port *, FloatingPoint > portValues
The registry of port values.
Definition BaseBlock.h:290
static const std::vector< business_logic::elements::structures::Port > outputPorts
Definition PowerBlock.h:50
void calculateOutputValues() override
Calculates the output port values based on input port values.
PowerBlock(int cx, int cy, business_logic::delegate::INewBlockChoiceDelegate *newBlockChoiceDelegate, business_logic::delegate::IBlockLifecycleManagerDelegate *blockLifecycleManagerDelegate, business_logic::delegate::IWindowDelegate *windowDelegate)
Definition PowerBlock.cpp:7
static const std::vector< business_logic::elements::structures::Port > inputPorts
Definition PowerBlock.h:49
The base classes and structs for elements.
The business logic module.
std::string stringifyAddressOf(const T *value)
Convert a pointer to a string in format "0x..." containing its hexadecimal address.
Definition misc.h:16