test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDSpecifics.cc
Go to the documentation of this file.
2 
3 #include <ostream>
4 
11 
12 using DDI::Specific;
13 
15 { }
16 
18 {
19  prep_ = StoreT::instance().create(name);
20 }
21 
23  const std::vector<std::string> & partSelections,
24  const DDsvalues_type & svalues,
25  bool doRegex)
26  : DDBase<DDName,Specific*>()
27 {
28  prep_ = StoreT::instance().create(name, new Specific(partSelections,svalues,doRegex));
29  std::vector<std::pair<DDLogicalPart,std::pair<const DDPartSelection*, const DDsvalues_type*> > > v;
30  rep().updateLogicalPart(v);
31  for( auto& it : v ) {
32  if( it.first.isDefined().second ) {
33  it.first.addSpecifics( it.second );
34  }
35  else {
36  throw cms::Exception("DDException") << "Definition of LogicalPart missing! name="
37  << it.first.ddname().fullname();
38  }
39  }
40 }
41 
43 
44 const std::vector<DDPartSelection> & DDSpecifics::selection() const
45 {
46  return rep().selection();
47 }
48 
50 {
51  return rep().specifics();
52 }
53 
54 // bool DDSpecifics::nodes(DDNodes & result) const
55 // {
56 // return rep().nodes(result);
57 // }
58 
67 std::pair<bool,DDExpandedView> DDSpecifics::node() const
68 {
69  return rep().node();
70 }
71 
72 std::ostream & operator<<( std::ostream & os, const DDSpecifics & sp)
73 {
75  if (defined.first) {
76  os << *(defined.first) << " ";
77  if (defined.second) {
78  sp.rep().stream(os);
79  }
80  else {
81  os << "* specific not defined * ";
82  }
83  }
84  else {
85  os << "* specific not declared * ";
86  }
87  return os;
88 }
89 
90 std::ostream & operator<<( std::ostream & os, const std::vector<std::string> & v)
91 {
92  for( const auto& it : v ) {
93  os << it << std::endl;
94  }
95  return os;
96 }
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
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
static value_type & instance()
std::pair< bool, DDExpandedView > node() const
Calculates the geometrical history of a fully specified PartSelector.
Definition: DDSpecifics.cc:67
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
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:49
DDSpecifics()
Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference ob...
Definition: DDSpecifics.cc:14
Definition: sp.h:21
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:44