CMS 3D CMS Logo

DDVector.cc
Go to the documentation of this file.
2 
3 #include <utility>
4 
6  : DDBase< DDName, std::unique_ptr<std::vector< double >>>()
7 {}
8 
10  : DDBase< DDName, std::unique_ptr<std::vector< double >>>()
11 {
12  create( name );
13 }
14 
15 DDVector::DDVector( const DDName & name, std::unique_ptr<std::vector<double> > vals )
16 {
17  create( name, std::move( vals ));
18 }
19 
20 std::ostream & operator<<(std::ostream & os, const DDVector & cons)
21 {
22  os << "DDVector name=" << cons.name();
23 
24  if(cons.isDefined().second) {
25  os << " size=" << cons.size() << " vals=( ";
26  DDVector::value_type::const_iterator it(cons.values().begin()), ed(cons.values().end());
27  for(; it<ed; ++it) {
28  os << *it << ' ';
29  }
30  os << ')';
31  }
32  else {
33  os << " constant is not yet defined, only declared.";
34  }
35  return os;
36 }
37 
38 DDVector::operator std::vector<int>() const
39 {
40  std::vector<int> result(rep().size());
42  std::vector<double>::const_iterator it(rep().begin()), ed(rep().end());
43  for (; it != ed; ++it) {
44  result[sz] = int(*it);
45  ++sz;
46  }
47  return result;
48 }
Definition: DDBase.h:10
def_type isDefined() const
Definition: DDBase.h:107
size_t size() const
the size of the array of values
Definition: DDVector.h:38
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
std::ostream & operator<<(std::ostream &os, const DDVector &cons)
output operator for printing ...
Definition: DDVector.cc:20
uint16_t size_type
const DDI::rep_traits< DDName, std::unique_ptr< std::vector< double > > >::reference rep() const
Definition: DDBase.h:80
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
Definition: DDVector.h:18
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:41
def move(src, dest)
Definition: eostools.py:511
void create(const DDName &name, std::unique_ptr< std::vector< double > > vals)
Definition: DDBase.h:121