compares a given geometrical-history whether it corresponds to the given part-selector More...
#include <DDComparator.h>
Public Member Functions | |
DDCompareEqual (const DDGeoHistory &h, const DDPartSelection &s) | |
bool | operator() () |
bool | operator() (const DDGeoHistory &, const DDPartSelection &) |
Protected Member Functions | |
bool | nextAnylogp () |
bool | nextAnyposp () |
bool | nextChildlogp () |
bool | nextChildposp () |
Private Member Functions | |
DDCompareEqual () | |
Private Attributes | |
bool | absResult_ |
DDGeoHistory::size_type | hIndex_ |
const DDGeoHistory & | hist_ |
DDGeoHistory::size_type const | hMax_ |
const DDPartSelection & | partsel_ |
int | sCopyno_ |
DDPartSelection::size_type | sIndex_ |
DDLogicalPart | sLp_ |
DDPartSelection::size_type const | sMax_ |
compares a given geometrical-history whether it corresponds to the given part-selector
This is a function-object.
Definition at line 13 of file DDComparator.h.
DDCompareEqual::DDCompareEqual | ( | const DDGeoHistory & | h, |
const DDPartSelection & | s | ||
) | [inline] |
Definition at line 16 of file DDComparator.h.
: hist_(h), partsel_(s), hMax_(h.size()), hIndex_(0), sMax_(s.size()), sIndex_(0), sLp_(), sCopyno_(0), absResult_(hMax_>0 && sMax_>0 ) { // it makes only sense to compare if both std::vectors have at least one entry each. //std::cout << std::endl << std::endl << "COMPARATOR CREATED" << std::endl << std::endl; //DCOUT('U', "Comparator():\n hist=" << h << "\n PartSel=" << s); }
DDCompareEqual::DDCompareEqual | ( | ) | [private] |
bool DDCompareEqual::nextAnylogp | ( | ) | [inline, protected] |
Definition at line 122 of file DDComparator.cc.
References hIndex_, hist_, hMax_, and sLp_.
Referenced by operator()().
{ /* does not help, most of the time is spent when FALSE.... static size_t hIndexOld=0; // hope same position that previous { size_t oldH = hIndexOld; // thread safe??? if (oldH<hMax_ && sLp_== hist_[oldH].logicalPart()) { hIndex_ = oldH+1; ++counter.old; return true; } } */ register size_t hi = hIndex_; while (hi < hMax_) { if (sLp_==hist_[hi].logicalPart()) { // hIndexOld=hIndex_; // ++counter.diff; hIndex_ = hi+1; return true; } ++hi; } hIndex_ = hi; return false; }
bool DDCompareEqual::nextAnyposp | ( | ) | [inline, protected] |
Definition at line 151 of file DDComparator.cc.
References hIndex_, hist_, hMax_, query::result, sCopyno_, and sLp_.
Referenced by operator()().
bool DDCompareEqual::nextChildlogp | ( | ) | [inline, protected] |
bool DDCompareEqual::nextChildposp | ( | ) | [inline, protected] |
Definition at line 180 of file DDComparator.cc.
References hIndex_, hist_, hMax_, query::result, sCopyno_, and sLp_.
Referenced by operator()().
bool DDCompareEqual::operator() | ( | ) |
Definition at line 61 of file DDComparator.cc.
References absResult_, ddanychild, ddanylogp, ddanynode, ddanyposp, ddchildlogp, ddchildposp, hIndex_, nextAnylogp(), nextAnyposp(), nextChildlogp(), nextChildposp(), partsel_, query::result, sCopyno_, sIndex_, sLp_, and sMax_.
{ // don't compare, if history or partsel is empty! (see ctor) bool result(absResult_); /* sIndex_ = running index in the part-selection-std::vector sMax_ = max. value + 1 of sIndex_ hIndex_ = runninig index in the geo-history-std::vector hMax_ = max. value + 1 of hIndex_ sLp_ = current LogicalPart (the redir-ptr!) in the part-selection-std::vector hLp_ = current LogicalPart (the redir-ptr!) in the geo-history-std::vector sCopyno_ = current copy-no in the part-selection-std::vector */ //DCOUT('U', "DDCompareEqual: comparing"); while(result && sIndex_ < sMax_) { sLp_ = partsel_[sIndex_].lp_; sCopyno_ = partsel_[sIndex_].copyno_; ddselection_type stype = partsel_[sIndex_].selectionType_; switch (stype) { case ddanylogp: result=nextAnylogp(); break; case ddanyposp: result=nextAnyposp(); break; case ddchildlogp: result=nextChildlogp(); break; case ddchildposp: result=nextChildposp(); break; case ddanychild: ++sIndex_; ++hIndex_; result=true; break; // ddanynode IS NOT SUPPORTED IN PROTOTYPE SW !!!! case ddanynode: result=false; break; default: result=false; //throw DDException("DDCompareEqual: undefined state!"); } ++sIndex_; } counter().add(result,sIndex_, sMax_); return result; }
bool DDCompareEqual::operator() | ( | const DDGeoHistory & | , |
const DDPartSelection & | |||
) |
Definition at line 56 of file DDComparator.cc.
{ return (*this)(); }
bool DDCompareEqual::absResult_ [private] |
Definition at line 55 of file DDComparator.h.
Referenced by operator()().
DDGeoHistory::size_type DDCompareEqual::hIndex_ [private] |
Definition at line 46 of file DDComparator.h.
Referenced by nextAnylogp(), nextAnyposp(), nextChildlogp(), nextChildposp(), and operator()().
const DDGeoHistory& DDCompareEqual::hist_ [private] |
Definition at line 43 of file DDComparator.h.
Referenced by nextAnylogp(), nextAnyposp(), nextChildlogp(), and nextChildposp().
DDGeoHistory::size_type const DDCompareEqual::hMax_ [private] |
Definition at line 45 of file DDComparator.h.
Referenced by nextAnylogp(), nextAnyposp(), nextChildlogp(), and nextChildposp().
const DDPartSelection& DDCompareEqual::partsel_ [private] |
Definition at line 44 of file DDComparator.h.
Referenced by operator()().
int DDCompareEqual::sCopyno_ [private] |
Definition at line 54 of file DDComparator.h.
Referenced by nextAnyposp(), nextChildposp(), and operator()().
DDPartSelection::size_type DDCompareEqual::sIndex_ [private] |
Definition at line 48 of file DDComparator.h.
Referenced by operator()().
DDLogicalPart DDCompareEqual::sLp_ [private] |
Definition at line 49 of file DDComparator.h.
Referenced by nextAnylogp(), nextAnyposp(), nextChildlogp(), nextChildposp(), and operator()().
DDPartSelection::size_type const DDCompareEqual::sMax_ [private] |
Definition at line 47 of file DDComparator.h.
Referenced by operator()().