CMS 3D CMS Logo

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