Skip to content

Commit 470f225

Browse files
committed
fiddeling around with constructors
1 parent 4f3da1c commit 470f225

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

include/reactor-cpp/port.hh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace reactor {
2424

2525
enum class PortType { Input, Output, Delay };
2626

27-
class BasePort : public ReactorElement, public GraphElement { // NOLINT
27+
class BasePort : public GraphElement, public ReactorElement { // NOLINT
2828
private:
2929
BasePort* inward_binding_{nullptr};
3030
std::set<BasePort*> outward_bindings_{};
@@ -40,6 +40,10 @@ private:
4040
protected:
4141
bool present_{false}; // NOLINT cppcoreguidelines-non-private-member-variables-in-classes
4242

43+
BasePort(const std::string& name, PortType type, Reactor* container)
44+
: ReactorElement(name, match_port_enum(type), container)
45+
, type_(type) {}
46+
4347
void register_dependency(Reaction* reaction, bool is_trigger) noexcept;
4448
void register_antidependency(Reaction* reaction) noexcept;
4549
virtual void cleanup() = 0;
@@ -68,9 +72,6 @@ protected:
6872
}
6973

7074
public:
71-
BasePort(const std::string& name, PortType type, Reactor* container)
72-
: ReactorElement(name, match_port_enum(type), container)
73-
, type_(type) {}
7475
~BasePort() noexcept override = default;
7576

7677
void set_inward_binding(BasePort* port) noexcept { inward_binding_ = port; }
@@ -181,15 +182,15 @@ public:
181182
Input(const std::string& name, Reactor* container)
182183
: Port<T>(name, PortType::Input, container) {}
183184

184-
Input(Input&&) = default; // NOLINT(performance-noexcept-move-constructor)
185+
Input(Input&&) noexcept = default; // NOLINT(performance-noexcept-move-constructor)
185186
};
186187

187188
template <class T> class Output : public Port<T> { // NOLINT
188189
public:
189190
Output(const std::string& name, Reactor* container)
190191
: Port<T>(name, PortType::Output, container) {}
191192

192-
Output(Output&&) = default; // NOLINT(performance-noexcept-move-constructor)
193+
Output(Output&&) noexcept = default; // NOLINT(performance-noexcept-move-constructor)
193194
};
194195

195196
} // namespace reactor

include/reactor-cpp/reactor_element.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public:
3737
virtual ~ReactorElement() = default;
3838

3939
// not copyable, but movable
40-
ReactorElement(const ReactorElement&) = delete;
40+
ReactorElement(const ReactorElement&) = default;
4141
ReactorElement(ReactorElement&&) = default;
4242

4343
[[nodiscard]] auto container() const noexcept -> Reactor* { return container_; }

0 commit comments

Comments
 (0)