|
FlowArithmeticCalculator 1.0.0
Flow Arithmetic Calculator
|
A block that subtracts the second input value from the first input value. More...
#include <SubtractBlock.h>
Inheritance diagram for business_logic::elements::blocks::SubtractBlock:
Collaboration diagram for business_logic::elements::blocks::SubtractBlock:Public Member Functions | |
| SubtractBlock (int cx, int cy, business_logic::delegate::INewBlockChoiceDelegate *newBlockChoiceDelegate, business_logic::delegate::IBlockLifecycleManagerDelegate *blockLifecycleManagerDelegate, business_logic::delegate::IWindowDelegate *windowDelegate) | |
| std::string | getSelfId () const override |
| void | calculateOutputValues () override |
| Calculates the output port values based on input port values. | |
Public Member Functions inherited from business_logic::Loggable< SubtractBlock > | |
| Loggable () | |
Public Member Functions inherited from business_logic::elements::blocks::BaseBlock | |
| BaseBlock (int cx, int cy, int blockWidth, int blockHeight, business_logic::delegate::INewBlockChoiceDelegate *newBlockChoiceDelegate, business_logic::delegate::IBlockLifecycleManagerDelegate *blockLifecycleManagerDelegate, business_logic::delegate::IWindowDelegate *windowDelegate, std::shared_ptr< spdlog::logger > logger) | |
| Constructor. | |
| void | updateWidthHeight (int newWidth, int newHeight) |
| Updates the width and height of the block. | |
| ~BaseBlock () noexcept override | |
| BaseBlock (const BaseBlock &)=delete | |
| BaseBlock & | operator= (const BaseBlock &)=delete |
| BaseBlock (BaseBlock &&)=delete | |
| BaseBlock & | operator= (BaseBlock &&)=delete |
| virtual bool | isHovered (int x, int y) const |
| Checks if the block is hovered over by the mouse. | |
| virtual std::optional< std::string > | getValueToRenderAboveBlock (bool isHovered) |
| Wrapper that gets the value of the output port above the block; if more or less than 1 output port is present, it will not be rendered. | |
| void | onDragStart () override |
| Called when dragging starts. | |
| void | onDragProgress (int x, int y) override |
| Called during dragging. | |
| void | onDragEnd () override |
| Called when dragging ends. | |
| const business_logic::geometry::Point2D & | getPortCoordinates (const structures::Port *port) const |
| Gets the coordinates of a port. | |
| std::optional< const structures::Port * > | getPortAtCoordinates (const geometry::Point2D &point) const |
| Gets the port at given coordinates. | |
| const FloatingPoint & | getPortValue (const structures::Port *port) const |
| Gets the value of the port. | |
| void | setPortValue (const business_logic::elements::structures::Port *port, const FloatingPoint &value) |
| Sets the value of the port. | |
| int | getCx () const |
| Gets the center y coordinate of the block. | |
| int | getCy () const |
| Gets the center y coordinate of the block. | |
| int | getLeftX () const |
| Gets the left x coordinate of the block. | |
| int | getRightX () const |
| Gets the right x coordinate of the block. | |
| int | getTopY () const |
| Gets the top y coordinate of the block. | |
| int | getBottomY () const |
| Gets the bottom y coordinate of the block. | |
| int | getWidth () const |
| Gets the width of the block. | |
| int | getHeight () const |
| Gets the height of the block. | |
| std::unordered_map< const structures::Port *, geometry::Point2D > & | getPortCoordinates () |
| Gets the cache of (center) coordinates of the ports of the block; updated after rendering. | |
Public Member Functions inherited from business_logic::elements::interactions::IDraggable | |
| virtual | ~IDraggable ()=default |
Protected Member Functions | |
| const std::vector< business_logic::elements::structures::Port > & | getInputPorts () const override |
| Gets the input ports of the block. | |
| const std::vector< business_logic::elements::structures::Port > & | getOutputPorts () const override |
| Gets the output ports of the block. | |
| business_logic::elements::blocks::BlockType | getBlockType () const override |
| Gets the type of the block. | |
Protected Member Functions inherited from business_logic::elements::blocks::BaseBlock | |
| void | cacheCornerCoordinates () |
Caches the bottom right corner of the block, so that it is not recalculated every time isHovered() is called. | |
| std::optional< const structures::Port * > | checkPort (const structures::Port *port, const geometry::Point2D &point) const |
| Checks if a point is inside the hitbox of a port. | |
Protected Attributes | |
| std::string | selfId |
Protected Attributes inherited from business_logic::Loggable< SubtractBlock > | |
| std::shared_ptr< spdlog::logger > | logger |
Protected Attributes inherited from business_logic::elements::blocks::BaseBlock | |
| int | cx |
| int | cy |
| int | width |
| int | height |
| int | leftX |
| int | rightX |
| int | topY |
| int | bottomY |
| float | centerY |
| std::shared_ptr< spdlog::logger > | logger |
| std::unordered_map< const structures::Port *, FloatingPoint > | portValues |
| The registry of port values. | |
| business_logic::delegate::INewBlockChoiceDelegate * | newBlockChoiceDelegate |
| business_logic::delegate::IBlockLifecycleManagerDelegate * | blockLifecycleManagerDelegate |
| business_logic::delegate::IWindowDelegate * | windowDelegate |
| std::unordered_map< const structures::Port *, geometry::Point2D > | portCoordinates |
| Caches the (center) coordinates of the ports of the block; must be updated after rendering. | |
Static Protected Attributes | |
| static constexpr int | SUBTRACT_BLOCK_WIDTH = 120 |
| static constexpr int | SUBTRACT_BLOCK_HEIGHT = 120 |
| static const std::vector< business_logic::elements::structures::Port > | inputPorts |
| static const std::vector< business_logic::elements::structures::Port > | outputPorts |
Static Protected Attributes inherited from business_logic::elements::blocks::BaseBlock | |
| static const FloatingPoint | NaN = std::numeric_limits<FloatingPoint>::quiet_NaN() |
A block that subtracts the second input value from the first input value.
Definition at line 13 of file SubtractBlock.h.
| business_logic::elements::blocks::SubtractBlock::SubtractBlock | ( | int | cx, |
| int | cy, | ||
| business_logic::delegate::INewBlockChoiceDelegate * | newBlockChoiceDelegate, | ||
| business_logic::delegate::IBlockLifecycleManagerDelegate * | blockLifecycleManagerDelegate, | ||
| business_logic::delegate::IWindowDelegate * | windowDelegate | ||
| ) |
Definition at line 5 of file SubtractBlock.cpp.
|
overridevirtual |
Calculates the output port values based on input port values.
| std::runtime_error | if input values are missing |
Implements business_logic::elements::blocks::BaseBlock.
Definition at line 21 of file SubtractBlock.cpp.
References business_logic::elements::blocks::BaseBlock::getPortValue(), inputPorts, outputPorts, and business_logic::elements::blocks::BaseBlock::portValues.
Here is the call graph for this function:
|
inlineoverrideprotectedvirtual |
Gets the type of the block.
Implements business_logic::elements::blocks::BaseBlock.
Definition at line 45 of file SubtractBlock.h.
References business_logic::elements::blocks::Subtract.
|
inlineoverrideprotectedvirtual |
Gets the input ports of the block.
Implements business_logic::elements::blocks::BaseBlock.
Definition at line 35 of file SubtractBlock.h.
References inputPorts.
|
inlineoverrideprotectedvirtual |
Gets the output ports of the block.
Implements business_logic::elements::blocks::BaseBlock.
Definition at line 40 of file SubtractBlock.h.
References outputPorts.
|
inlineoverridevirtual |
The unique identifier of the block (its address in memory), used for logging purposes; should return the same value as business_logic::stringifyAddressOf(this)
Implements business_logic::elements::blocks::BaseBlock.
Definition at line 23 of file SubtractBlock.h.
References selfId.
|
staticprotected |
Definition at line 49 of file SubtractBlock.h.
Referenced by calculateOutputValues(), and getInputPorts().
|
staticprotected |
Definition at line 50 of file SubtractBlock.h.
Referenced by calculateOutputValues(), and getOutputPorts().
|
protected |
Definition at line 30 of file SubtractBlock.h.
Referenced by getSelfId().
|
staticconstexprprotected |
Definition at line 33 of file SubtractBlock.h.
|
staticconstexprprotected |
Definition at line 32 of file SubtractBlock.h.