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 //#include "DetectorDescription/Base/interface/DDException.h"
3 
4 // Evaluator
5 //#include "DetectorDescription/ExprAlgo/interface/ExprEvalSingleton.h"
6 
7 
8 
9 DDVector::DDVector() : DDBase<DDName,std::vector<double>*>() { }
10 
11 
12 DDVector::DDVector(const DDName & name) : DDBase<DDName,std::vector<double>*>()
13 {
14  prep_ = StoreT::instance().create(name);
15 }
16 
17 DDVector::DDVector(const DDName & name,std::vector<double>* vals)
18 {
19  prep_ = StoreT::instance().create(name,vals);
20 }
21 
22 
23 std::ostream & operator<<(std::ostream & os, const DDVector & cons)
24 {
25  os << "DDVector name=" << cons.name();
26 
27  if(cons.isDefined().second) {
28  os << " size=" << cons.size() << " vals=( ";
29  DDVector::value_type::const_iterator it(cons.values().begin()), ed(cons.values().end());
30  for(; it<ed; ++it) {
31  os << *it << ' ';
32  }
33  os << ')';
34  }
35  else {
36  os << " constant is not yet defined, only declared.";
37  }
38  return os;
39 }
40 
41 
42 
43 
44 DDVector::operator std::vector<int>() const
45 {
46  std::vector<int> result(rep().size());
48  std::vector<double>::const_iterator it(rep().begin()), ed(rep().end());
49  for (; it != ed; ++it) {
50  result[sz] = int(*it);
51  ++sz;
52  }
53  return result;
54 }
Definition: DDBase.h:14
string rep
Definition: cuy.py:1188
def_type isDefined() const
Definition: DDBase.h:115
const N & name() const
Definition: DDBase.h:82
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:18
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
uint16_t size_type
static value_type & instance()
tuple result
Definition: query.py:137
#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:9
const value_type & values() const
the stored values
Definition: DDVector.h:43
#define begin
Definition: vmac.h:30
tuple size
Write out results.