Skip to content

refactor(rtps_embedded): De-template the engine (Phase 3) - #708

Merged
finger563 merged 1 commit into
mainfrom
feat/rtps-phase3-detemplate
Aug 12, 2026
Merged

refactor(rtps_embedded): De-template the engine (Phase 3)#708
finger563 merged 1 commit into
mainfrom
feat/rtps-phase3-detemplate

Conversation

@finger563

Copy link
Copy Markdown
Contributor

Phase 3 (de-templating) of the components/rtps_embedded refactor — see REFACTOR_PLAN.md. Follows #706 (now merged).

What

Remove the NetworkDriver template parameter from the engine's three endpoint classes. There is exactly one transport (EsppTransport), so the template bought nothing but .tpp files and compile time.

  • StatelessWriterT<NetworkDriver> / StatefulWriterT<NetworkDriver> / StatefulReaderT<NetworkDriver> → concrete StatelessWriter / StatefulWriter / StatefulReader (their former alias names, so every consumer — Domain, Participant — is unchanged).
  • Headers keep the forward-declared EsppTransport (members are pointers); the full EsppTransport.hpp is pulled only into the new .cpp translation units where m_transport-> is dereferenced.
  • Each entities/*.tpp folded verbatim into src/entities/*.cpp — method bodies unchanged (heartbeatTick, the submit() heartbeat piggyback, m_protocolNudge all preserved) — and registered in both build files. storages/ThreadSafeCircularBuffer.tpp (a genuine container template) is left as-is.

Why

.tpp template-implementation files, longer compile times, and template error messages, all for a parameter that only ever takes one value. Concrete classes are simpler to read, debug, and (next) evolve.

Wire-neutral by construction

A rename/move cannot change bytes. Verified anyway:

  • Golden wire tests: byte-identical, never regenerated.
  • Interop matrix (docker, FastDDS + ROS 2 jazzy): 8/8 — espp↔espp loopback + cross-process, espp↔ROS 2 reliable both directions + best-effort.
  • esp32 example builds for esp32p4 on ESP-IDF 6.0.
  • Host lib (win/mac/linux) + reliable loopbacks pass.

Not included (deliberately)

The plan groups a BaseComponent/lock "hierarchy collapse" under Phase 3, but on inspection it's debatable for this engine (it uses its own Log.hpp printf macros for ~90% of log sites; the lock pain-point in the plan was about the native rtps component being retired in Phase 6). Kept separate pending discussion.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings August 12, 2026 18:25
@github-actions

Copy link
Copy Markdown

✅Static analysis result - no issues found! ✅

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR implements Phase 3 of the components/rtps_embedded refactor by removing the NetworkDriver template parameter from the engine endpoint classes and moving their former .tpp implementations into concrete .cpp translation units, keeping EsppTransport forward-declared in headers and only included where dereferenced.

Changes:

  • De-templated StatelessWriterT / StatefulWriterT / StatefulReaderT into concrete StatelessWriter / StatefulWriter / StatefulReader types (preserving the public alias names used by consumers).
  • Folded former template implementations into src/entities/*.cpp and added the new sources to both the ESP-IDF component build and the host/library build.
  • Updated endpoint headers to use EsppTransport directly (forward-declared) and removed .tpp includes.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
lib/espp.cmake Adds the new StatefulReader.cpp, StatefulWriter.cpp, and StatelessWriter.cpp sources to the host/library build source list.
components/rtps_embedded/CMakeLists.txt Registers the new endpoint .cpp translation units in the ESP-IDF component build.
components/rtps_embedded/src/entities/StatelessWriter.cpp Provides concrete StatelessWriter method definitions and pulls in EsppTransport.hpp only in the .cpp.
components/rtps_embedded/src/entities/StatefulWriter.cpp Provides concrete StatefulWriter method definitions with EsppTransport-backed transport usage in the .cpp.
components/rtps_embedded/src/entities/StatefulReader.cpp Provides concrete StatefulReader method definitions and includes EsppTransport.hpp only where needed.
components/rtps_embedded/include/rtps/entities/StatelessWriter.hpp Removes templating, switches to EsppTransport*, and removes .tpp inclusion.
components/rtps_embedded/include/rtps/entities/StatefulWriter.hpp Removes templating, switches to EsppTransport*, and removes .tpp inclusion.
components/rtps_embedded/include/rtps/entities/StatefulReader.hpp Removes templating, switches to EsppTransport*, and removes .tpp inclusion.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@finger563
finger563 requested a review from guo-max August 12, 2026 19:54
@finger563
finger563 merged commit 1adfdf8 into main Aug 12, 2026
143 checks passed
@finger563
finger563 deleted the feat/rtps-phase3-detemplate branch August 12, 2026 20:05
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