CMS 3D CMS Logo

DDVector.cc
Go to the documentation of this file.
2 
3 #include <utility>
4 
6 
7 DDVector::DDVector() : DDBase<DDName,std::vector<double>*>() { }
8 
9 
10 DDVector::DDVector(const DDName & name) : DDBase<DDName,std::vector<double>*>()
11 {
12  prep_ = StoreT::instance().create(name);
13 }
14 
15 DDVector::DDVector(const DDName & name,std::vector<double>* vals)
16 {
17  prep_ = StoreT::instance().create(name,vals);
18 }
19 
20 
21 std::ostream & operator<<(std::ostream & os, const DDVector & cons)
22 {
23  os << "DDVector name=" << cons.name();
24 
25  if(cons.isDefined().second) {
26  os << " size=" << cons.size() << " vals=( ";
27  DDVector::value_type::const_iterator it(cons.values().begin()), ed(cons.values().end());
28  for(; it<ed; ++it) {
29  os << *it << ' ';
30  }
31  os << ')';
32  }
33  else {
34  os << " constant is not yet defined, only declared.";
35  }
36  return os;
37 }
38 
39 
40 
41 
42 DDVector::operator std::vector<int>() const
43 {
44  std::vector<int> result(rep().size());
46  std::vector<double>::const_iterator it(rep().begin()), ed(rep().end());
47  for (; it != ed; ++it) {
48  result[sz] = int(*it);
49  ++sz;
50  }
51  return result;
52 }
Definition: DDBase.h:10
const DDI::rep_traits< DDName, std::vector< double > * >::reference rep() const
Definition: DDBase.h:84
def_type isDefined() const
Definition: DDBase.h:110
const DDName & name() const
Definition: DDBase.h:78
size_t size() const
the size of the array of values
Definition: DDVector.h:40
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:21
uint16_t size_type
static value_type & instance()
a named constant corresponding to the DDL-XML tag <Constant> and <ConstantsVector> ...
Definition: DDVector.h:17
DDVector()
an uninitialized constant; one can assign an initialized constant to make it valid ...
Definition: DDVector.cc:7
const value_type & values() const
the stored values
Definition: DDVector.h:43