CMS 3D CMS Logo

DDVector.cc
Go to the documentation of this file.
2 
3 #include <utility>
4 
6 
8 
9 DDVector::DDVector(const DDName& name, std::unique_ptr<std::vector<double>> vals) { create(name, std::move(vals)); }
10 
11 std::ostream& operator<<(std::ostream& os, const DDVector& cons) {
12  os << "DDVector name=" << cons.name();
13 
14  if (cons.isDefined().second) {
15  os << " size=" << cons.size() << " vals=( ";
16  DDVector::value_type::const_iterator it(cons.values().begin()), ed(cons.values().end());
17  for (; it < ed; ++it) {
18  os << *it << ' ';
19  }
20  os << ')';
21  } else {
22  os << " constant is not yet defined, only declared.";
23  }
24  return os;
25 }
26 
27 DDVector::operator std::vector<int>() const {
28  std::vector<int> result(rep().size());
30  std::vector<double>::const_iterator it(rep().begin()), ed(rep().end());
31  for (; it != ed; ++it) {
32  result[sz] = int(*it);
33  ++sz;
34  }
35  return result;
36 }
size
Write out results.
Definition: DDBase.h:10
size_t size() const
the size of the array of values
Definition: DDVector.h:36
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::ostream & operator<<(std::ostream &os, const DDVector &cons)
output operator for printing ...
Definition: DDVector.cc:11
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
uint16_t size_type
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
Definition: DDVector.h:18
rep
Definition: cuy.py:1189
DDVector()
an uninitialized constant; one can assign an initialized constant to make it valid ...
Definition: DDVector.cc:5
const value_type & values() const
the stored values
Definition: DDVector.h:39
def_type isDefined() const
Definition: DDBase.h:90
def move(src, dest)
Definition: eostools.py:511
void create(const DDName &name, std::unique_ptr< std::vector< double > > vals)
Definition: DDBase.h:96