Skip to content

docs: two runnable examples for the stateful and composite features - #14

Merged
psyinf merged 3 commits into
mainfrom
docs/examples
Sep 19, 2026
Merged

psyinf merged 3 commits into
mainfrom
docs/examples

Conversation

@psyinf

@psyinf psyinf commented Sep 17, 2026

Copy link
Copy Markdown
Owner

Stacked on #13 (base docs/todo), so its diff shows only the examples. Retarget
to main once #13 merges.

apps/textPipeline covers the core building blocks; everything that shipped
after it had no runnable example. Two samples fill that gap, in the same style
(numbered blocks, comments that explain the why), each walked through in
EXAMPLE.md:

apps/statefulPipeline (EXAMPLE.md section 8) — stages that carry state:

  • a stage that accumulates across messages, reports in finish() and hands its
    result to the application through the GraphContext;
  • a merge with per-instance state and per-instance arguments (TypedMergeFilter
    subclass + a FilterRegistrar creator), two instances with different windows
    in one graph;
  • next to it, the shared-combiner semantics of registerMergeFilter made
    visible with a captured counter — the numbers run straight through both stage
    instances, which is item 5 of TODO.md;
  • an application's own derived context, recovered with as<AppContext>().

apps/compositePipeline (EXAMPLE.md section 9) — composing graphs:

  • registerTypedMergeFilter and the JSON JoinFilter side by side, producing
    the same result;
  • a DslFilterGraph registered as a stage of an outer graph, showing that both
    finish() and the context reach the inner stages;
  • a Void-terminated sink graph (a deliberate dead end, not a drop);
  • the in-band tick message, the pattern that stands in for a tick() hook.

Also in this PR:

  • EXAMPLE.md gets an intro table mapping sections to samples, and its
    "complete output" block is refreshed — it predates the typed-merge stages and
    was missing their two lines.
  • README points at all three samples; TODO.md drops the examples item.
  • CHANGELOG entry under Unreleased.

No library change. Verified with windows-msvc-debug-developer-mode: both
samples build warning-free, their output is what EXAMPLE.md prints, and
ctest is 85/85.

A note on formatting: clang-format 22 with this repo's .clang-format wants 2-space
constructor initializers and collapsed one-line bodies, which no committed source
uses, so the new files follow the existing sources rather than the formatter. The
cpp-linter job (clang-format 16, changed lines only) may still comment.

Collects the open extension ideas in one place: more examples for the
newer features, named merge slots, several named graph inputs, stage
labels with typed access, tracking which stage short-circuited, a
config-aware registerMergeFilter, an injectable registry with duplicate
detection, the documentation items around 0..n outputs and large
messages, and the two limitations the README lists.

Each item says what the library does today, the gap, a proposal with an
API sketch, its compatibility impact and the workaround available in the
meantime. Nothing here is implemented.

The README roadmap now summarizes the list and links to it; its
short-circuit item moved into TODO.md unchanged.
apps/textPipeline covers the core building blocks; the features that
shipped since had no runnable example. Two samples fill the gap, in the
same style (numbered blocks, comments that explain the why), each walked
through in EXAMPLE.md:

- statefulPipeline (section 8): a stage that accumulates across messages
  and flushes in finish(), handing its result to the application through
  the GraphContext; a merge with per-instance state and per-instance
  arguments (subclass + FilterRegistrar) next to the shared-combiner
  semantics of registerMergeFilter, shown with a captured counter; an
  application's own derived context, recovered with as<AppContext>().
- compositePipeline (section 9): registerTypedMergeFilter and the JSON
  JoinFilter side by side; a DslFilterGraph registered as a stage of an
  outer graph, with finish() and the context reaching into it; a
  Void-terminated sink graph; the in-band tick message that stands in
  for a tick() hook.

Also refreshes the textPipeline output in EXAMPLE.md, which predates the
typed-merge stages, and drops the examples item from TODO.md.

No library change; the new files follow the style of the existing
sources.
Base automatically changed from docs/todo to main September 19, 2026 19:17
@psyinf

psyinf commented Sep 19, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

# Conflicts:
#	README.md
#	TODO.md

Co-authored-by: psyinf <1777736+psyinf@users.noreply.github.com>

Copilot AI commented Sep 19, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Done — I merged origin/main into this branch and resolved the conflicts in commit d6b3308.

@psyinf
psyinf merged commit e9cd3bf into main Sep 19, 2026
3 checks passed
@psyinf
psyinf deleted the docs/examples branch September 19, 2026 19:25
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.

2 participants