diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Element2GeoItemRegistry.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Element2GeoItemRegistry.h index bb85bc1457b085f92e7d925d6120078ffe76bdb1..1cea419f137ba852556826ec5991fa494b63a00c 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Element2GeoItemRegistry.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Element2GeoItemRegistry.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -19,8 +19,10 @@ class Element2GeoItemRegistry { public: Element2GeoItemRegistry(); ~Element2GeoItemRegistry(); - void enregister(const std::string tagName, Element2GeoItem *processor); // register = keyword - Element2GeoItem *find(const std::string tagName); + Element2GeoItemRegistry(const Element2GeoItemRegistry&) = delete; + Element2GeoItemRegistry& operator=(const Element2GeoItemRegistry&) = delete; + void enregister(const std::string& tagName, Element2GeoItem *processor); // register = keyword + Element2GeoItem *find(const std::string& tagName); private: Element2GeoItem *m_defaultProcessor; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Gmx2Geo.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Gmx2Geo.h index 0b3cca3a8c3d9cd0b063cc662304738af6b8a043..2ea56c3318b0356a2dff1e9fd9de20a3b31ed83d 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Gmx2Geo.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/Gmx2Geo.h @@ -58,7 +58,7 @@ class Evaluator; class Gmx2Geo { public: - Gmx2Geo(const std::string gmxFile, GeoPhysVol *addHere, GmxInterface &gmxInterface, unsigned int flags = 0, bool useMatManager = 0,const processorList& procs=processorList()); + Gmx2Geo(const std::string& gmxFile, GeoPhysVol *addHere, GmxInterface &gmxInterface, unsigned int flags = 0, bool useMatManager = 0,const processorList& procs=processorList()); private: // Disallow copying Gmx2Geo(const Gmx2Geo &right); diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/GmxInterface.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/GmxInterface.h index f1854c2e9849fcdf765b867fde8c0c929c0495ad..de341622bdaede185e1811b39184d437874e7113 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/GmxInterface.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/GmxInterface.h @@ -25,9 +25,9 @@ class GmxInterface { public: virtual int sensorId(std::map<std::string, int> &index) const; virtual int splitSensorId(std::map<std::string, int> &index, std::pair<std::string, int> &extraIndex, std::map<std::string, int> &updatedIndex) const; //For "artificially" adding to Identifiers; specify the field (e.g. "eta_module") and the value to add - virtual void addSensorType(std::string type, std::string name, std::map<std::string, std::string> parameters); - virtual void addSensor(std::string name, std::map<std::string, int> &index, int id, GeoVFullPhysVol *fpv); - virtual void addSplitSensor(std::string name, std::map<std::string, int> &index, std::pair<std::string, int> &extraIndex, int id, GeoVFullPhysVol *fpv); + virtual void addSensorType(const std::string& cls, const std::string& type, const std::map<std::string, std::string>& parameters); + virtual void addSensor(const std::string& name, std::map<std::string, int> &index, int id, GeoVFullPhysVol *fpv); + virtual void addSplitSensor(const std::string& name, std::map<std::string, int> &index, std::pair<std::string, int> &extraIndex, int id, GeoVFullPhysVol *fpv); virtual void addAlignable(int level, std::map<std::string, int> &index, GeoVFullPhysVol *fpv, GeoAlignableTransform *transform); diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/PositionIndex.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/PositionIndex.h index 59a730ac5861a86125fa867409459fefc1c05931..31a722b30cc44dfbe4ff55bd13ff113f6687851c 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/PositionIndex.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/PositionIndex.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -34,10 +34,10 @@ public: int copyNo(int level); int setCopyNo(int copyNo); - void addIndex(std::string name); + void addIndex(const std::string& name); std::string name(int whichOne); - std::string formula(std::string name); - void setFormula(std::string name, std::string formula); + std::string formula(const std::string& name); + void setFormula(const std::string& name, const std::string& formula); void indices(std::map<std::string, int> &index, Evaluator &eval); diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/ProcessorRegistry.h b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/ProcessorRegistry.h index ae15a9b024bb0112a9dfe5ff09542df90f6494fe..97c2e8b403d60ad7b65cfe1bc9f2c2d134af1129 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/ProcessorRegistry.h +++ b/GeoModelTools/GeoModelXML/GeoModelXml/GeoModelXml/ProcessorRegistry.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ // @@ -19,8 +19,10 @@ class ElementProcessor; class ProcessorRegistry { public: ProcessorRegistry(); - void enregister(const std::string tagName, ElementProcessor *processor); - ElementProcessor *find(const std::string name); + ProcessorRegistry(const ProcessorRegistry&) = delete; + ProcessorRegistry& operator=(const ProcessorRegistry&) = delete; + void enregister(const std::string& tagName, ElementProcessor *processor); + ElementProcessor *find(const std::string& name); private: ElementProcessor *m_defaultProcessor; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/Element2GeoItemRegistry.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/Element2GeoItemRegistry.cxx index ab6dab041e19e8f5a7c3785361ba2078be44309e..14c961e980c6d19e3cd9cf1173fbcee95806af65 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/Element2GeoItemRegistry.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/Element2GeoItemRegistry.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "GeoModelXml/Element2GeoItemRegistry.h" @@ -13,11 +13,11 @@ Element2GeoItemRegistry::~Element2GeoItemRegistry() { delete m_defaultProcessor; } -void Element2GeoItemRegistry::enregister(const std::string tagName, Element2GeoItem *processor) { +void Element2GeoItemRegistry::enregister(const std::string& tagName, Element2GeoItem *processor) { m_processor[tagName] = processor; } -Element2GeoItem * Element2GeoItemRegistry::find(const std::string name) { +Element2GeoItem * Element2GeoItemRegistry::find(const std::string& name) { std::map<std::string, Element2GeoItem *>::iterator it = m_processor.find(name); return it == m_processor.end()? m_defaultProcessor: it->second; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx index ade840b91b22a57d204c82550548bc6d5aedca6f..b7e5c7fcbb8101badf1e44ae12a313decbc6bb70 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/Gmx2Geo.cxx @@ -30,7 +30,7 @@ using namespace std; using namespace xercesc; -Gmx2Geo::Gmx2Geo(const string xmlFile, GeoPhysVol *addHere, GmxInterface &gmxInterface, unsigned int flags, bool useMatManager, const processorList& procs) { +Gmx2Geo::Gmx2Geo(const string& xmlFile, GeoPhysVol *addHere, GmxInterface &gmxInterface, unsigned int flags, bool useMatManager, const processorList& procs) { // // Create the xml tree (DOMDocument) // diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxInterface.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxInterface.cxx index 0869d825744b7b966a112b3fc8ec0bd4cee479df..11d284e68a5f3aeaa2c6117b57bfd8d41b1b34b5 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxInterface.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/GmxInterface.cxx @@ -26,16 +26,16 @@ int GmxInterface::splitSensorId(map<string, int> &/*index*/, std::pair<std::stri return sequentialId++; } -void GmxInterface::addSensorType(string clas, string type, map<string, string> params) { +void GmxInterface::addSensorType(const string& clas, const string& type, const map<string, string>& params) { msglog << MSG::DEBUG << "GmxInterface::addSensorType called for class " << clas << "; type " << type << "\n Parameter names and values:\n"; - for (map<string, string>::iterator p = params.begin(); p != params.end(); ++p) { + for (map<string, string>::const_iterator p = params.begin(); p != params.end(); ++p) { msglog << " " << p->first << " = " << p->second << endmsg; } } -void GmxInterface::addSensor(string name, map<string, int> &index, int sequentialId, GeoVFullPhysVol *fpv) { +void GmxInterface::addSensor(const string& name, map<string, int> &index, int sequentialId, GeoVFullPhysVol *fpv) { msglog << MSG::DEBUG << "GmxInterface::addSensor called for " << fpv->getLogVol()->getName() << ", type " << name << ". Indices: "; @@ -45,7 +45,7 @@ void GmxInterface::addSensor(string name, map<string, int> &index, int sequentia msglog << "\nSequential ID = " << sequentialId << endmsg; } -void GmxInterface::addSplitSensor(string name, map<string, int> &index, std::pair<std::string, int> &extraIndex, int sequentialId, GeoVFullPhysVol *fpv) { +void GmxInterface::addSplitSensor(const string& name, map<string, int> &index, std::pair<std::string, int> &extraIndex, int sequentialId, GeoVFullPhysVol *fpv) { msglog << MSG::DEBUG << "GmxInterface::addSensor called for " << fpv->getLogVol()->getName() << ", type " << name << ". Indices: "; diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeIntersection.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeIntersection.cxx index a985b595d924d2f49632d57569730f6df354c57a..e787255e4c525d0ca1db2f2608fdcdcf5f95c3e0 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeIntersection.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeIntersection.cxx @@ -56,6 +56,9 @@ RCBase * MakeIntersection::make(const xercesc::DOMElement *element, GmxUtil &gmx elementIndex++; } } + + if (!first || !second) std::abort(); + // FIXME: intersect() returns a new'd object --- should really be // returning a `unique_ptr<GeoShapeIntersection>' not a // `const GeoShapeIntersection' diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSubtraction.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSubtraction.cxx index d8b762d359a8254d6c3b8e60f6b56bc060e13bc7..1e16c58973be49b4eea91dc742333d5a5c313608 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSubtraction.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeSubtraction.cxx @@ -57,6 +57,9 @@ RCBase * MakeSubtraction::make(const xercesc::DOMElement *element, GmxUtil &gmxU elementIndex++; } } + + if (!first || !second) std::abort(); + // FIXME: subtract() returns a new'd object --- should really be // returning a `unique_ptr<GeoShapeSubtraction>' not a // `const GeoShapeSubtraction' diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeUnion.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeUnion.cxx index 6bb70ce92d1655b28668bf0d5209daadb34fcfce..2bcb0d530e2198f4fd379bcb78152c9e12a80e7f 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeUnion.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/MakeUnion.cxx @@ -55,6 +55,9 @@ RCBase * MakeUnion::make(const xercesc::DOMElement *element, GmxUtil &gmxUtil) c elementIndex++; } } + + if (!first || !second) std::abort(); + // FIXME: add() returns a new'd object --- should really be // returning a `unique_ptr<GeoShapeUnion>' not a // `const GeoShapeUnion' diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/PositionIndex.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/PositionIndex.cxx index 81104cdeab8b5455922be38e743424ac70f0bef0..c1833bb35b9e79483b7afb85d230540c829ed1f2 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/PositionIndex.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/PositionIndex.cxx @@ -46,7 +46,7 @@ int PositionIndex::setCopyNo(int copyNo) { return m_copyNo[m_level]; } -void PositionIndex::addIndex(std::string name) { +void PositionIndex::addIndex(const std::string& name) { m_name.push_back(name); m_formula[name] = "0"; } @@ -60,11 +60,11 @@ string PositionIndex::name(int whichOne) { } } -std::string PositionIndex::formula(std::string name) { +std::string PositionIndex::formula(const std::string& name) { return m_formula[name]; } -void PositionIndex::setFormula(std::string name, std::string formula) { +void PositionIndex::setFormula(const std::string& name, const std::string& formula) { m_formula[name] = formula; } diff --git a/GeoModelTools/GeoModelXML/GeoModelXml/src/ProcessorRegistry.cxx b/GeoModelTools/GeoModelXML/GeoModelXml/src/ProcessorRegistry.cxx index 66ec8fb070810b8986e91eb9db2f57848cd479bd..53eedd194683b934ec8360c489718090a3bd9f23 100644 --- a/GeoModelTools/GeoModelXML/GeoModelXml/src/ProcessorRegistry.cxx +++ b/GeoModelTools/GeoModelXML/GeoModelXml/src/ProcessorRegistry.cxx @@ -1,5 +1,5 @@ /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration */ #include "GeoModelXml/ProcessorRegistry.h" @@ -9,11 +9,11 @@ ProcessorRegistry::ProcessorRegistry() { m_defaultProcessor = new ElementProcessor(); } -void ProcessorRegistry::enregister(const std::string tagName, ElementProcessor *processor) { +void ProcessorRegistry::enregister(const std::string& tagName, ElementProcessor *processor) { m_processor[tagName] = processor; } -ElementProcessor * ProcessorRegistry::find(const std::string name) { +ElementProcessor * ProcessorRegistry::find(const std::string& name) { std::map<std::string, ElementProcessor *>::iterator it = m_processor.find(name); return it == m_processor.end()? m_defaultProcessor: it->second;