From 32619b038babf17339b752836a35851a6bbfaf12 Mon Sep 17 00:00:00 2001 From: Sebastien Ponce <sebastien.ponce@cern.ch> Date: Fri, 7 Feb 2020 08:36:00 +0100 Subject: [PATCH] Fixed declarations of operator<< Many were not in the right namespace, breaking argument dependent lookup, some were not even in the right file, and others not declared at all, only implemented in the .cpp This was in particular preventing some includes (like the one og Grammar.h), in turn preventing to fix the issues with the Mac build created by pull request 611 --- DDCore/include/DD4hep/AlignmentData.h | 3 ++- DDCore/include/DD4hep/ConditionsData.h | 2 +- DDCore/include/DD4hep/DetElement.h | 1 + DDCore/include/DD4hep/OpaqueData.h | 2 ++ DDCore/src/AlignmentData.cpp | 4 ++-- DDCore/src/AlignmentsCalculator.cpp | 2 -- DDCore/src/ConditionsData.cpp | 2 +- DDCore/src/DetElement.cpp | 2 ++ DDCore/src/OpaqueData.cpp | 2 +- 9 files changed, 12 insertions(+), 8 deletions(-) diff --git a/DDCore/include/DD4hep/AlignmentData.h b/DDCore/include/DD4hep/AlignmentData.h index 1c5517547..8c4f49a58 100644 --- a/DDCore/include/DD4hep/AlignmentData.h +++ b/DDCore/include/DD4hep/AlignmentData.h @@ -195,6 +195,7 @@ namespace dd4hep { Position detectorToLocal(const Double_t det[3]) const { return detectorToLocal(Position(det[0],det[1],det[2])); } }; + std::ostream& operator << (std::ostream& s, const AlignmentData& data); + std::ostream& operator << (std::ostream& s, const Delta& data); } /* End namespace dd4hep */ -std::ostream& operator << (std::ostream& s, const dd4hep::AlignmentData& data); #endif /* DD4HEP_ALIGMENTS_ALIGNMENTDATA_H */ diff --git a/DDCore/include/DD4hep/ConditionsData.h b/DDCore/include/DD4hep/ConditionsData.h index 9b0f49566..9f106c697 100644 --- a/DDCore/include/DD4hep/ConditionsData.h +++ b/DDCore/include/DD4hep/ConditionsData.h @@ -123,7 +123,7 @@ namespace dd4hep { throw std::runtime_error("AbstractMap: Failed to access non-existing item:"+item); } }; - + std::ostream& operator << (std::ostream& s, const AbstractMap& data); } /* End namespace cond */ } /* End namespace dd4hep */ #endif /* DD4HEP_DDCORE_CONDITIONSDATA_H */ diff --git a/DDCore/include/DD4hep/DetElement.h b/DDCore/include/DD4hep/DetElement.h index 7d75f6ea2..4316648b7 100644 --- a/DDCore/include/DD4hep/DetElement.h +++ b/DDCore/include/DD4hep/DetElement.h @@ -447,6 +447,7 @@ namespace dd4hep { /// Access to the constant survey alignment information Alignment survey() const; }; + std::ostream& operator << (std::ostream& s, const DetElement& data); } /* End namespace dd4hep */ #include "DD4hep/AlignmentData.h" diff --git a/DDCore/include/DD4hep/OpaqueData.h b/DDCore/include/DD4hep/OpaqueData.h index ac51863ed..ed538b79b 100644 --- a/DDCore/include/DD4hep/OpaqueData.h +++ b/DDCore/include/DD4hep/OpaqueData.h @@ -136,6 +136,8 @@ namespace dd4hep { /// Set data value void assign(const void* ptr,const std::type_info& typ); }; + /// print OpaqueData object + std::ostream& operator<< (std::ostream& s, const OpaqueDataBlock& data); } /* End namespace dd4hep */ #include "DD4hep/BasicGrammar.h" diff --git a/DDCore/src/AlignmentData.cpp b/DDCore/src/AlignmentData.cpp index 25944ca67..57fa9b165 100644 --- a/DDCore/src/AlignmentData.cpp +++ b/DDCore/src/AlignmentData.cpp @@ -84,7 +84,7 @@ void Delta::computeMatrix(TGeoHMatrix& tr_delta) const { } /// print alignment delta object -ostream& operator << (ostream& s, const Delta& data) { +ostream& dd4hep::operator<< (ostream& s, const Delta& data) { string res; stringstream str; str << "[" << data.translation << "," << data.rotation << "," << data.pivot << "]"; @@ -131,7 +131,7 @@ AlignmentData& AlignmentData::operator=(const AlignmentData& copy) { } /// print Conditions object -ostream& operator << (ostream& s, const AlignmentData& data) { +ostream& dd4hep::operator << (ostream& s, const AlignmentData& data) { stringstream str; str << data.delta; return s << str.str(); diff --git a/DDCore/src/AlignmentsCalculator.cpp b/DDCore/src/AlignmentsCalculator.cpp index b186591ea..90f44e11b 100644 --- a/DDCore/src/AlignmentsCalculator.cpp +++ b/DDCore/src/AlignmentsCalculator.cpp @@ -325,8 +325,6 @@ size_t AlignmentsCalculator::extract_deltas(DetElement start, // The map is used by the Alignments calculator typedef AlignmentsCalculator::OrderedDeltas OrderedMap; -// Have only a weak reference here! -inline std::ostream& operator << (std::ostream& s, const DetElement& ) { return s; } #include "Parsers/Parsers.h" DD4HEP_DEFINE_PARSER_DUMMY(OrderedMap) diff --git a/DDCore/src/ConditionsData.cpp b/DDCore/src/ConditionsData.cpp index 6742827ed..507e90407 100644 --- a/DDCore/src/ConditionsData.cpp +++ b/DDCore/src/ConditionsData.cpp @@ -20,7 +20,7 @@ using namespace dd4hep::cond; /// print Conditions object -std::ostream& operator << (std::ostream& s, const AbstractMap& data) { +std::ostream& dd4hep::cond::operator<< (std::ostream& s, const AbstractMap& data) { struct _Print { void operator()(const AbstractMap::Params::value_type& obj) const { if ( obj.second.typeInfo() == typeid(AbstractMap) ) { diff --git a/DDCore/src/DetElement.cpp b/DDCore/src/DetElement.cpp index aa0eedd27..55f93755f 100644 --- a/DDCore/src/DetElement.cpp +++ b/DDCore/src/DetElement.cpp @@ -490,3 +490,5 @@ void* SensitiveDetector::extension(unsigned long long int k) const { void* SensitiveDetector::extension(unsigned long long int k, bool alert) const { return access()->extension(k, alert); } + +std::ostream& dd4hep::operator<< (std::ostream& s, const DetElement& ) { return s; } diff --git a/DDCore/src/OpaqueData.cpp b/DDCore/src/OpaqueData.cpp index 992b9f8c3..97368d273 100644 --- a/DDCore/src/OpaqueData.cpp +++ b/DDCore/src/OpaqueData.cpp @@ -196,7 +196,7 @@ void OpaqueDataBlock::assign(const void* ptr, const type_info& typ) { } /// print Conditions object -std::ostream& operator << (std::ostream& s, const OpaqueDataBlock& data) { +std::ostream& dd4hep::operator<< (std::ostream& s, const OpaqueDataBlock& data) { s << data.str(); return s; } -- GitLab