#include <ostream>
#include <map>
#include <vector>
#include <algorithm>
#include "DetectorDescription/Core/interface/DDValue.h"
Go to the source code of this file.
Typedefs | |
typedef DDsvalues_type::value_type | DDsvalues_Content_type |
typedef std::vector< std::pair < unsigned int, DDValue > > | DDsvalues_type |
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::mapped DDValue. | |
Functions | |
bool | DDfetch (const DDsvalues_type *, DDValue &) |
helper for retrieving DDValues from DDsvalues_type *. | |
unsigned int | DDfetch (const std::vector< const DDsvalues_type * > &sp, DDValue &toFetch, std::vector< DDValue > &result) |
helper for retrieving DDValues from a std::vector of (DDsvalues_type *). | |
DDsvalues_type::const_iterator | find (DDsvalues_type::const_iterator begin, DDsvalues_type::const_iterator end, unsigned int id) |
DDsvalues_type::const_iterator | find (DDsvalues_type const &sv, unsigned int id) |
void | merge (DDsvalues_type &target, DDsvalues_type const &sv, bool sortit=true) |
bool | operator< (const DDsvalues_Content_type &lh, const DDsvalues_Content_type &rh) |
std::ostream & | operator<< (std::ostream &, const std::vector< const DDsvalues_type * > &) |
std::ostream & | operator<< (std::ostream &, const DDsvalues_type &) |
typedef DDsvalues_type::value_type DDsvalues_Content_type |
Definition at line 20 of file DDsvalues.h.
typedef std::vector< std::pair<unsigned int, DDValue> > DDsvalues_type |
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::mapped DDValue.
Definition at line 19 of file DDsvalues.h.
bool DDfetch | ( | const DDsvalues_type * | p, |
DDValue & | v | ||
) |
helper for retrieving DDValues from DDsvalues_type *.
Example:
std::vector<std::string> myFunction(const DDsvalues_type * svalptr, const std::string & name) { static std::vector<std::string> v; // empty std::vector, for zero result DDValue val(name); if (DDfetch(svalptr,val)) { return val.std::strings(); } else { return v; } }
Definition at line 102 of file DDsvalues.cc.
References spr::find(), and query::result.
Referenced by DDMapper< KeyType, ValueType >::all(), RPCGeometryBuilderFromDDD::buildGeometry(), DTGeometryParsFromDD::buildGeometry(), DTGeometryBuilderFromDDD::buildGeometry(), RPCGeometryParsFromDD::buildGeometry(), dddGetStringRaw(), DDfetch(), HFShowerLibrary::getDDDArray(), MaterialBudgetHcalHistos::getDDDArray(), HCalSD::getDDDArray(), HFFibre::getDDDArray(), HFShower::getDDDArray(), HFShowerPMT::getDDDArray(), HFShowerFibreBundle::getDDDArray(), HcalNumberingFromDDD::getDDDArray(), HFShowerParam::getDDDArray(), ECalSD::getDDDArray(), DDG4Builder::getDouble(), DDG4Builder::getInt(), MuonDDDNumbering::getInt(), CaloTrkProcessing::getNames(), CaloTrkProcessing::getNumbers(), DDG4SensitiveConverter::getString(), ExtractStringFromDDD::getString(), ECalSD::getStringArray(), CocoaAnalyzer::myFetchDbl(), CocoaAnalyzer::myFetchString(), DDMapper< KeyType, ValueType >::noSpecifics(), DDMapper< KeyType, ValueType >::toDouble(), DDMapper< KeyType, ValueType >::toString(), and MagGeoBuilderFromDDD::volumeHandle::volumeHandle().
unsigned int DDfetch | ( | const std::vector< const DDsvalues_type * > & | sp, |
DDValue & | toFetch, | ||
std::vector< DDValue > & | result | ||
) |
helper for retrieving DDValues from a std::vector of (DDsvalues_type *).
Definition at line 114 of file DDsvalues.cc.
References prof2calltree::count, and DDfetch().
DDsvalues_type::const_iterator find | ( | DDsvalues_type::const_iterator | begin, |
DDsvalues_type::const_iterator | end, | ||
unsigned int | id | ||
) | [inline] |
DDsvalues_type::const_iterator find | ( | DDsvalues_type const & | sv, |
unsigned int | id | ||
) | [inline] |
Definition at line 38 of file DDsvalues.h.
References spr::find().
{ return find(sv.begin(),sv.end(),id); }
void merge | ( | DDsvalues_type & | target, |
DDsvalues_type const & | sv, | ||
bool | sortit = true |
||
) |
Definition at line 21 of file DDsvalues.cc.
References spr::find(), and python::multivaluedict::sort().
{ static Counter counter = {0,0,0,0,0}; if (target.empty()) { ++counter.empty; target = sv; return; } DDsvalues_type::const_iterator sit = sv.begin(); DDsvalues_type::const_iterator sed = sv.end(); // fast merge if (target.back()<sv.front()) { ++counter.end; target.insert(target.end(),sit,sed); return; } if (sv.back()<target.front()) { ++counter.begin; target.insert(target.begin(),sit,sed); return; } { DDsvalues_type::iterator it = std::lower_bound(target.begin(),target.end(),sv.front()); if (it == std::lower_bound(target.begin(),target.end(),sv.back())) { ++counter.middle; target.insert(it,sit,sed); return; } } // it nevers arrives here... ++counter.mixed; target.reserve(target.size()+sv.size()); DDsvalues_type::const_iterator ted = target.end(); for (; sit != sed; ++sit) { DDsvalues_type::const_iterator it = find(target.begin(),ted, (*sit).first); if (it!=ted) const_cast<DDsvalues_Content_type&>(*it).second = (*sit).second; else target.push_back(*sit); } if (sortit) std::sort(target.begin(),target.end()); }
bool operator< | ( | const DDsvalues_Content_type & | lh, |
const DDsvalues_Content_type & | rh | ||
) | [inline] |
Definition at line 26 of file DDsvalues.h.
{
return lh.first < rh.first;
}
std::ostream& operator<< | ( | std::ostream & | , |
const std::vector< const DDsvalues_type * > & | |||
) |
std::ostream& operator<< | ( | std::ostream & | , |
const DDsvalues_type & | |||
) |
Definition at line 62 of file DDsvalues.cc.