CMS 3D CMS Logo

DDSpecifics.cc
Go to the documentation of this file.
2 
3 #include <ostream>
4 
11 
12 using DDI::Specific;
13 
15  : DDBase<DDName,Specific*>()
16 { }
17 
19 {
20  prep_ = StoreT::instance().create(name);
21 }
22 
24  const std::vector<std::string> & partSelections,
25  const DDsvalues_type & svalues,
26  bool doRegex)
27  : DDBase<DDName,Specific*>()
28 {
29  prep_ = StoreT::instance().create(name, new Specific(partSelections,svalues,doRegex));
30  std::vector<std::pair<DDLogicalPart,std::pair<const DDPartSelection*, const DDsvalues_type*> > > v;
31  rep().updateLogicalPart(v);
32  for( auto& it : v ) {
33  if( it.first.isDefined().second ) {
34  it.first.addSpecifics( it.second );
35  }
36  else {
37  throw cms::Exception("DDException") << "Definition of LogicalPart missing! name="
38  << it.first.ddname().fullname();
39  }
40  }
41 }
42 
44 
45 const std::vector<DDPartSelection> & DDSpecifics::selection() const
46 {
47  return rep().selection();
48 }
49 
51 {
52  return rep().specifics();
53 }
54 
55 // bool DDSpecifics::nodes(DDNodes & result) const
56 // {
57 // return rep().nodes(result);
58 // }
59 
68 std::pair<bool,DDExpandedView> DDSpecifics::node() const
69 {
70  return rep().node();
71 }
72 
73 std::ostream & operator<<( std::ostream & os, const DDSpecifics & sp)
74 {
76  if (defined.first) {
77  os << *(defined.first) << " ";
78  if (defined.second) {
79  sp.rep().stream(os);
80  }
81  else {
82  os << "* specific not defined * ";
83  }
84  }
85  else {
86  os << "* specific not declared * ";
87  }
88  return os;
89 }
90 
91 std::ostream & operator<<( std::ostream & os, const std::vector<std::string> & v)
92 {
93  for( const auto& it : v ) {
94  os << it << std::endl;
95  }
96  return os;
97 }
Definition: DDBase.h:10
const DDI::rep_traits< DDName, DDI::Specific * >::reference rep() const
Definition: DDBase.h:84
def_type isDefined() const
Definition: DDBase.h:110
const DDName & name() const
Definition: DDBase.h:78
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
static value_type & instance()
std::pair< bool, DDExpandedView > node() const
Calculates the geometrical history of a fully specified PartSelector.
Definition: DDSpecifics.cc:68
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
friend std::ostream & operator<<(std::ostream &, const DDSpecifics &)
Definition: DDSpecifics.cc:73
const DDsvalues_type & specifics() const
Reference to the user-data attached to all nodes selected by the selections-strings given through sel...
Definition: DDSpecifics.cc:50
~DDSpecifics() override
Definition: DDSpecifics.cc:43
DDSpecifics()
Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference ob...
Definition: DDSpecifics.cc:14
Interface to attach user specific data to nodes in the expanded-view.
Definition: DDSpecifics.h:42
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:45