fair-acc / gnuradio4

Prototype implementations for a more compile-time efficient flowgraph API
Other
31 stars 12 forks source link

feature: propagate `DONE` to and disconnect from upstream blocks #342

Closed RalphSteinhagen closed 4 months ago

RalphSteinhagen commented 4 months ago
  1. When a block detects that it is no longer required (i.e., it has no downstream consumers), this feature ensures that the block declares itself 'DONE' and severs connections to upstream blocks. This feature is controlled by the Block::disconnect_on_done parameter (default: true)

  2. added buffer().n_writers() interface tracking the number of writers and when a buffer and/or two or more ports are not connected anymore. Makes the first item simpler/cleaner.

  3. added some documented default blocks in-line with GR3: NullSource, NullSink, Copy, HeadBlock, CountingSource, CountingSink -- naming of the 'HeadBlock' -- while ubiquitously used in GR3 -- should be discussed with the architecture team because of semantics.

daniestevez commented 4 months ago

Great! I've tested this branch with my Head block in https://github.com/daniestevez/gr4-packet-modem/tree/test-gnuradio4-pr342 and DONE propagation works as expected. A NullSource -> Head(100) -> VectorSink flowgraph terminates and at the end the VectorSink contains 100 items (see examples/head.cpp).

sonarcloud[bot] commented 4 months ago

Quality Gate Failed Quality Gate failed

Failed conditions
26.5% Coverage on New Code (required ≥ 80%)
11.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud