0.4.1
Loading...
Searching...
No Matches
Merger.hpp
Go to the documentation of this file.
1// This file is part of INSTINCT, the INS Toolkit for Integrated
2// Navigation Concepts and Training by the Institute of Navigation of
3// the University of Stuttgart, Germany.
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9/// @file Merger.hpp
10/// @brief Merger Node
11/// @author T. Topp (topp@ins.uni-stuttgart.de)
12/// @date 2021-02-01
13
14#pragma once
15
17
18#include "util/Eigen.hpp"
19
20namespace NAV
21{
22/// @brief Merges two input ports into a single output port
23class Merger : public Node
24{
25 public:
26 /// @brief Default constructor
27 Merger();
28 /// @brief Destructor
29 ~Merger() override;
30 /// @brief Copy constructor
31 Merger(const Merger&) = delete;
32 /// @brief Move constructor
33 Merger(Merger&&) = delete;
34 /// @brief Copy assignment operator
35 Merger& operator=(const Merger&) = delete;
36 /// @brief Move assignment operator
37 Merger& operator=(Merger&&) = delete;
38
39 /// @brief String representation of the Class Type
40 [[nodiscard]] static std::string typeStatic();
41
42 /// @brief String representation of the Class Type
43 [[nodiscard]] std::string type() const override;
44
45 /// @brief String representation of the Class Category
46 [[nodiscard]] static std::string category();
47
48 /// @brief Called when a new link is to be established
49 /// @param[in] startPin Pin where the link starts
50 /// @param[in] endPin Pin where the link ends
51 /// @return True if link is allowed, false if link is rejected
52 bool onCreateLink(OutputPin& startPin, InputPin& endPin) override;
53
54 /// @brief Called when a link was deleted
55 /// @param[in] startPin Pin where the link starts
56 /// @param[in] endPin Pin where the link ends
57 void afterDeleteLink(OutputPin& startPin, InputPin& endPin) override;
58
59 private:
60 constexpr static size_t OUTPUT_PORT_INDEX_FLOW = 0; ///< @brief Flow
61 constexpr static size_t INPUT_PORT_INDEX_FLOW_FIRST = 0; ///< @brief Flow
62 constexpr static size_t INPUT_PORT_INDEX_FLOW_SECOND = 1; ///< @brief Flow
63
64 /// @brief Set the Pin Identifiers for the other pin depending on the connected pin
65 /// @param[in] connectedPinIndex The connected pin
66 /// @param[in] otherPinIndex The unconnected pin which needs the identifiers to be set
67 /// @param[in] dataIdentifiers The data Identifier to be considered
68 void setPinIdentifiers(size_t connectedPinIndex, size_t otherPinIndex, const std::vector<std::string>& dataIdentifiers);
69
70 /// @brief Checks if link on the pin is still valid and refreshes if so
71 /// @param[in] oldDataIdentifiers Data identifiers which were previously set
72 void updateOutputPin(const std::vector<std::string>& oldDataIdentifiers);
73
74 /// @brief Receive data
75 /// @param[in] queue Queue with all the received data messages
76 /// @param[in] pinIdx Index of the pin the data is received on
77 void receiveData(InputPin::NodeDataQueue& queue, size_t pinIdx);
78};
79
80} // namespace NAV
Vector space operations.
Node Class.
Input pins of nodes.
Definition Pin.hpp:491
TsDeque< std::shared_ptr< const NAV::NodeData > > NodeDataQueue
Node data queue type.
Definition Pin.hpp:707
bool onCreateLink(OutputPin &startPin, InputPin &endPin) override
Called when a new link is to be established.
Definition Merger.cpp:140
Merger & operator=(const Merger &)=delete
Copy assignment operator.
static std::string typeStatic()
String representation of the Class Type.
Definition Merger.cpp:37
Merger(const Merger &)=delete
Copy constructor.
static std::string category()
String representation of the Class Category.
Definition Merger.cpp:47
void updateOutputPin(const std::vector< std::string > &oldDataIdentifiers)
Checks if link on the pin is still valid and refreshes if so.
Definition Merger.cpp:110
std::string type() const override
String representation of the Class Type.
Definition Merger.cpp:42
void receiveData(InputPin::NodeDataQueue &queue, size_t pinIdx)
Receive data.
Definition Merger.cpp:205
void setPinIdentifiers(size_t connectedPinIndex, size_t otherPinIndex, const std::vector< std::string > &dataIdentifiers)
Set the Pin Identifiers for the other pin depending on the connected pin.
Definition Merger.cpp:52
Merger & operator=(Merger &&)=delete
Move assignment operator.
void afterDeleteLink(OutputPin &startPin, InputPin &endPin) override
Called when a link was deleted.
Definition Merger.cpp:166
Merger()
Default constructor.
Definition Merger.cpp:19
static constexpr size_t INPUT_PORT_INDEX_FLOW_SECOND
Flow.
Definition Merger.hpp:62
static constexpr size_t INPUT_PORT_INDEX_FLOW_FIRST
Flow.
Definition Merger.hpp:61
static constexpr size_t OUTPUT_PORT_INDEX_FLOW
Flow.
Definition Merger.hpp:60
~Merger() override
Destructor.
Definition Merger.cpp:32
Merger(Merger &&)=delete
Move constructor.
Node(std::string name)
Constructor.
Definition Node.cpp:30
Output pins of nodes.
Definition Pin.hpp:338