Skip to content

Commit

Permalink
Split declartaion and implementation to avoid inlining
Browse files Browse the repository at this point in the history
Inlining will omit creating symbols for these functions which leads to
issues when dynamically loading a library that uses these methods
  • Loading branch information
tmadlener committed Jul 18, 2024
1 parent cec294e commit 18f56a1
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 59 deletions.
106 changes: 47 additions & 59 deletions edm4hep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -622,21 +622,18 @@ datatypes:
- edm4hep::ReconstructedParticle from // reference to the reconstructed particle
- edm4hep::MCParticle to // reference to the Monte-Carlo particle
ExtraCode:
includes: "
#include <edm4hep/ReconstructedParticle.h>\n
#include <edm4hep/MCParticle.h>\n"
declarationFile: "edm4hep/extra_code/AssociationGetters.h.ipp"
implementationFile: "edm4hep/extra_code/AssociationGetters.cc.ipp"
MutableExtraCode:
includes: "
#include <edm4hep/ReconstructedParticle.h>\n
#include <edm4hep/MCParticle.h>\n"

declaration: "
[[deprecated(\"use setFrom instead\")]]\n
void setRec(const edm4hep::ReconstructedParticle& rec) {setFrom(rec);}\n
void setRec(const edm4hep::ReconstructedParticle& rec);\n
[[deprecated(\"use setSim instead\")]]\n
void setSim(const edm4hep::MCParticle& sim) {setTo(sim);}\n
void setSim(const edm4hep::MCParticle& sim);\n
"
implementation: "
void {name}::setSim(const edm4hep::MCParticle& sim) { setTo(sim); }\n
void {name}::setRec(const edm4hep::ReconstructedParticle& rec) { setFrom(rec); }\n
"

edm4hep::MCRecoCaloAssociation:
Expand All @@ -648,20 +645,18 @@ datatypes:
- edm4hep::CalorimeterHit from // reference to the reconstructed hit
- edm4hep::SimCalorimeterHit to // reference to the simulated hit
ExtraCode:
includes: "
#include <edm4hep/CalorimeterHit.h>\n
#include <edm4hep/SimCalorimeterHit.h>\n"
declarationFile: "edm4hep/extra_code/AssociationGetters.h.ipp"
implementationFile: "edm4hep/extra_code/AssociationGetters.cc.ipp"
MutableExtraCode:
includes: "
#include <edm4hep/CalorimeterHit.h>\n
#include <edm4hep/SimCalorimeterHit.h>\n"
declaration: "
[[deprecated(\"use setFrom instead\")]]\n
void setRec(const edm4hep::CalorimeterHit& rec) {setFrom(rec);}\n
void setRec(const edm4hep::CalorimeterHit& rec);\n
[[deprecated(\"use setSim instead\")]]\n
void setSim(const edm4hep::SimCalorimeterHit& sim) {setTo(sim);}\n
void setSim(const edm4hep::SimCalorimeterHit& sim);\n
"
implementation: "
void {name}::setSim(const edm4hep::SimCalorimeterHit& sim) { setTo(sim); }\n
void {name}::setRec(const edm4hep::CalorimeterHit& rec) { setFrom(rec); }\n
"


Expand All @@ -674,20 +669,18 @@ datatypes:
- edm4hep::TrackerHit from // reference to the reconstructed hit
- edm4hep::SimTrackerHit to // reference to the simulated hit
ExtraCode:
includes: "
#include <edm4hep/TrackerHit.h>\n
#include <edm4hep/SimTrackerHit.h>\n"
declarationFile: "edm4hep/extra_code/AssociationGetters.h.ipp"
implementationFile: "edm4hep/extra_code/AssociationGetters.cc.ipp"
MutableExtraCode:
includes: "
#include <edm4hep/TrackerHit.h>\n
#include <edm4hep/SimTrackerHit.h>\n"
declaration: "
[[deprecated(\"use setFrom instead\")]]\n
void setRec(const edm4hep::TrackerHit& rec) {setFrom(rec);}\n
void setRec(const edm4hep::TrackerHit& rec);\n
[[deprecated(\"use setSim instead\")]]\n
void setSim(const edm4hep::SimTrackerHit& sim) {setTo(sim);}\n
void setSim(const edm4hep::SimTrackerHit& sim);\n
"
implementation: "
void {name}::setSim(const edm4hep::SimTrackerHit& sim) { setTo(sim); }\n
void {name}::setRec(const edm4hep::TrackerHit& rec) { setFrom(rec); }\n
"

edm4hep::MCRecoCaloParticleAssociation:
Expand All @@ -699,20 +692,18 @@ datatypes:
- edm4hep::CalorimeterHit from // reference to the reconstructed hit
- edm4hep::MCParticle to // reference to the Monte-Carlo particle
ExtraCode:
includes: "
#include <edm4hep/CalorimeterHit.h>\n
#include <edm4hep/MCParticle.h>\n"
declarationFile: "edm4hep/extra_code/AssociationGetters.h.ipp"
implementationFile: "edm4hep/extra_code/AssociationGetters.cc.ipp"
MutableExtraCode:
includes: "
#include <edm4hep/CalorimeterHit.h>\n
#include <edm4hep/MCParticle.h>\n"
declaration: "
[[deprecated(\"use setFrom instead\")]]\n
void setRec(const edm4hep::CalorimeterHit& rec) {setFrom(rec);}\n
void setRec(const edm4hep::CalorimeterHit& rec);\n
[[deprecated(\"use setSim instead\")]]\n
void setSim(const edm4hep::MCParticle& sim) {setTo(sim);}\n
void setSim(const edm4hep::MCParticle& sim);\n
"
implementation: "
void {name}::setSim(const edm4hep::MCParticle& sim) { setTo(sim); }\n
void {name}::setRec(const edm4hep::CalorimeterHit& rec) { setFrom(rec); }\n
"

edm4hep::MCRecoClusterParticleAssociation:
Expand All @@ -724,20 +715,18 @@ datatypes:
- edm4hep::Cluster from // reference to the cluster
- edm4hep::MCParticle to // reference to the Monte-Carlo particle
ExtraCode:
includes: "
#include <edm4hep/Cluster.h>\n
#include <edm4hep/MCParticle.h>\n"
declarationFile: "edm4hep/extra_code/AssociationGetters.h.ipp"
implementationFile: "edm4hep/extra_code/AssociationGetters.cc.ipp"
MutableExtraCode:
includes: "
#include <edm4hep/Cluster.h>\n
#include <edm4hep/MCParticle.h>\n"
declaration: "
[[deprecated(\"use setFrom instead\")]]\n
void inline setRec(const edm4hep::Cluster& rec) {setFrom(rec);}\n
void inline setRec(const edm4hep::Cluster& rec);\n
[[deprecated(\"use setSim instead\")]]\n
void inline setSim(const edm4hep::MCParticle& sim) {setTo(sim);}\n
void inline setSim(const edm4hep::MCParticle& sim);\n
"
implementation: "
void {name}::setSim(const edm4hep::MCParticle& sim) { setTo(sim); }\n
void {name}::setRec(const edm4hep::Cluster& rec) { setFrom(rec); }\n
"

edm4hep::MCRecoTrackParticleAssociation:
Expand All @@ -749,20 +738,18 @@ datatypes:
- edm4hep::Track from // reference to the track
- edm4hep::MCParticle to // reference to the Monte-Carlo particle
ExtraCode:
includes: "
#include <edm4hep/Track.h>\n
#include <edm4hep/MCParticle.h>\n"
declarationFile: "edm4hep/extra_code/AssociationGetters.h.ipp"
implementationFile: "edm4hep/extra_code/AssociationGetters.cc.ipp"
MutableExtraCode:
includes: "
#include <edm4hep/Cluster.h>\n
#include <edm4hep/MCParticle.h>\n"
declaration: "
[[deprecated(\"use setFrom instead\")]]\n
void setRec(const edm4hep::Track& rec) {setFrom(rec);}\n
void setRec(const edm4hep::Track& rec);\n
[[deprecated(\"use setSim instead\")]]\n
void setSim(const edm4hep::MCParticle& sim) {setTo(sim);}\n
void setSim(const edm4hep::MCParticle& sim);\n
"
implementation: "
void {name}::setSim(const edm4hep::MCParticle& sim) { setTo(sim); }\n
void {name}::setRec(const edm4hep::Track& rec) { setFrom(rec); }\n
"

edm4hep::RecoParticleVertexAssociation:
Expand All @@ -774,24 +761,25 @@ datatypes:
- edm4hep::ReconstructedParticle to // reference to the reconstructed particle
- edm4hep::Vertex from // reference to the vertex
ExtraCode:
includes: "
#include <edm4hep/ReconstructedParticle.h>\n
#include <edm4hep/Vertex.h>\n"
declaration: "
[[deprecated(\"use getTo instead\")]]\n
auto getRec() const { return getTo(); }\n
auto getRec();\n
[[deprecated(\"use getFrom instead\")]]\n
auto getVertex() const { return getFrom(); }\n
auto getVertex();\n
"
implementation: "
auto getRec() const { return getTo(); }\n
auto getVertex() const { return getFrom(); }\n"
MutableExtraCode:
includes: "
#include <edm4hep/ReconstructedParticle.h>\n
#include <edm4hep/Vertex.h>\n"
declaration: "
[[deprecated(\"use setFrom instead\")]]\n
void setVertex(const edm4hep::Vertex& rec) {setFrom(rec);}\n
void setVertex(const edm4hep::Vertex& rec);\n
[[deprecated(\"use setSim instead\")]]\n
void setRec(const edm4hep::ReconstructedParticle& sim) {setTo(sim);}\n
void setRec(const edm4hep::ReconstructedParticle& sim);\n
"
implementation: "
void {name}::setVertex(const edm4hep::Vertex& vertex) { setFrom(vertex); }\n
void {name}::setRec(const edm4hep::ReconstructedParticle& rec) { setTo(rec); }\n
"

#---------- TimeSeries
Expand Down
7 changes: 7 additions & 0 deletions edm4hep/extra_code/AssociationGetters.cc.ipp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
auto {name}::getRec() const {
return getFrom();
}

auto {name}::getSim() const {
return getTo();
}
3 changes: 3 additions & 0 deletions edm4hep/extra_code/AssociationGetters.h.ipp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[deprecated("use getFrom instead")]] auto getRec() const;

[[deprecated("use getTo instead")]] auto getSim() const;

0 comments on commit 18f56a1

Please sign in to comment.