Skip to content

[QC-1346] Scaffolding to share common code among QC data processors#2660

Open
knopers8 wants to merge 4 commits intoAliceO2Group:masterfrom
knopers8:actors-nice
Open

[QC-1346] Scaffolding to share common code among QC data processors#2660
knopers8 wants to merge 4 commits intoAliceO2Group:masterfrom
knopers8:actors-nice

Conversation

@knopers8
Copy link
Copy Markdown
Collaborator

@knopers8 knopers8 commented Apr 2, 2026

Actor is a template base class for all QC Data Processors. It is supposed to bring their commonalities together, such as: service initialization, Data Processing Layer adoption, retrieving configuration and runtime parameters, interactions with controlling entities (DPL driver, AliECS, ODC).

The design is based on CRTP (see the web for explanation), which allows us to:

  • avoid code repetition in implementing aforementioned commonalities
  • optionally perform certain actions depending on traits of an Actor specialization. CRTP, in contrast to dynamic inheritance, is also advertised to avoid performance impact due to vtable lookups. It is certainly a nice bonus in our case, but it was not the main motivation for CRTP-based approach.

To allow for compile-time customization of centralized Actor features, we require each concrete Actor to implement an ActorTraits structure with certain parameters which is enforced with ValidActorTraits concept. The traits are separated from the main Actor class to improve readability and allow for shorter compilation times by allowing many helper functions avoid including Actor.h and a corresponding actor specialization. For additional savings on compilation time and clutter in code, we validate ActorTraits specializations with a concept only in Actor, but this could be revisited if proven wrong.

This commit paves the path for refactoring existing QC data processors as Actor specializations/children.

Actor is a template base class for all QC Data Processors. It is supposed to bring their commonalities together,
such as: service initialization, Data Processing Layer adoption, retrieving configuration and runtime parameters,
interactions with controlling entities (DPL driver, AliECS, ODC).

The design is based on CRTP (see the web for explanation), which allows us to:
- avoid code repetition in implementing aforementioned commonalities
- optionally perform certain actions depending on traits of an Actor specialization.
CRTP, in contrast to dynamic inheritance, is also advertised to avoid performance impact due to vtable lookups.
It is certainly a nice bonus in our case, but it was not the main motivation for CRTP-based approach.

To allow for compile-time customization of centralized Actor features, we require each concrete Actor to implement
an ActorTraits structure with certain parameters which is enforced with ValidActorTraits concept.
The traits are separated from the main Actor class to improve readability and allow for shorter compilation times
by allowing many helper functions avoid including Actor.h and a corresponding actor specialization. For additional
savings on compilation time and clutter in code, we validate ActorTraits specializations with a concept only in
Actor, but this could be revisited if proven wrong.

This commit paves the path for refactoring existing QC data processors as Actor specializations/children.
knopers8 added 3 commits April 2, 2026 15:19
Clang complains that:
```
SOURCES/QualityControl/2660/0/Framework/test/testActor.cxx
/Volumes/build/alice-ci-workdir/qualitycontrol-o2/sw/SOURCES/QualityControl/2660/0/Framework/test/testActor.cxx:97:5: error: call to consteval function 'o2::quality_control::core::UnrequestedAccessActor::assertNoAccessToServices<o2::quality_control::core::UnrequestedAccessActor>' is not a constant expression
   97 |     assertNoAccessToServices<UnrequestedAccessActor>();
      |     ^
/Volumes/build/alice-ci-workdir/qualitycontrol-o2/sw/SOURCES/QualityControl/2660/0/Framework/test/testActor.cxx:97:5: note: implicit use of 'this' pointer is only allowed within the evaluation of a call to a 'constexpr' member function
1 error generated.
```

GCC is fine and is able to process it as a consteval expression. Let's keep both happy by using constexpr, given it's just a test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant