CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DDSpecifics.cc
Go to the documentation of this file.
2 
3 #include <ostream>
4 
10 
11 using DDI::Specific;
12 
14 
16 
18  const std::vector<std::string>& partSelections,
19  const DDsvalues_type& svalues,
20  bool doRegex)
21  : DDBase<DDName, std::unique_ptr<Specific>>() {
22  create(name, std::make_unique<Specific>(partSelections, svalues, doRegex));
23  std::vector<std::pair<DDLogicalPart, std::pair<const DDPartSelection*, const DDsvalues_type*>>> v;
24  rep().updateLogicalPart(v);
25  for (auto& it : v) {
26  if (it.first.isDefined().second) {
27  it.first.addSpecifics(it.second);
28  } else {
29  throw cms::Exception("DDException") << "Definition of LogicalPart missing! name=" << it.first.ddname().fullname();
30  }
31  }
32 }
33 
34 const std::vector<DDPartSelection>& DDSpecifics::selection() const { return rep().selection(); }
35 
36 const DDsvalues_type& DDSpecifics::specifics() const { return rep().specifics(); }
37 
46 std::pair<bool, DDExpandedView> DDSpecifics::node() const { return rep().node(); }
47 
48 std::ostream& operator<<(std::ostream& os, const DDSpecifics& sp) {
50  if (defined.first) {
51  os << *(defined.first) << " ";
52  if (defined.second) {
53  sp.rep().stream(os);
54  } else {
55  os << "* specific not defined * ";
56  }
57  } else {
58  os << "* specific not declared * ";
59  }
60  return os;
61 }
62 
63 std::ostream& operator<<(std::ostream& os, const std::vector<std::string>& v) {
64  for (const auto& it : v) {
65  os << it << std::endl;
66  }
67  return os;
68 }
Definition: DDBase.h:10
def_type isDefined() const
Definition: DDBase.h:90
const DDI::rep_traits< DDName, std::unique_ptr< DDI::Specific > >::reference rep() const
Definition: DDBase.h:65
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:17
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:167
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::pair< bool, DDExpandedView > node() const
Calculates the geometrical history of a fully specified PartSelector.
Definition: DDSpecifics.cc:46
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:36
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:34
void create(const DDName &name, std::unique_ptr< DDI::Specific >vals)
Definition: DDBase.h:96