Skip to content

Commit 7ff52c4

Browse files
committed
avnd: name the port-callback storage condition
1 parent 69eda47 commit 7ff52c4

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

src/plugins/score-plugin-avnd/Crousti/ProcessModel.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@
4040
namespace oscr
4141
{
4242

43+
// The condition under which a process needs the port-callback storage (a
44+
// model-side Info instance). The storage member and its init guard below must
45+
// both use it — keep them in sync.
46+
template <typename Info>
47+
concept needs_ports_callback_storage = has_dynamic_ports<Info>;
48+
4349
template <typename Info>
4450
struct MessageBusWrapperToUi
4551
{
@@ -94,7 +100,8 @@ class ProcessModel final
94100
oscr::dynamic_ports_storage<Info> dynamic_ports;
95101

96102
[[no_unique_address]]
97-
ossia::type_if<Info, oscr::has_dynamic_ports<Info>> object_storage_for_ports_callbacks;
103+
ossia::type_if<Info, oscr::needs_ports_callback_storage<Info>>
104+
object_storage_for_ports_callbacks;
98105

99106
ProcessModel(
100107
const TimeVal& duration, const Id<Process::ProcessModel>& id,
@@ -204,9 +211,7 @@ class ProcessModel final
204211

205212
void init_controller_ports()
206213
{
207-
if constexpr(
208-
avnd::dynamic_ports_input_introspection<Info>::size > 0
209-
|| avnd::dynamic_ports_output_introspection<Info>::size > 0)
214+
if constexpr(oscr::needs_ports_callback_storage<Info>)
210215
{
211216
avnd::control_input_introspection<Info>::for_all_n2(
212217
avnd::get_inputs<Info>((Info&)this->object_storage_for_ports_callbacks),

0 commit comments

Comments
 (0)