CMS 3D CMS Logo

DDSpecifics.cc
Go to the documentation of this file.
2 
3 #include <ostream>
4 
10 
11 using DDI::Specific;
12 
14  : DDBase< DDName, std::unique_ptr<Specific> >()
15 { }
16 
18  : DDBase< DDName, std::unique_ptr<Specific> >()
19 {
20  create( name );
21 }
22 
24  const std::vector<std::string> & partSelections,
25  const DDsvalues_type & svalues,
26  bool doRegex)
27  : DDBase< DDName, std::unique_ptr<Specific> >()
28 {
29  create( name, std::make_unique<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 
43 const std::vector<DDPartSelection> &
45 {
46  return rep().selection();
47 }
48 
49 const DDsvalues_type &
51 {
52  return rep().specifics();
53 }
54 
63 std::pair<bool, DDExpandedView>
65 {
66  return rep().node();
67 }
68 
69 std::ostream & operator<<( std::ostream & os, const DDSpecifics & sp)
70 {
72  if (defined.first) {
73  os << *(defined.first) << " ";
74  if (defined.second) {
75  sp.rep().stream(os);
76  }
77  else {
78  os << "* specific not defined * ";
79  }
80  }
81  else {
82  os << "* specific not declared * ";
83  }
84  return os;
85 }
86 
87 std::ostream & operator<<( std::ostream & os, const std::vector<std::string> & v)
88 {
89  for( const auto& it : v ) {
90  os << it << std::endl;
91  }
92  return os;
93 }
Definition: DDBase.h:10
def_type isDefined() const
Definition: DDBase.h:107
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:15
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Specific > >::reference rep() const
Definition: DDBase.h:80
std::pair< bool, DDExpandedView > node() const
Calculates the geometrical history of a fully specified PartSelector.
Definition: DDSpecifics.cc:64
friend std::ostream & operator<<(std::ostream &, const DDSpecifics &)
Definition: DDSpecifics.cc:69
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
std::pair< const DDName *, bool > def_type
Definition: DDBase.h:66
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
DDSpecifics()
Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference ob...
Definition: DDSpecifics.cc:13
Interface to attach user specific data to nodes in the expanded-view.
Definition: DDSpecifics.h:41
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:44
void create(const DDName &name, std::unique_ptr< DDI::Specific > vals)
Definition: DDBase.h:121