CMS 3D CMS Logo

DDComparator.cc
Go to the documentation of this file.
2 
3 #include <cstddef>
4 #include <memory>
5 
7 
8 // reason for the ctor: reference initialization at construction.
9 // FIXME: DDCompareEqual: use pointers instead of references, initialize to 0 and
10 // FIXME: do the check in operator() instead of in the ctor
11 
12 bool
14 {
15  return (*this)();
16 }
17 
19 {
20 
21  // don't compare, if history or partsel is empty! (see ctor)
22  bool result(absResult_);
23 
24  /*
25  sIndex_ = running index in the part-selection-std::vector
26  sMax_ = max. value + 1 of sIndex_
27  hIndex_ = runninig index in the geo-history-std::vector
28  hMax_ = max. value + 1 of hIndex_
29  sLp_ = current LogicalPart (the redir-ptr!) in the part-selection-std::vector
30  hLp_ = current LogicalPart (the redir-ptr!) in the geo-history-std::vector
31  sCopyno_ = current copy-no in the part-selection-std::vector
32  */
33  //DCOUT('U', "DDCompareEqual: comparing");
34 
35  while(result && sIndex_ < sMax_) {
36  sLp_ = partsel_[sIndex_].lp_;
37  sCopyno_ = partsel_[sIndex_].copyno_;
38  ddselection_type stype = partsel_[sIndex_].selectionType_;
39  switch (stype) {
40 
41  case ddanylogp:
42  result=nextAnylogp();
43  break;
44 
45  case ddanyposp:
46  result=nextAnyposp();
47  break;
48 
49  case ddchildlogp:
50  result=nextChildlogp();
51  break;
52 
53  case ddchildposp:
54  result=nextChildposp();
55  break;
56 
57  case ddanychild:
58  ++sIndex_;
59  ++hIndex_;
60  result=true;
61  break;
62 
63  // ddanynode IS NOT SUPPORTED IN PROTOTYPE SW !!!!
64  case ddanynode:
65  result=false;
66  break;
67 
68  default:
69  result=false;
70  //throw DDException("DDCompareEqual: undefined state!");
71  }
72  ++sIndex_;
73  }
74  return result;
75 }
76 
77 
79 {
80  size_t hi = hIndex_;
81  while (hi < hMax_) {
82  if (sLp_==hist_[hi].logicalPart()) {
83  hIndex_ = hi+1;
84  return true;
85  }
86  ++hi;
87  }
88  hIndex_ = hi;
89  return false;
90 }
91 
92 
94 {
95  bool result(false);
96  while (hIndex_ < hMax_) {
97  if (sLp_ == hist_[hIndex_].logicalPart() &&
98  sCopyno_ == hist_[hIndex_].copyno() )
99  { result=true;
100  ++hIndex_;
101  break;
102  }
103  ++hIndex_;
104  }
105  return result;
106 }
107 
108 
110 {
111  bool result(false);
112  if (hIndex_ < hMax_) {
113  if (sLp_ == hist_[hIndex_].logicalPart()) {
114  ++hIndex_;
115  result=true;
116  }
117  }
118  return result;
119 }
120 
121 
123 {
124  bool result(false);
125  if (hIndex_ < hMax_) {
126  if (sLp_ == hist_[hIndex_].logicalPart() &&
127  sCopyno_ == hist_[hIndex_].copyno() ) {
128  ++hIndex_;
129  result=true;
130  }
131  }
132  return result;
133 }
DDPartSelection::size_type sIndex_
Definition: DDComparator.h:51
bool nextChildposp()
DDPartSelection::size_type const sMax_
Definition: DDComparator.h:50
bool nextAnyposp()
Definition: DDComparator.cc:93
ddselection_type
DDLogicalPart sLp_
Definition: DDComparator.h:52
bool nextAnylogp()
Definition: DDComparator.cc:78
std::vector< DDExpandedNode > DDGeoHistory
Geometrical &#39;path&#39; of the current node up to the root-node.
const DDPartSelection & partsel_
Definition: DDComparator.h:47
DDGeoHistory::size_type hIndex_
Definition: DDComparator.h:49
DDGeoHistory::size_type const hMax_
Definition: DDComparator.h:48
bool nextChildlogp()
const DDGeoHistory & hist_
Definition: DDComparator.h:46