test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDVector.cc
Go to the documentation of this file.
2 
3 #include <utility>
4 
6 //#include "DetectorDescription/Base/interface/DDException.h"
7 
8 // Evaluator
9 //#include "DetectorDescription/ExprAlgo/interface/ExprEvalSingleton.h"
10 
11 
12 
13 DDVector::DDVector() : DDBase<DDName,std::vector<double>*>() { }
14 
15 
16 DDVector::DDVector(const DDName & name) : DDBase<DDName,std::vector<double>*>()
17 {
18  prep_ = StoreT::instance().create(name);
19 }
20 
21 DDVector::DDVector(const DDName & name,std::vector<double>* vals)
22 {
23  prep_ = StoreT::instance().create(name,vals);
24 }
25 
26 
27 std::ostream & operator<<(std::ostream & os, const DDVector & cons)
28 {
29  os << "DDVector name=" << cons.name();
30 
31  if(cons.isDefined().second) {
32  os << " size=" << cons.size() << " vals=( ";
33  DDVector::value_type::const_iterator it(cons.values().begin()), ed(cons.values().end());
34  for(; it<ed; ++it) {
35  os << *it << ' ';
36  }
37  os << ')';
38  }
39  else {
40  os << " constant is not yet defined, only declared.";
41  }
42  return os;
43 }
44 
45 
46 
47 
48 DDVector::operator std::vector<int>() const
49 {
50  std::vector<int> result(rep().size());
52  std::vector<double>::const_iterator it(rep().begin()), ed(rep().end());
53  for (; it != ed; ++it) {
54  result[sz] = int(*it);
55  ++sz;
56  }
57  return result;
58 }
Definition: DDBase.h:10
string rep
Definition: cuy.py:1188
def_type isDefined() const
Definition: DDBase.h:110
const N & 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:16
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:188
uint16_t size_type
tuple result
Definition: mps_fire.py:84
static value_type & instance()
#define end
Definition: vmac.h:37
a named constant corresponding to the DDL-XML tag &lt;Constant&gt; and &lt;ConstantsVector&gt; ...
Definition: DDVector.h:17
DDVector()
an uninitialized constant; one can assign an initialized constant to make it valid ...
Definition: DDVector.cc:13
const value_type & values() const
the stored values
Definition: DDVector.h:43
#define begin
Definition: vmac.h:30
tuple size
Write out results.