#include <HistorianCustomRules.h>
Inheritance diagram for DetElemContainsRule< Q >:
Public Member Functions | |
DetElemContainsRule (std::string n, const IDetectorElement *value) | |
virtual | ~DetElemContainsRule () |
virtual bool | select (const RuleParser::Queriable *thing) |
virtual const std::string & | name () const |
Protected Attributes | |
std::string | m_name |
Rule * | mA |
Rule * | mB |
Private Attributes | |
const IDetectorElement * | mValue |
Definition at line 28 of file HistorianCustomRules.h.
DetElemContainsRule< Q >::DetElemContainsRule | ( | std::string | n, | |
const IDetectorElement * | value | |||
) | [inline] |
virtual DetElemContainsRule< Q >::~DetElemContainsRule | ( | ) | [inline, virtual] |
bool DetElemContainsRule< Q >::select | ( | const RuleParser::Queriable * | thing | ) | [virtual] |
Implements RuleParser::Rule.
Definition at line 43 of file HistorianCustomRules.h.
00044 { 00045 const Q* q = dynamic_cast<const Q*>(thing); 00046 assert(q && "Was given the wrong kind of Queriable!"); 00047 const IDetectorElement* curElement = q->getDetectorElement(); 00048 if(!curElement) return false; 00049 if(!mValue) return false; 00050 // The problem with this method is that parentIDetectorElement() seems to crash. 00051 // bool done = false; 00052 // while(!done) { 00053 // if(curElement == mValue) return true; 00054 // if(curElement == 0) return false; 00055 // curElement = curElement->parentIDetectorElement(); 00056 // } 00058 const IGeometryInfo* curGeo = curElement->geometry(); 00059 const IGeometryInfo* valGeo = mValue->geometry(); 00060 ILVolume::ReplicaPath dummy; 00061 while(true){ 00062 if(!curGeo) break; // We got to the top of the tree and never hit the Value 00063 if(curGeo == valGeo) return true; // The value matches a parent of the current position.. it's contained 00064 IGeometryInfo* nextGeo = 0; 00065 curGeo->location(nextGeo, dummy); 00066 curGeo = nextGeo; // Ok, move up a level and check again. 00067 } 00068 return false; 00069 }
const IDetectorElement* DetElemContainsRule< Q >::mValue [private] |
Definition at line 37 of file HistorianCustomRules.h.