diff --git a/DDAlign/src/GlobalDetectorAlignment.cpp b/DDAlign/src/GlobalDetectorAlignment.cpp index 15f1e12a4..73a8293a7 100644 --- a/DDAlign/src/GlobalDetectorAlignment.cpp +++ b/DDAlign/src/GlobalDetectorAlignment.cpp @@ -103,7 +103,7 @@ namespace { GlobalAlignment _alignment(const GlobalDetectorAlignment& det) { dd4hep::DetElement::Object& e = det._data(); if ( !e.global_alignment.isValid() ) { - std::string path = dd4hep::detail::tools::placementPath(det); + std::string path = dd4hep::detail::tools::placementPath(det); e.global_alignment = dd4hep::Ref_t(new GlobalAlignmentData(path)); } dd4hep::Handle h(e.global_alignment); @@ -142,13 +142,13 @@ namespace { /// Initializing constructor GlobalDetectorAlignment::GlobalDetectorAlignment(DetElement e) - : DetElement(e) + : DetElement(std::move(e)) { } /// Initializing constructor GlobalDetectorAlignment::GlobalDetectorAlignment(DetElement&& e) - : DetElement(e) + : DetElement(std::move(e)) { } diff --git a/DDCore/include/DD4hep/GrammarParsed.h b/DDCore/include/DD4hep/GrammarParsed.h index d74dd6662..ea2c5485f 100644 --- a/DDCore/include/DD4hep/GrammarParsed.h +++ b/DDCore/include/DD4hep/GrammarParsed.h @@ -59,13 +59,13 @@ namespace dd4hep { TYPE temp; try { #ifdef DD4HEP_DEBUG_PROPERTIES - std::cout << "Parsing " << val << std::endl; + std::cout << "Parsing " << val << std::endl; #endif - sc = ::dd4hep::Parsers::parse(temp, val); - if ( sc ) { - *(TYPE*)ptr = temp; - return true; - } + sc = ::dd4hep::Parsers::parse(temp, val); + if ( sc ) { + *(TYPE*)ptr = std::move(temp); + return true; + } } catch (...) { } @@ -75,12 +75,12 @@ namespace dd4hep { if ( !sc ) sc = gr.evaluate(&temp,val); #ifdef DD4HEP_DEBUG_PROPERTIES std::cout << "Sc=" << sc << " Converting value: " << val - << " to type " << typeid(TYPE).name() - << std::endl; + << " to type " << typeid(TYPE).name() + << std::endl; #endif if ( sc ) { - *(TYPE*)ptr = temp; - return true; + *(TYPE*)ptr = std::move(temp); + return true; } BasicGrammar::invalidConversion(val, typeid(TYPE)); return false; @@ -97,20 +97,20 @@ namespace dd4hep { template inline int eval_item(T* ptr, const std::string& val) { /// First try to parse the value with spirit. try { - T temp; - int sc = ::dd4hep::Parsers::parse(temp,val); - if ( sc ) { - *ptr = temp; - return 1; - } + T temp; + int sc = ::dd4hep::Parsers::parse(temp,val); + if ( sc ) { + *ptr = temp; + return 1; + } } catch (...) { } /// If this failed: try to evaluate it with the expression parser auto result = grammar_evaluate_item(val); if (result.first == tools::Evaluator::OK) { - *ptr = (T)result.second; - return 1; + *ptr = (T)result.second; + return 1; } /// This also failed: Return error. return 0; @@ -127,9 +127,9 @@ namespace dd4hep { TYPE val; const BasicGrammar& grammar = BasicGrammar::instance(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace_back(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace_back(val); } return 1; } @@ -139,9 +139,9 @@ namespace dd4hep { TYPE val; const BasicGrammar& grammar = BasicGrammar::instance(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace_back(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace_back(val); } return 1; } @@ -151,9 +151,9 @@ namespace dd4hep { TYPE val; const BasicGrammar& grammar = BasicGrammar::instance(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace(val); } return 1; } @@ -163,9 +163,9 @@ namespace dd4hep { TYPE val; const BasicGrammar& grammar = BasicGrammar::instance(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace_back(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace_back(val); } return 1; } @@ -175,9 +175,9 @@ namespace dd4hep { std::pair val; const BasicGrammar& grammar = BasicGrammar::instance >(); for(auto i=std::begin(temp); i != std::end(temp); ++i) { - if ( !grammar.fromString(&val,*i) ) - return 0; - p->emplace(val); + if ( !grammar.fromString(&val,*i) ) + return 0; + p->emplace(val); } return 1; } @@ -188,37 +188,37 @@ namespace dd4hep { p->clear(); int sc = Parsers::parse(buff,str); if ( sc ) { - return fill_data(p,buff); + return fill_data(p,buff); } else { - TYPE temp; - std::map map_buff; - // If we get called from python, the values and keys are already in string form - sc = 0; - try { - sc = ::dd4hep::Parsers::parse(map_buff,str); - } - catch(...) { - } - if ( !sc ) { - // Otherwise stringyfy the values - std::string temp_str = grammar_pre_parse_map(str); - try { - sc = ::dd4hep::Parsers::parse(map_buff,temp_str); - } - catch(...) { - } - } - if ( sc ) { - for(const auto& _o : map_buff ) { - typename TYPE::key_type _k {}; - typename TYPE::mapped_type _v {}; - eval_item(&_k, _o.first); - eval_item(&_v, _o.second); - p->emplace(_k,_v); - } - return 1; - } + TYPE temp; + std::map map_buff; + // If we get called from python, the values and keys are already in string form + sc = 0; + try { + sc = ::dd4hep::Parsers::parse(map_buff,str); + } + catch(...) { + } + if ( !sc ) { + // Otherwise stringyfy the values + std::string temp_str = grammar_pre_parse_map(str); + try { + sc = ::dd4hep::Parsers::parse(map_buff,temp_str); + } + catch(...) { + } + } + if ( sc ) { + for(const auto& _o : map_buff ) { + typename TYPE::key_type _k {}; + typename TYPE::mapped_type _v {}; + eval_item(&_k, _o.first); + eval_item(&_v, _o.second); + p->emplace(_k,_v); + } + return 1; + } } return 0; } @@ -228,29 +228,29 @@ namespace dd4hep { std::vector buff; int sc = Parsers::parse(buff,str); if ( sc ) { - return fill_data(p,buff); + return fill_data(p,buff); } else { - TYPE temp; - /// First try with the simple object string transformation - std::string temp_str = grammar_pre_parse_obj(str); - sc = ::dd4hep::Parsers::parse(temp,temp_str); - if ( sc ) { - *p = temp; - return 1; - } - /// Now the more complicated one: - temp_str = grammar_pre_parse_cont(str); - sc = ::dd4hep::Parsers::parse(temp,temp_str); - if ( sc ) { - *p = temp; - return 1; - } - buff.clear(); - sc = Parsers::parse(buff,temp_str); - if ( sc ) { - return fill_data(p,buff); - } + TYPE temp; + /// First try with the simple object string transformation + std::string temp_str = grammar_pre_parse_obj(str); + sc = ::dd4hep::Parsers::parse(temp,temp_str); + if ( sc ) { + *p = std::move(temp); + return 1; + } + /// Now the more complicated one: + temp_str = grammar_pre_parse_cont(str); + sc = ::dd4hep::Parsers::parse(temp,temp_str); + if ( sc ) { + *p = std::move(temp); + return 1; + } + buff.clear(); + sc = Parsers::parse(buff,temp_str); + if ( sc ) { + return fill_data(p,buff); + } } return 0; } @@ -291,29 +291,29 @@ namespace dd4hep { #define DD4HEP_PARSER_GRAMMAR_CNAME(serial,name) namespace_dd4hep__grammar_##serial##_##name -#define DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(xx,func) \ - namespace dd4hep { namespace detail { \ - template<> int grammar_eval(const BasicGrammar&, void* _p, const std::string& _v) {\ - return func ((xx*)_p,_v); \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(xx,func) \ + namespace dd4hep { namespace detail { \ + template<> int grammar_eval(const BasicGrammar&, void* _p, const std::string& _v) { \ + return func ((xx*)_p,_v); \ }}} -#define DD4HEP_DEFINE_PARSER_GRAMMAR_INSTANCE(serial,xx) \ - namespace dd4hep { \ - template class Grammar< xx >; \ - template BasicGrammar const& BasicGrammar::instance< xx >(); \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_INSTANCE(serial,xx) \ + namespace dd4hep { \ + template class Grammar< xx >; \ + template BasicGrammar const& BasicGrammar::instance< xx >(); \ template const GrammarRegistry& GrammarRegistry::pre_note(int); \ - } \ - namespace DD4HEP_PARSER_GRAMMAR_CNAME(serial,0) { \ - static auto s_reg = ::dd4hep::GrammarRegistry::pre_note< xx >(1); \ + } \ + namespace DD4HEP_PARSER_GRAMMAR_CNAME(serial,0) { \ + static auto s_reg = ::dd4hep::GrammarRegistry::pre_note< xx >(1); \ } -#define DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,ctxt,xx,func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(xx,func) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,ctxt,xx,func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_EVAL(xx,func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_INSTANCE(DD4HEP_PARSER_GRAMMAR_CNAME(serial,ctxt),xx) #if defined(DD4HEP_HAVE_ALL_PARSERS) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_func) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,x,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,2,std::vector, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,3,std::list, eval_container) \ @@ -327,18 +327,18 @@ namespace dd4hep { DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,11,dd4hep::detail::Primitive::string_pair_t, eval_pair) #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL_SERIAL(serial,xx,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,12,xx,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,12,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,13,std::vector,eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,14,std::list,eval_container) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT_SERIAL(serial,xx) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_item) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT_SERIAL(serial,xx) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_item) \ DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,unsigned xx,eval_item) #else -#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,xx,eval_func) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,2,std::vector, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,3,std::list, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,4,std::set, eval_container) \ @@ -348,7 +348,7 @@ namespace dd4hep { DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,8,dd4hep::detail::Primitive::string_pair_t, eval_pair) #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_ROOTMATH(serial,xx,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,xx,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,1,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,2,std::vector, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,3,std::list, eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,4,std::set, eval_container) \ @@ -358,11 +358,11 @@ namespace dd4hep { DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,8,dd4hep::detail::Primitive::string_pair_t, eval_pair) #define DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_VL_SERIAL(serial,xx,eval_func) \ - DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,9,xx,eval_func) \ + DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,9,xx,eval_func) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,10,std::vector,eval_container) \ DD4HEP_DEFINE_PARSER_GRAMMAR_SERIAL(serial,11,std::list,eval_container) -#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT_SERIAL(serial,xx) \ +#define DD4HEP_DEFINE_PARSER_GRAMMAR_U_CONT_SERIAL(serial,xx) \ DD4HEP_DEFINE_PARSER_GRAMMAR_CONT_SERIAL(serial,xx,eval_item) #endif diff --git a/DDCore/include/DD4hep/Path.h b/DDCore/include/DD4hep/Path.h index d5bfd0b03..3b577b494 100644 --- a/DDCore/include/DD4hep/Path.h +++ b/DDCore/include/DD4hep/Path.h @@ -48,15 +48,17 @@ namespace dd4hep { Path() : std::string() { } /// Initializing constructor Path(const std::string& copy) : std::string(copy) { } + /// Initializing constructor + Path(std::string&& copy) : std::string(std::move(copy)) { } /// Copy constructor Path(const Path& copy) : std::string(copy) { } /// Move constructor - Path(Path&& copy) : std::string(copy) { } + Path(Path&& copy) : std::string(std::move(copy)) { } /// Assigning constructor template Path(Iter _begin,Iter _end) { if ( _begin != _end ) { std::string str(_begin, _end); - this->std::string::operator=(str); + this->std::string::operator=(std::move(str)); } } /// Default destructor @@ -73,12 +75,12 @@ namespace dd4hep { } /// Move assignment operator from Path object Path& operator=(Path&& copy) { - this->std::string::operator=(copy); + this->std::string::operator=(std::move(copy)); return *this; } /// Assignment operator from string object Path& operator=(std::string&& copy) { - this->std::string::operator=(copy); + this->std::string::operator=(std::move(copy)); return *this; } /// Append operation diff --git a/DDCore/include/DD4hep/Shapes.h b/DDCore/include/DD4hep/Shapes.h index cb0f8b32a..850be9646 100644 --- a/DDCore/include/DD4hep/Shapes.h +++ b/DDCore/include/DD4hep/Shapes.h @@ -152,7 +152,7 @@ namespace dd4hep { /// Direct assignment using the implementation pointer Solid_type(T* p) : Handle(p) { } /// Move Constructor from handle - Solid_type(Handle&& e) : Handle(e) { } + Solid_type(Handle&& e) : Handle(std::move(e)) { } /// Copy Constructor from handle Solid_type(const Handle& e) : Handle(e) { } /// Constructor to be used when passing an already created object: need to check pointers diff --git a/DDCore/include/XML/Helper.h b/DDCore/include/XML/Helper.h index e0960f222..3a6770f01 100644 --- a/DDCore/include/XML/Helper.h +++ b/DDCore/include/XML/Helper.h @@ -28,7 +28,7 @@ namespace dd4hep { template T getAttrOrDefault(const dd4hep::xml::Element& e, const dd4hep::xml::XmlChar* attr_name, T default_value) { - return (e.hasAttr(attr_name)) ? e.attr(attr_name) : default_value; + return (e.hasAttr(attr_name)) ? e.attr(attr_name) : std::move(default_value); } /// Namespace for implementation details of the AIDA detector description toolkit diff --git a/DDCore/include/XML/XMLElements.h b/DDCore/include/XML/XMLElements.h index 2db5332f9..15e933fd2 100644 --- a/DDCore/include/XML/XMLElements.h +++ b/DDCore/include/XML/XMLElements.h @@ -567,7 +567,7 @@ namespace dd4hep { template <> INLINE Attribute Handle_t::attr(const XmlChar* tag_value, Attribute default_value) const { Attribute a = attr_nothrow(tag_value); - return a ? a : default_value; + return a ? a : std::move(default_value); } template <> INLINE bool Handle_t::attr(const XmlChar* tag_value, bool default_value) const { @@ -607,7 +607,7 @@ namespace dd4hep { template <> INLINE std::string Handle_t::attr(const XmlChar* tag_value, std::string default_value) const { Attribute a = attr_nothrow(tag_value); - return a ? _toString(attr_value(a)) : default_value; + return a ? _toString(attr_value(a)) : std::move(default_value); } #if 0 diff --git a/DDCore/src/DetectorTools.cpp b/DDCore/src/DetectorTools.cpp index bee5e7c10..4ba769af9 100644 --- a/DDCore/src/DetectorTools.cpp +++ b/DDCore/src/DetectorTools.cpp @@ -262,21 +262,21 @@ static void detail::tools::makePlacementPath(PlacementPath det_nodes, PlacementP void detail::tools::placementPath(DetElement element, PlacementPath& all_nodes) { PlacementPath det_nodes; elementPath(element,det_nodes); - makePlacementPath(det_nodes, all_nodes); + makePlacementPath(std::move(det_nodes), all_nodes); } /// Collect detector elements placements to the parent detector element [no holes!] void detail::tools::placementPath(DetElement parent, DetElement element, PlacementPath& all_nodes) { PlacementPath det_nodes; elementPath(parent,element,det_nodes); - makePlacementPath(det_nodes, all_nodes); + makePlacementPath(std::move(det_nodes), all_nodes); } /// Assemble the path of the PlacedVolume selection std::string detail::tools::placementPath(DetElement element) { PlacementPath path; placementPath(element,path); - return placementPath(path); + return placementPath(std::move(path)); } /// Assemble the path of the PlacedVolume selection diff --git a/DDCore/src/FieldTypes.cpp b/DDCore/src/FieldTypes.cpp index 16b94b58f..b5e16a4c8 100644 --- a/DDCore/src/FieldTypes.cpp +++ b/DDCore/src/FieldTypes.cpp @@ -122,7 +122,7 @@ void MultipoleField::fieldComponents(const double* pos, double* field) { this->transform.GetTranslation(this->translation); } Transform3D::Point p, p0(pos[0],pos[1],pos[2]); - if ( flag&FIELD_IDENTITY ) p = p0; + if ( flag&FIELD_IDENTITY ) p = std::move(p0); else if ( flag&FIELD_POSITION_ONLY ) p = p0 - this->translation; else p = this->inverse * p0; diff --git a/DDCore/src/Path.cpp b/DDCore/src/Path.cpp index b8b2e9b0e..62c363393 100644 --- a/DDCore/src/Path.cpp +++ b/DDCore/src/Path.cpp @@ -139,7 +139,7 @@ Path Path::normalize() const { // ignore a name and following ".." if ( temp.empty() && itr_path.find(colon) != std::string::npos ) { - temp = itr_path; + temp = std::move(itr_path); continue; } else if (!temp.empty() diff --git a/DDCore/src/XML/Utilities.cpp b/DDCore/src/XML/Utilities.cpp index 98ae694b7..cf5345b3e 100644 --- a/DDCore/src/XML/Utilities.cpp +++ b/DDCore/src/XML/Utilities.cpp @@ -117,7 +117,7 @@ dd4hep::Volume dd4hep::xml::createStdVolume(Detector& description, xml::Element elt.visStr("").c_str(), elt.regionStr("").c_str(), elt.limitsStr("").c_str()); - elt = x_s; + elt = std::move(x_s); } else if ( elt.hasAttr(_U(type)) ) { typ = elt.typeStr(); diff --git a/DDCore/src/plugins/DetectorCheck.cpp b/DDCore/src/plugins/DetectorCheck.cpp index 53b251e68..bde6c8d05 100644 --- a/DDCore/src/plugins/DetectorCheck.cpp +++ b/DDCore/src/plugins/DetectorCheck.cpp @@ -203,7 +203,7 @@ void DetectorCheck::execute(DetElement sdet, size_t depth) { } if ( check_volmgr ) { - Chain chain; + Chain chain; PlacedVolume pv = m_det.placement(); VolIDs ids; @@ -219,7 +219,7 @@ void DetectorCheck::execute(DetElement sdet, size_t depth) { } m_sens_counters.reset(); m_current_detector = m_det; - checkManagerVolumeTree(m_det, pv, ids, chain, 1, depth); + checkManagerVolumeTree(m_det, pv, std::move(ids), chain, 1, depth); count_volmgr_place = m_place_counters; count_volmgr_sens = m_sens_counters; total += count_volmgr_place; @@ -623,7 +623,7 @@ void DetectorCheck::checkManagerVolumeTree(DetElement detector, PlacedVolume pv, child_chain.emplace_back(place); child_ids.insert(child_ids.end(), place.volIDs().begin(), place.volIDs().end()); checkManagerSingleVolume(de, place, child_ids, child_chain); - checkManagerVolumeTree(de, place, child_ids, child_chain, depth+1, mx_depth); + checkManagerVolumeTree(de, place, std::move(child_ids), child_chain, depth+1, mx_depth); } } } diff --git a/DDCore/src/plugins/DetectorChecksum.cpp b/DDCore/src/plugins/DetectorChecksum.cpp index 0a3f42f35..6c2578d9b 100644 --- a/DDCore/src/plugins/DetectorChecksum.cpp +++ b/DDCore/src/plugins/DetectorChecksum.cpp @@ -1472,11 +1472,11 @@ static long create_checksum(Detector& description, int argc, char** argv) { DetectorChecksum wr(description); DetElement de = description.world(); wr.precision = precision; - if ( !len_unit.empty() ) wr.m_len_unit_nam = len_unit; - if ( !ang_unit.empty() ) wr.m_ang_unit_nam = ang_unit; - if ( !ene_unit.empty() ) wr.m_ene_unit_nam = ene_unit; - if ( !dens_unit.empty() ) wr.m_densunit_nam = dens_unit; - if ( !atom_unit.empty() ) wr.m_atomunit_nam = atom_unit; + if ( !len_unit.empty() ) wr.m_len_unit_nam = std::move(len_unit); + if ( !ang_unit.empty() ) wr.m_ang_unit_nam = std::move(ang_unit); + if ( !ene_unit.empty() ) wr.m_ene_unit_nam = std::move(ene_unit); + if ( !dens_unit.empty() ) wr.m_densunit_nam = std::move(dens_unit); + if ( !atom_unit.empty() ) wr.m_atomunit_nam = std::move(atom_unit); if ( newline ) wr.newline = "\n"; wr.have_hash_strings = have_hash_strings; wr.write_files = write_files; diff --git a/DDCore/src/plugins/ShapePlugins.cpp b/DDCore/src/plugins/ShapePlugins.cpp index 212b1f151..e9f3c4fff 100644 --- a/DDCore/src/plugins/ShapePlugins.cpp +++ b/DDCore/src/plugins/ShapePlugins.cpp @@ -714,8 +714,8 @@ static Handle create_BooleanShape(Detector&, xml_h element) { xml_comp_t x_shape2( c ) ; // and create solids - Solid solid1( xml_comp_t( x_shape1 ).createShape()) ; - Solid solid2( xml_comp_t( x_shape2 ).createShape()) ; + Solid solid1( xml_comp_t( std::move(x_shape1) ).createShape()) ; + Solid solid2( xml_comp_t( std::move(x_shape2) ).createShape()) ; std::string op = e.attr(_U(operation)) ; diff --git a/DDCore/src/plugins/StandardPlugins.cpp b/DDCore/src/plugins/StandardPlugins.cpp index 28a0018d2..3b4fa7c81 100644 --- a/DDCore/src/plugins/StandardPlugins.cpp +++ b/DDCore/src/plugins/StandardPlugins.cpp @@ -1136,7 +1136,7 @@ static long dump_volume_tree(Detector& description, int argc, char** argv) { std::stringstream log; PlacedVolume pv(ideal); bool sensitive = false; - std::string opt_info, pref = prefix; + std::string opt_info, pref = std::move(prefix); if ( level >= m_printMaxLevel ) { return 1; @@ -1599,7 +1599,7 @@ template long dump_detelement_tree(Detector& description, int argc, c IDDescriptor id_descriptor; Actor actor(description); actor.parse_args(argc, argv); - return actor.dump(description.world(), 0, id_descriptor, chain); + return actor.dump(description.world(), 0, id_descriptor, std::move(chain)); } DECLARE_APPLY(DD4hep_DetectorDump,dump_detelement_tree<0>) DECLARE_APPLY(DD4hep_DetectorVolumeDump,dump_detelement_tree<1>) diff --git a/DDDigi/include/DDDigi/DigiContainerProcessor.h b/DDDigi/include/DDDigi/DigiContainerProcessor.h index 9875baa17..69193d94f 100644 --- a/DDDigi/include/DDDigi/DigiContainerProcessor.h +++ b/DDDigi/include/DDDigi/DigiContainerProcessor.h @@ -78,7 +78,7 @@ namespace dd4hep { predicate_t() = default; predicate_t(std::function func, uint32_t i, const segmentation_t* s) - : callback(func), id(i), segmentation(s) {} + : callback(std::move(func)), id(i), segmentation(s) {} predicate_t(predicate_t&& copy) = default; predicate_t(const predicate_t& copy) = default; predicate_t& operator = (predicate_t&& copy) = default; diff --git a/DDDigi/include/DDDigi/DigiData.h b/DDDigi/include/DDDigi/DigiData.h index 3ec987f15..f0d529f7e 100644 --- a/DDDigi/include/DDDigi/DigiData.h +++ b/DDDigi/include/DDDigi/DigiData.h @@ -1004,7 +1004,7 @@ namespace dd4hep { template bool emplace(Key key, T&& data_item) { key.set_segment(this->id); data_item.key.set_segment(this->id); - return this->emplace_any(key, std::move(data_item)); + return this->emplace_any(std::move(key), std::move(data_item)); } /// Move data items other than std::any to the data segment template bool put(Key key, DATA&& data); diff --git a/DDDigi/include/DDDigi/DigiROOTInput.h b/DDDigi/include/DDDigi/DigiROOTInput.h index a2e7ed457..44a9bc37f 100644 --- a/DDDigi/include/DDDigi/DigiROOTInput.h +++ b/DDDigi/include/DDDigi/DigiROOTInput.h @@ -50,7 +50,7 @@ namespace dd4hep { Key key; TBranch& branch; TClass& clazz; - container_t(Key k, TBranch& b, TClass& c) : key(k), branch(b), clazz(c) {} + container_t(Key k, TBranch& b, TClass& c) : key(std::move(k)), branch(b), clazz(c) {} }; class work_t { public: diff --git a/DDDigi/io/DigiIO.cpp b/DDDigi/io/DigiIO.cpp index e259a7865..56bd3a0e4 100644 --- a/DDDigi/io/DigiIO.cpp +++ b/DDDigi/io/DigiIO.cpp @@ -474,7 +474,7 @@ namespace dd4hep { const std::vector& input, ParticleMapping& particles) { - Key mkey = key; + Key mkey = std::move(key); for( auto* part_ptr : input ) { std::shared_ptr p(part_ptr); Particle part; diff --git a/DDDigi/plugins/DigiResegment.cpp b/DDDigi/plugins/DigiResegment.cpp index 31197f16f..81d4f6583 100644 --- a/DDDigi/plugins/DigiResegment.cpp +++ b/DDDigi/plugins/DigiResegment.cpp @@ -131,7 +131,7 @@ namespace dd4hep { ); } EnergyDeposit d(dep.second); - d.position = global; + d.position = std::move(global); d.momentum = dep.second.momentum; m.emplace(new_cell, std::move(d)); } diff --git a/DDDigi/src/DigiData.cpp b/DDDigi/src/DigiData.cpp index 6ed37f59c..20f3afab6 100644 --- a/DDDigi/src/DigiData.cpp +++ b/DDDigi/src/DigiData.cpp @@ -96,8 +96,8 @@ const Particle& dd4hep::digi::get_history_particle(const DigiEvent& event, Key h key.set_segment(history_key.segment()); key.set_mask(history_key.mask()); key.set_item(item_key.item()); - const auto& particles = segment.get(key); - return particles.get(history_key); + const auto& particles = segment.get(std::move(key)); + return particles.get(std::move(history_key)); } const EnergyDeposit& dd4hep::digi::get_history_deposit(const DigiEvent& event, Key::itemkey_type container_item, Key history_key) { @@ -106,7 +106,7 @@ const EnergyDeposit& dd4hep::digi::get_history_deposit(const DigiEvent& event, K key.set_segment(history_key.segment()); key.set_item(container_item); key.set_mask(history_key.mask()); - const auto& hits = segment.get(key); + const auto& hits = segment.get(std::move(key)); return hits.at(history_key.item()); } @@ -160,8 +160,8 @@ void EnergyDeposit::update_deposit_weighted(const EnergyDeposit& upda) { double err = depositError + upda.depositError; Position pos = ((deposit / sum) * position) + ((upda.deposit / sum) * upda.position); Direction mom = ((deposit / sum) * momentum) + ((upda.deposit / sum) * upda.momentum); - position = pos; - momentum = mom; + position = std::move(pos); + momentum = std::move(mom); deposit = sum; depositError = err; history.update(upda.history); @@ -173,8 +173,8 @@ void EnergyDeposit::update_deposit_weighted(EnergyDeposit&& upda) { double err = depositError + upda.depositError; Position pos = ((deposit / sum) * position) + ((upda.deposit / sum) * upda.position); Direction mom = ((deposit / sum) * momentum) + ((upda.deposit / sum) * upda.momentum); - position = pos; - momentum = mom; + position = std::move(pos); + momentum = std::move(mom); deposit = sum; depositError = err; history.update(std::move(upda.history)); @@ -506,7 +506,7 @@ const std::any* DataSegment::get_item(Key key, bool exc) const { it = this->data.find(key); if (it != this->data.end()) return &it->second; - if ( exc ) throw std::runtime_error(invalid_request(key)); + if ( exc ) throw std::runtime_error(invalid_request(std::move(key))); return nullptr; } diff --git a/DDDigi/src/DigiStoreDump.cpp b/DDDigi/src/DigiStoreDump.cpp index 26b49cdee..5f7893e1a 100644 --- a/DDDigi/src/DigiStoreDump.cpp +++ b/DDDigi/src/DigiStoreDump.cpp @@ -119,8 +119,8 @@ DigiStoreDump::dump_history(DigiContext& context, str << Key::key_name(container_key) << "[" << seq_no << "]:"; line = format("+----- %-30s Container: Segment:%04X Mask:%04X Item:%08X Cell:%016lX History: Hits:%ld Parts:%ld", - str.str().c_str(), container_key.segment(), container_key.mask(), container_key.item(), - cell, item.history.hits.size(), item.history.particles.size()); + str.str().c_str(), int(container_key.segment()), int(container_key.mask()), int(container_key.item()), + cell, item.history.hits.size(), item.history.particles.size()); records.emplace_back(line); for( std::size_t i=0; i