@@ -133,19 +133,19 @@ public:
133133 os << '[';
134134{% set count = type.choices | length %}
135135{% if count > 1 %}
136- bool atLeastOnePrinter = false;
136+ bool atLeastOnePrinted{ false} ;
137137{% endif %}
138138{% for choice in type.choices %}
139139 {% set choice_method = choice.name [0].lower () ~ choice.name [1:] %}
140140 if (value. {{ choice_method }}()) {
141141 {% if not loop.first and count > 1 %}
142- if (atLeastOnePrinter ) {
142+ if (atLeastOnePrinted ) {
143143 os << " , " ;
144144 }
145145 {% endif %}
146146 os << " {{ choice.name }}" ;
147147 {% if not loop.last and count > 1 %}
148- atLeastOnePrinter = true;
148+ atLeastOnePrinted = true;
149149 {% endif %}
150150 }
151151{% endfor %}
@@ -374,30 +374,31 @@ public:
374374
375375 {{ meta_decl() | indent(4) }}
376376
377+ {% if message.fields | length > 0 %}
377378 using Fields = TypeList<
378- {% for field in message.fields %}
379- {% set field_ref_name = field.name | fmt_class_ref %}
379+ {% for field in message.fields %}
380+ {% set field_ref_name = field.name | fmt_class_ref %}
380381 {{ field_ref_name }}{% if not loop.last %},{% endif +%}
381- {% endfor %}
382+ {% endfor %}
382383 >;
383384
384385 template <std::size_t I>
385386 [[nodiscard]] constexpr auto get() noexcept {
386- {% for field in message.fields %}
387- {% set field_ref_name = field.name | fmt_class_ref %}
388- {% if loop.first %}
387+ {% for field in message.fields %}
388+ {% set field_ref_name = field.name | fmt_class_ref %}
389+ {% if loop.first %}
389390 if constexpr (I == {{ loop.index0 }}) {
390- {% else %}
391+ {% else %}
391392 } else if constexpr (I == {{ loop.index0 }}) {
392- {% endif %}
393- {% if field.token == 'field' %}
393+ {% endif %}
394+ {% if field.token == 'field' %}
394395 return {{ field_ref_name }}{buffer_.data () + offset_, actingVersion_};
395- {% elif field.token == 'group' %}
396+ {% elif field.token == 'group' %}
396397 return {{ field_ref_name }}{buffer_, &position_, actingVersion_};
397- {% elif field.token == 'data' %}
398+ {% elif field.token == 'data' %}
398399 return {{ field_ref_name }}{buffer_, &position_, actingVersion_};
399- {% endif %}
400- {% endfor %}
400+ {% endif %}
401+ {% endfor %}
401402 } else {
402403 static_assert(I < 0, " Field index out of range ({{ class_cpp_t }})" );
403404 }
@@ -406,25 +407,38 @@ public:
406407 template <CtStr N>
407408 [[nodiscard]] constexpr auto get() noexcept {
408409 constexpr auto name = static_cast<std::string_view>(N);
409- {% for field in message.fields %}
410- {% set field_ref_name = field.name | fmt_class_ref %}
411- {% if loop.first %}
410+ {% for field in message.fields %}
411+ {% set field_ref_name = field.name | fmt_class_ref %}
412+ {% if loop.first %}
412413 if constexpr (name == {{ field_ref_name }}::sbeRefName()) {
413- {% else %}
414+ {% else %}
414415 } else if constexpr (name == {{ field_ref_name }}::sbeRefName()) {
415- {% endif %}
416- {% if field.token == 'field' %}
416+ {% endif %}
417+ {% if field.token == 'field' %}
417418 return {{ field_ref_name }}{buffer_.data () + offset_, actingVersion_};
418- {% elif field.token == 'group' %}
419+ {% elif field.token == 'group' %}
419420 return {{ field_ref_name }}{buffer_, &position_, actingVersion_};
420- {% elif field.token == 'data' %}
421+ {% elif field.token == 'data' %}
421422 return {{ field_ref_name }}{buffer_, &position_, actingVersion_};
422- {% endif %}
423- {% endfor %}
423+ {% endif %}
424+ {% endfor %}
424425 } else {
425426 static_assert(name.size () + 1 < 0, " Field not found ({{ class_cpp_t }})" );
426427 }
427428 }
429+ {% else %}
430+ using Fields = TypeList<>;
431+
432+ template <std::size_t I>
433+ [[nodiscard]] constexpr auto get() noexcept {
434+ static_assert(I < 0, " Field index out of range ({{ class_cpp_t }})" );
435+ }
436+
437+ template <CtStr N>
438+ [[nodiscard]] constexpr auto get() noexcept {
439+ static_assert(static_cast<std::string_view>(N).size () + 1 < 0, " Field not found ({{ class_cpp_t }})" );
440+ }
441+ {% endif %}
428442};
429443{%- endmacro %}
430444
@@ -463,6 +477,10 @@ public:
463477 *positionPtr_ = *positionPtr_ + {{ dimension.encoded_length }};
464478 }
465479
480+ [[nodiscard]] static constexpr auto sbeGroupName() noexcept -> char const* {
481+ return " {{ group.name }}" ;
482+ }
483+
466484 [[nodiscard]] static constexpr auto sbeBlockLength() noexcept -> {{ block_length_cpp_t }} {
467485 return {{ group.block_length }};
468486 }
@@ -1129,6 +1147,10 @@ struct {{ class_cpp_t }} : public {{ group_class_cpp_t }} {
11291147 [[nodiscard]] static constexpr auto sbeSinceVersion() noexcept -> {{ version_cpp_t }} {
11301148 return {{ entry.since_version }};
11311149 }
1150+
1151+ [[nodiscard]] constexpr auto present() const noexcept -> bool {
1152+ return true;
1153+ }
11321154};
11331155{%- endmacro %}
11341156
@@ -1152,6 +1174,10 @@ struct {{ class_cpp_t }} : public {{ group_class_cpp_t }} {
11521174 [[nodiscard]] static constexpr auto sbeSinceVersion() noexcept -> {{ version_cpp_t }} {
11531175 return {{ entry.since_version }};
11541176 }
1177+
1178+ [[nodiscard]] constexpr auto present() const noexcept -> bool {
1179+ return true;
1180+ }
11551181};
11561182{%- endmacro %}
11571183
0 commit comments