Goal
Apply Linux kernel OOP design patterns to refactor all major RT-Claw subsystems, following the methodology from LWN Articles 444910 and 446317.
Design Patterns
- Struct embedding +
container_of for data inheritance (replacing all void* opaque handles)
- Function pointer tables (ops structs) for polymorphism and method dispatch
- Linker section auto-registration for zero-cost component discovery (GNU ld) /
__attribute__((constructor)) (ESP-IDF)
- Unified error codes (
claw_err_t) and base class definitions as shared infrastructure
Scope
- OSAL layer: struct-based types replacing void*
- Gateway: polymorphic message dispatch via ops vtable
- Services: private context structs with lifecycle state machine and dependency graph
- Drivers: probe/remove lifecycle with
struct claw_driver base
- Tools:
struct claw_tool base class with ops vtable
- Scheduler: intrusive linked list replacing static array
- All 5 platforms: ESP32-C3, ESP32-S3, vexpress-a9, zynq-a9, Linux
Reference
Goal
Apply Linux kernel OOP design patterns to refactor all major RT-Claw subsystems, following the methodology from LWN Articles 444910 and 446317.
Design Patterns
container_offor data inheritance (replacing allvoid*opaque handles)__attribute__((constructor))(ESP-IDF)claw_err_t) and base class definitions as shared infrastructureScope
struct claw_driverbasestruct claw_toolbase class with ops vtableReference
.humanize/plans/oop-refactor-plan.md