Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PublishablePortSpan #415

Merged
merged 2 commits into from
Sep 30, 2024
Merged

PublishablePortSpan #415

merged 2 commits into from
Sep 30, 2024

Conversation

drslebedev
Copy link
Contributor

@drslebedev drslebedev commented Sep 24, 2024

More details in corresponding issue #407

This PR introduces PublishablePortSpan, which extends PublishableSpan by adding a convenient publishTag method.

Additionally, the following issues were addressed in this PR:

  • Renamed Block::input_tags_present() to inputTagPresent().
  • Fixed a bug in the parameter name for the Soapy block.
  • Rename some CircularBuffer/Reader/Writer method to be more consistent
  • Add convenience methods to iterate through tuple: for_each_publishable_span, for_each_consumable_span
  • Remove obsolete Block::availableInputSamples and Block::availableOutputSamples methods
  • Fix qa_grc test, use procesOne() instead of work()

@@ -345,6 +345,12 @@ struct DummyPublishableSpan {
};
static_assert(PublishableSpan<DummyPublishableSpan<int>>);

template<typename T>
struct DummyPublishablePortSpan: public DummyPublishableSpan<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drslebedev @wirew0rm I am wondering whether we should merge both concepts to create basically only one PublishableSpan. 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't need the Dummy Type anywhere else than in the Block, we don't really need the Base Type DummyPublishableSpan<T> and it could be removed.

Copy link
Member

@RalphSteinhagen RalphSteinhagen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update.

Some minor comments/questions:

  • do we need both concept definitions (see inline comments)?
  • the use of the ProducableSpan::publishTag(...) should be changed in the few uses in the block lib (e.g. in: BasicFileIo.hpp, clock_source.hpp, TagMonitors.hpp).
  • Rename the parameter index totagOffset and remove the '0' since this would be the default parameter value.

This should make the changes/naming more expressive. Once these minor changes are in, the PR could be merged as-is without further review.

P.S. please do not forget to 'check' this tasks in the corresponding issue. Thanks in advance.

@@ -268,6 +268,11 @@ concept ConsumablePortSpan = ConsumableSpan<T> && requires(T span) {
{ *span.tags.begin() } -> std::same_as<const gr::Tag&>;
};

template<typename T>
concept PublishablePortSpan = PublishableSpan<T> && requires(T span, property_map& tagData, Tag::signed_index_type index) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge with PublishableSpan? Are there use-cases where we need to keep them separate?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is specific to Port, while the other applies to every buffer. If we would merge them you could not use the Span API on a "bare" ringbuffer.

Note: For the Consumable Span it is not possible, since the ConsumablePortSpan<CircularBufferMemberType> contains a ConsumableSpan<Tag>, by merging them this would become recursive. So there would be some "symmetry" argument to keep them seperated also in the PublishableSpan case.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wirew0rm the question is about
a) naming/proliferation of concepts (similar dependent definitions)
b) we need this named concept since users -- with this PR -- do not usually interact directly with the buffer-related concept.


~PublishablePortOutputRange() = default;

void publishTag(property_map& tagData, Tag::signed_index_type index) { _port->publishTag(tagData, index); }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename index to tagOffset to better express the intention that this is the index/offset w.r.t. the initial sample that is presented to the user.

…rt tags.

Additionally, the following issues were addressed:
* Renamed Block::input_tags_present() to inputTagPresent().
* Fixed a bug in the parameter name for the Soapy block.
* Rename some CircularBuffer/Reader/Writer method to be more consistent
* Add convenience methods to iterate through tuple: for_each_publishable_span, for_each_consumable_span
* Remove obsolete Block::availableInputSamples and Block::availableOutputSamples methods

Signed-off-by: drslebedev <dr.s.lebedev@gmail.com>
Signed-off-by: drslebedev <dr.s.lebedev@gmail.com>
Copy link
Member

@wirew0rm wirew0rm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I added some minor comments/notes, but from my PoV it can be merged.

@@ -345,6 +345,12 @@ struct DummyPublishableSpan {
};
static_assert(PublishableSpan<DummyPublishableSpan<int>>);

template<typename T>
struct DummyPublishablePortSpan: public DummyPublishableSpan<T> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't need the Dummy Type anywhere else than in the Block, we don't really need the Base Type DummyPublishableSpan<T> and it could be removed.

core/include/gnuradio-4.0/CircularBuffer.hpp Show resolved Hide resolved
core/include/gnuradio-4.0/WaitStrategy.hpp Show resolved Hide resolved
core/test/qa_grc.cpp Show resolved Hide resolved
@drslebedev drslebedev merged commit 24dd79b into main Sep 30, 2024
9 of 11 checks passed
@drslebedev drslebedev deleted the out_port_range branch September 30, 2024 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants