@@ -37,8 +37,11 @@ ReactorElement::ReactorElement(const std::string& name,
37
37
case Type::Action:
38
38
container->register_action (reinterpret_cast <BaseAction*>(this ));
39
39
break ;
40
- case Type::Port:
41
- container->register_port (reinterpret_cast <BasePort*>(this ));
40
+ case Type::Input:
41
+ container->register_input (reinterpret_cast <BasePort*>(this ));
42
+ break ;
43
+ case Type::Output:
44
+ container->register_output (reinterpret_cast <BasePort*>(this ));
42
45
break ;
43
46
case Type::Reaction:
44
47
container->register_reaction (reinterpret_cast <Reaction*>(this ));
@@ -73,29 +76,34 @@ Reactor::Reactor(const std::string& name, Environment* environment)
73
76
environment->register_reactor (this );
74
77
}
75
78
76
- void Reactor::register_action ([[maybe_unused]]BaseAction* action) {
79
+ void Reactor::register_action ([[maybe_unused]] BaseAction* action) {
77
80
toggle_assert (action != nullptr );
78
- reactor::validate (this ->environment ()->phase () == Environment::Phase::Construction,
79
- " Actions can only be registered during construction phase!" );
81
+ reactor::validate (
82
+ this ->environment ()->phase () == Environment::Phase::Construction,
83
+ " Actions can only be registered during construction phase!" );
80
84
toggle_assert (_actions.insert (action).second );
81
85
}
82
- void Reactor::register_port (BasePort* port) {
86
+ void Reactor::register_input (BasePort* port) {
83
87
toggle_assert (port != nullptr );
84
- reactor::validate (this ->environment ()->phase () == Environment::Phase::Construction,
85
- " Ports can only be registered during construction phase!" );
86
- if (port->is_input ()) {
87
- toggle_assert (_inputs.insert (port).second );
88
- } else {
89
- toggle_assert (_outputs.insert (port).second );
90
- }
88
+ reactor::validate (
89
+ this ->environment ()->phase () == Environment::Phase::Construction,
90
+ " Ports can only be registered during construction phase!" );
91
+ toggle_assert (_inputs.insert (port).second );
92
+ }
93
+ void Reactor::register_output (BasePort* port) {
94
+ toggle_assert (port != nullptr );
95
+ reactor::validate (
96
+ this ->environment ()->phase () == Environment::Phase::Construction,
97
+ " Ports can only be registered during construction phase!" );
98
+ toggle_assert (_outputs.insert (port).second );
91
99
}
92
- void Reactor::register_reaction ([[maybe_unused]]Reaction* reaction) {
100
+ void Reactor::register_reaction ([[maybe_unused]] Reaction* reaction) {
93
101
toggle_assert (reaction != nullptr );
94
102
validate (this ->environment ()->phase () == Environment::Phase::Construction,
95
103
" Reactions can only be registered during construction phase!" );
96
104
toggle_assert (_reactions.insert (reaction).second );
97
105
}
98
- void Reactor::register_reactor ([[maybe_unused]]Reactor* reactor) {
106
+ void Reactor::register_reactor ([[maybe_unused]] Reactor* reactor) {
99
107
toggle_assert (reactor != nullptr );
100
108
validate (this ->environment ()->phase () == Environment::Phase::Construction,
101
109
" Reactions can only be registered during construction phase!" );
0 commit comments