CMS 3D CMS Logo

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