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.
4 
5 using DDI::Specific;
6 
8 { }
9 
11 {
12  prep_ = StoreT::instance().create(name);
13 }
14 
16  const std::vector<std::string> & partSelections,
17  const DDsvalues_type & svalues,
18  bool doRegex)
19  : DDBase<DDName,Specific*>()
20 {
21  prep_ = StoreT::instance().create(name, new Specific(partSelections,svalues,doRegex));
22  std::vector<std::pair<DDLogicalPart,std::pair<const DDPartSelection*, const DDsvalues_type*> > > v;
23  rep().updateLogicalPart(v);
24  for( auto& it : v ) {
25  if( it.first.isDefined().second ) {
26  it.first.addSpecifics( it.second );
27  DCOUT('C', "add specifics to LP: partsel=" << *( it.second.first ));
28  }
29  else {
30  throw cms::Exception("DDException") << "Definition of LogicalPart missing! name="
31  << it.first.ddname().fullname();
32  }
33  }
34 }
35 
37 
38 const std::vector<DDPartSelection> & DDSpecifics::selection() const
39 {
40  return rep().selection();
41 }
42 
44 {
45  return rep().specifics();
46 }
47 
48 // bool DDSpecifics::nodes(DDNodes & result) const
49 // {
50 // return rep().nodes(result);
51 // }
52 
61 std::pair<bool,DDExpandedView> DDSpecifics::node() const
62 {
63  return rep().node();
64 }
65 
66 std::ostream & operator<<( std::ostream & os, const DDSpecifics & sp)
67 {
69  if (defined.first) {
70  os << *(defined.first) << " ";
71  if (defined.second) {
72  sp.rep().stream(os);
73  }
74  else {
75  os << "* specific not defined * ";
76  }
77  }
78  else {
79  os << "* specific not declared * ";
80  }
81  return os;
82 }
83 
84 std::ostream & operator<<( std::ostream & os, const std::vector<std::string> & v)
85 {
86  for( const auto& it : v ) {
87  os << it << std::endl;
88  }
89  return os;
90 }
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:14
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
static value_type & instance()
std::pair< bool, DDExpandedView > node() const
Calculates the geometrical history of a fully specified PartSelector.
Definition: DDSpecifics.cc:61
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:19
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:43
DDSpecifics()
Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference ob...
Definition: DDSpecifics.cc:7
#define DCOUT(M_v_Y, M_v_S)
Definition: DDdebug.h:53
Interface to attach user specific data to nodes in the expanded-view.
Definition: DDSpecifics.h:37
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:38