Skip to content

Commit

Permalink
allow cross-model interfaces in relations
Browse files Browse the repository at this point in the history
  • Loading branch information
m-fila committed Dec 5, 2024
1 parent 3d38fe9 commit 64d5362
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion python/podio_gen/cpp_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,10 @@ def _preprocess_for_collection(self, datatype):
self._build_include_for_class(relation.bare_type, include_from)
)
for int_type in relation.interface_types:
int_type_include_from = self._needs_include(int_type.full_type)
includes_cc.add(
self._build_include_for_class(
int_type.bare_type + "Collection", include_from
int_type.bare_type + "Collection", int_type_include_from
)
)
else:
Expand Down
8 changes: 8 additions & 0 deletions tests/datalayout_interface_extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@ datatypes:
- iextension::PolarVector aVector // component defined in the extension
- double energy [GeV] // measured energy deposit

iextension::ExampleWithInterfaceRelation:
Description: "Datatype that uses an interface type as one of its relations"
Author: "Mateusz Jakub Fila"
OneToOneRelations:
- iextension::EnergyInterface singleEnergy // single relation
OneToManyRelations:
- iextension::EnergyInterface manyEnergies // multiple relations

interfaces:
iextension::EnergyInterface:
Description: "Generic interface for types with an energy member"
Expand Down

0 comments on commit 64d5362

Please sign in to comment.