Skip to content

Refactor: Move all state from TimeSeriesType/Input/Output interfaces …#192

Merged
hhenson merged 4 commits intomainfrom
cpp_v2_1
Nov 10, 2025
Merged

Refactor: Move all state from TimeSeriesType/Input/Output interfaces …#192
hhenson merged 4 commits intomainfrom
cpp_v2_1

Conversation

@hhenson
Copy link
Copy Markdown
Owner

@hhenson hhenson commented Nov 9, 2025

…to Base classes

  • Created BaseTimeSeriesInput and BaseTimeSeriesOutput classes containing all state and concrete implementations
  • Made TimeSeriesType, TimeSeriesInput, and TimeSeriesOutput pure virtual interfaces with zero state
  • Updated all derived classes to inherit from Base classes instead of interfaces
  • Fixed nanobind registrations: methods defined on interfaces, hierarchy only on Base classes
  • Updated all qualified base class calls from TimeSeriesInput:: to BaseTimeSeriesInput::
  • Moved protected virtual methods (do_bind_output, notify_parent) to Base classes
  • Replaced all reinterpret_cast with static_cast for type safety
  • Fixed TimeSeriesT concept to use std::is_base_of_v instead of exact type matching
  • Fixed key_set() to return TimeSeriesSetOutput/Input (not templated version)
  • Updated all concrete type nanobind registrations to inherit from Base classes
  • Added missing headers to CMakeLists.txt (base_time_series.h, observer headers)

All 1309 tests pass with both Python and C++ runtimes (HGRAPH_USE_CPP=1)


Note

Introduce BaseTimeSeriesInput/Output holding all state and behavior, convert TimeSeriesType/Input/Output to pure interfaces, and update types, bindings, and build to match.

  • Core Type System:
    • Introduce BaseTimeSeriesInput and BaseTimeSeriesOutput with all state and concrete behavior moved from interfaces.
    • Make TimeSeriesType, TimeSeriesInput, and TimeSeriesOutput pure virtual interfaces; adjust method surfaces accordingly.
    • Update TimeSeriesT concept to use std::is_base_of_v.
  • Derived Types & Collections:
    • Migrate all concrete types (ts, tsw, tss, tsd, ts_indexed, ref, ts_signal, tsb) to inherit from Base classes; replace calls like TimeSeriesInput:: with BaseTimeSeriesInput::.
    • Fix key_set() to return TimeSeriesSetOutput/TimeSeriesSetInput and related APIs.
    • Replace unsafe casts with static_cast where applicable; tighten type checks.
  • Bindings (nanobind):
    • Keep methods on interfaces; register Base classes for hierarchy; update all class bindings to derive from Base types.
    • Export new Base classes in _hgraph_types.cpp.
  • Build/Config:
    • Add new headers and source (types/base_time_series.*) and observer headers to CMake lists.
    • Forward declarations updated to include Base classes and new concept.
  • Observers:
    • InspectionObserver constructor drops _track_recent_performance storage; parameter marked unused.
  • Docs:
    • CLAUDE.md updated with feature flag usage (HGRAPH_USE_CPP=1) and dev/testing guidance.

Written by Cursor Bugbot for commit ab2e994. This will update automatically on new commits. Configure here.

…to Base classes

- Created BaseTimeSeriesInput and BaseTimeSeriesOutput classes containing all state and concrete implementations
- Made TimeSeriesType, TimeSeriesInput, and TimeSeriesOutput pure virtual interfaces with zero state
- Updated all derived classes to inherit from Base classes instead of interfaces
- Fixed nanobind registrations: methods defined on interfaces, hierarchy only on Base classes
- Updated all qualified base class calls from TimeSeriesInput:: to BaseTimeSeriesInput::
- Moved protected virtual methods (do_bind_output, notify_parent) to Base classes
- Replaced all reinterpret_cast with static_cast for type safety
- Fixed TimeSeriesT concept to use std::is_base_of_v instead of exact type matching
- Fixed key_set() to return TimeSeriesSetOutput/Input (not templated version)
- Updated all concrete type nanobind registrations to inherit from Base classes
- Added missing headers to CMakeLists.txt (base_time_series.h, observer headers)

All 1309 tests pass with both Python and C++ runtimes (HGRAPH_USE_CPP=1)
@hhenson
Copy link
Copy Markdown
Owner Author

hhenson commented Nov 9, 2025

Step 1 to clean up existing code (preparation of pure virtual base classes for TimeSeriesInput / Output / Type.

@sonarqubecloud
Copy link
Copy Markdown

@hhenson
Copy link
Copy Markdown
Owner Author

hhenson commented Nov 10, 2025

OK, need to try and keep a clean separation of the required API's from the implementation specific logic. This cleans the code up slightly and should not introduce too much overhead. I need to prepare the code for the new logic in a few smaller steps to reduce the complexity of the change. This is step 1. and should be mostly harmless.

@hhenson hhenson merged commit a0903a1 into main Nov 10, 2025
11 checks passed
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.

1 participant