Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:54:58

0001 #include "DetectorDescription/Core/interface/DDVector.h"
0002 
0003 #include <utility>
0004 
0005 DDVector::DDVector() : DDBase<DDName, std::unique_ptr<std::vector<double>>>() {}
0006 
0007 DDVector::DDVector(const DDName& name) : DDBase<DDName, std::unique_ptr<std::vector<double>>>() { create(name); }
0008 
0009 DDVector::DDVector(const DDName& name, std::unique_ptr<std::vector<double>> vals) { create(name, std::move(vals)); }
0010 
0011 std::ostream& operator<<(std::ostream& os, const DDVector& cons) {
0012   os << "DDVector name=" << cons.name();
0013 
0014   if (cons.isDefined().second) {
0015     os << " size=" << cons.size() << " vals=( ";
0016     DDVector::value_type::const_iterator it(cons.values().begin()), ed(cons.values().end());
0017     for (; it < ed; ++it) {
0018       os << *it << ' ';
0019     }
0020     os << ')';
0021   } else {
0022     os << " constant is not yet defined, only declared.";
0023   }
0024   return os;
0025 }
0026 
0027 DDVector::operator std::vector<int>() const {
0028   std::vector<int> result(rep().size());
0029   std::vector<int>::size_type sz = 0;
0030   std::vector<double>::const_iterator it(rep().begin()), ed(rep().end());
0031   for (; it != ed; ++it) {
0032     result[sz] = int(*it);
0033     ++sz;
0034   }
0035   return result;
0036 }