refactor(rtps_embedded): De-template the engine (Phase 3) - #708
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
✅Static analysis result - no issues found! ✅ |
Contributor
There was a problem hiding this comment.
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/StatefulReaderTinto concreteStatelessWriter/StatefulWriter/StatefulReadertypes (preserving the public alias names used by consumers). - Folded former template implementations into
src/entities/*.cppand added the new sources to both the ESP-IDF component build and the host/library build. - Updated endpoint headers to use
EsppTransportdirectly (forward-declared) and removed.tppincludes.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 3 (de-templating) of the
components/rtps_embeddedrefactor — seeREFACTOR_PLAN.md. Follows #706 (now merged).What
Remove the
NetworkDrivertemplate parameter from the engine's three endpoint classes. There is exactly one transport (EsppTransport), so the template bought nothing but.tppfiles and compile time.StatelessWriterT<NetworkDriver>/StatefulWriterT<NetworkDriver>/StatefulReaderT<NetworkDriver>→ concreteStatelessWriter/StatefulWriter/StatefulReader(their former alias names, so every consumer —Domain,Participant— is unchanged).EsppTransport(members are pointers); the fullEsppTransport.hppis pulled only into the new.cpptranslation units wherem_transport->is dereferenced.entities/*.tppfolded verbatim intosrc/entities/*.cpp— method bodies unchanged (heartbeatTick, thesubmit()heartbeat piggyback,m_protocolNudgeall preserved) — and registered in both build files.storages/ThreadSafeCircularBuffer.tpp(a genuine container template) is left as-is.Why
.tpptemplate-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:
esp32p4on ESP-IDF 6.0.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 ownLog.hppprintf macros for ~90% of log sites; the lock pain-point in the plan was about the nativertpscomponent being retired in Phase 6). Kept separate pending discussion.🤖 Generated with Claude Code