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 #include "Specific.h"
4 
5 #include <utility>
6 
7 // Message logger.
9 
10 using DDI::Specific;
11 
12 //DDBase<DDName,Specific*>::StoreT::pointer_type
13 // DDBase<DDName,Specific*>::StoreT::instance_ = 0;
14 
16 { }
17 
18 
20 {
21  prep_ = StoreT::instance().create(name);
22 }
23 
24 
26  const selectors_type & partSelections,
27  const DDsvalues_type & svalues,
28  bool doRegex)
29  : DDBase<DDName,Specific*>()
30 {
31  prep_ = StoreT::instance().create(name, new Specific(partSelections,svalues,doRegex));
32  typedef std::vector<std::pair<DDLogicalPart,std::pair<DDPartSelection*,DDsvalues_type*> > > strange_type;
33  strange_type v;
34  rep().updateLogicalPart(v);
35  strange_type::iterator it = v.begin();
36  for(; it != v.end(); ++it) {
37  if (it->first.isDefined().second) {
38  it->first.addSpecifics(it->second);
39  DCOUT('C', "add specifics to LP: partsel=" << *(it->second.first) );
40  }
41  else {
42  std::string serr("Definition of LogicalPart missing! name=");
43  serr+= it->first.ddname().fullname();
44  throw cms::Exception("DDException") << serr;
45  }
46  }
47 }
48 
49 
51 
52 
53 const std::vector<DDPartSelection> & DDSpecifics::selection() const //
54 {
55  return rep().selection();
56 }
57 
58 
60 {
61  return rep().specifics();
62 }
63 
65 {
66  return rep().nodes(result);
67 }
68 
77 std::pair<bool,DDExpandedView> DDSpecifics::node() const
78 {
79  return rep().node();
80 }
81 
82 // void DDSpecifics::clear()
83 // {
84 // StoreT::instance().clear();
85 // }
86 
87 
88 std::ostream & operator<<( std::ostream & os, const DDSpecifics & sp)
89 {
91  if (defined.first) {
92  os << *(defined.first) << " ";
93  if (defined.second) {
94  sp.rep().stream(os);
95  }
96  else {
97  os << "* specific not defined * ";
98  }
99  }
100  else {
101  os << "* specific not declared * ";
102  }
103  return os;
104 
105 }
106 
107 
108 std::ostream & operator<<( std::ostream & os, const std::vector<std::string> & v)
109 {
110  std::vector<std::string>::const_iterator it = v.begin();
111  for (; it!=v.end(); ++it) {
112  os << *it << std::endl;
113  }
114  return os;
115 }
Definition: DDBase.h:14
const DDI::rep_traits< DDName, DDI::Specific * >::reference rep() const
Definition: DDBase.h:89
std::vector< std::string > selectors_type
Definition: DDSpecifics.h:21
def_type isDefined() const
Definition: DDBase.h:115
DDName is used to identify DDD entities uniquely.
Definition: DDName.h:18
std::ostream & operator<<(std::ostream &out, const ALILine &li)
Definition: ALILine.cc:187
Definition: DDNodes.h:7
static value_type & instance()
std::pair< bool, DDExpandedView > node() const
Calculates the geometrical history of a fully specified PartSelector.
Definition: DDSpecifics.cc:77
tuple result
Definition: query.py:137
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
string const
Definition: compareJSON.py:14
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:59
bool nodes(DDNodes &nds) const
Calculates all expanded-nodes which are selected by the selection-strings.
Definition: DDSpecifics.cc:64
DDSpecifics()
Creates a uninitialized reference-object (see DDLogicalPart documentation for details on reference ob...
Definition: DDSpecifics.cc:15
#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:40
const std::vector< DDPartSelection > & selection() const
Gives a reference to the collection of part-selections.
Definition: DDSpecifics.cc:53