Skip to content

Conversation

@paulgessinger
Copy link
Member

@paulgessinger paulgessinger commented Dec 9, 2025

This pull request introduces several improvements and refactorings to the event data proxy and track state handling system. The main focus is on enhancing type safety and code clarity by introducing named hashed string constants for column keys, updating concept definitions for proxies, and improving friend relationships and access patterns in proxy classes. It also adds new concepts and static assertions to ensure correct usage of proxy types throughout the codebase.

Type Safety and Code Clarity

  • Introduced named hashed string constants for column keys in TrackProxy and TrackStateProxy (e.g., detail_tp::kTipIndexKey, detail_tsp::kPreviousKey) and refactored all usages to reference these constants, replacing direct calls to hashString("..."). This improves maintainability and reduces the risk of typos. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15]

Concepts and Type Constraints

  • Added new proxy concepts (TrackProxyLike, TrackProxyConcept, ConstTrackProxyConcept, MutableTrackProxyConcept) and updated their definitions to require specific methods and type aliases, improving compile-time guarantees and documentation of expected proxy behavior. [1] [2]
  • Added static assertions in TrackContainer to enforce that proxy types fulfill the required concepts.

Proxy Accessor and Friend Relationships

  • Refactored ProxyAccessorBase::hasColumn to call proxy.hasColumn(key) instead of accessing the container directly, and removed the unused associatedConstProxy templates.
  • Extended friend relationships in proxy classes to include new proxy types (AnyTrack, AnyTrackState, TrackStateHandler), supporting future extensibility and type-safe access. [1] [2] [3]

Minor Cleanups

  • Removed redundant or outdated documentation comments from MultiTrajectory methods to streamline the code.

These changes collectively improve the robustness, readability, and maintainability of the proxy system for event data, making it easier to extend and reason about in future development.

Blocked by:

@github-actions github-actions bot added this to the next milestone Dec 9, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2025

📊: Physics performance monitoring for 8ae692b

Full contents

physmon summary

@paulgessinger paulgessinger changed the title refactor: Extend the track proxy concept feat: Type erased track and track state proxies Dec 9, 2025
@paulgessinger paulgessinger marked this pull request as ready for review December 10, 2025 08:17
Copy link
Member

@benjaminhuth benjaminhuth left a comment

Choose a reason for hiding this comment

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

Given the large PR I wonder if it would make sense to separate the usage of the constexpr hashes and the actual AnyTrack.
Apart from that I looks good to me, I have only a few comments.

virtual ~TrackHandlerConstBase() = default;

/// Get the reference surface
virtual const Surface* referenceSurface(const void* container,
Copy link
Member

Choose a reason for hiding this comment

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

Hmm about the design choice to have a void * here. Have you also though if the container could be transferred via a std::any? This would provide more type safety, and I wonder if the performance implications would be measurable.

Copy link
Member Author

@paulgessinger paulgessinger Dec 10, 2025

Choose a reason for hiding this comment

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

Since this is internal API surface, and the consistency is guaranteed, I think void* is safe in this case.

@paulgessinger
Copy link
Member Author

paulgessinger commented Dec 10, 2025

Given the large PR I wonder if it would make sense to separate the usage of the constexpr hashes and the actual AnyTrack. Apart from that I looks good to me, I have only a few comments.

I think the PR size is what it is because the track and track state API surface is (unavoidably) large. The hashes were mainly introduced to allow a more compact backend implementation (debatable if that worked, but that's a different question). In this PR, they help keeping the handler interface small: I can implement most of the public proxy functions internally via the component function, rather than having one virtual method for each public method. Is that what you're referring to, or am I missing the point?

EDIT: Ah, you mean splitting up the changes to TrackStateProxy and TrackProxy, and the introduction of the type erased type? If so, I can definitely do that.

@benjaminhuth
Copy link
Member

EDIT: Ah, you mean splitting up the changes to TrackStateProxy and TrackProxy, and the introduction of the type erased type? If so, I can definitely do that.

Yeah, thats what I meant.

In general I also thought a bit if would make sense to only define the API surface once with some CRTP style pattern, but I was not sure if this in the end would improve code maintainability or make it just very difficult to understand whats going on...

@paulgessinger paulgessinger added the 🛑 blocked This item is blocked by another item label Dec 10, 2025
@paulgessinger
Copy link
Member Author

@benjaminhuth Yeah I was thinking about CRTP as well @benjaminhuth. One issue that I see is that the const-correctness handling is a bit delicate, which I think would be tricky to retain. I can give it a try though.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Component - Core Affects the Core module Event Data Model 🛑 blocked This item is blocked by another item Track Finding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants