00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00016
00017 #ifndef CANDBASE_H
00018 #define CANDBASE_H
00019
00020 #include "TNamed.h"
00021 #include "TObjArray.h"
00022 #include "TRef.h"
00023
00024 #include "CandData/CandRecord.h"
00025 #include "Candidate/CandRefCounted.h"
00026
00027 class AlgConfig;
00028 class AlgHandle;
00029 class CandHandle;
00030 class CandRefer;
00031 class CandUid;
00032 class VldContext;
00033
00034 class CandBase : public TNamed, public CandRefCounted
00035 {
00036
00037 friend class CandHandle;
00038 friend class CandRefer;
00039 friend class CandUid;
00040
00041 public:
00042 static Int_t GetNAlloc() {return fsNAlloc;}
00043 CandBase();
00044
00045 virtual void Trace(const char *c = "") const;
00046
00047 virtual std::ostream& FormatToOStream(std::ostream& os,
00048 Option_t *option="") const;
00049 virtual std::ostream& FormatDaughtersToOStream(std::ostream& os,
00050 Option_t *option="") const;
00051
00052 protected:
00053 TRef fAlgConfigRef;
00054 CandRecord *fCandRecord;
00055 TObjArray fDaughters;
00056 CandHandle *fLocalHandle;
00057
00058 CandBase(const AlgHandle &ah);
00059 CandBase(const CandBase &cb);
00060 virtual ~CandBase();
00061
00062 const CandHandle *AddDaughterLink(const CandHandle &ch);
00063 virtual void CreateLocalHandle() = 0;
00064 virtual CandBase *Dup() const = 0;
00065 AlgConfig *GetAlgConfig() const;
00066 UInt_t GetArchUidInt() const;
00067 const CandUid &GetCandUid() const {return *fCandUid;}
00068 const CandHandle *GetDaughter(Int_t ndau) const;
00069 TIter GetDaughterIterator() const;
00070 const CandHandle *GetLocalHandle() const {return fLocalHandle;}
00071 Int_t GetNDaughters() const;
00072 UInt_t GetUidInt() const;
00073 Bool_t HasOverlapWith(const CandBase &cb) const;
00074 Bool_t IsComposite() const;
00075 virtual Bool_t IsEquivalent(const TObject* rhs) const;
00076 Bool_t RemoveDaughter(CandHandle *ch);
00077 void SetCandRecord(CandRecord *cr);
00078 void SetLocalHandle(CandHandle *ch);
00079
00080
00081
00082 template<class mType>
00083 Bool_t TestArrayEquality(const char* mbrName, int arrLen,
00084 const mType& thisMbr,
00085 const mType& rhsMbr) const;
00086
00087 template<class chType>
00088 Bool_t TestCandHandleDup(const char* chName,
00089 const chType* thisCH,
00090 const chType* rCndCH ) const;
00091
00092 template<class _char>
00093 void TestDisplayCandBanner(_char* mName) const;
00094
00095 template<class mType>
00096 Bool_t TestEquality(const char* mbrName,
00097 const mType& thisMbr,
00098 const mType& rhsMbr) const;
00099
00100 template<class mType>
00101 Bool_t TestEquivalence(const char* mName,
00102 const mType& thisMbr,
00103 const mType& rhsMbr) const;
00104
00105 template<class elemType>
00106 Bool_t TestGenericElemPtrTObjArrayPtrEquality(const char* arrName,
00107 const TObjArray* thisTOA,
00108 const TObjArray* rCndTOA) const;
00109
00110 template<class elemType>
00111 Bool_t TestGenericElemPtrTObjArrayPtrEquivalence(const char* arrName,
00112 const TObjArray* thisTOA,
00113 const TObjArray* rCndTOA,
00114 Bool_t testEquivalence=true) const;
00115
00116 template<class _char>
00117 void TestNothing(_char* mName = "Candidate") const;
00118
00119 template<class mType>
00120 Bool_t TestPtrEquivalence(const char* mName,
00121 const mType* thisMbr,
00122 const mType* rhsMbr) const;
00123
00124 template<class toaType>
00125 Bool_t TestTObjArrayCandHandleDup(const char* arrName,
00126 const toaType& thisTOA,
00127 const toaType& rCndTOA) const;
00128
00129 template<class toaType>
00130 Bool_t TestTObjArrayEquality(const char* arrName,
00131 const toaType& thisTOA,
00132 const toaType& rCndTOA) const;
00133
00134 template<class toaType>
00135 Bool_t TestTObjArrayPtrEquality(const char* arrName,
00136 const toaType* thisTOA,
00137 const toaType* rCndTOA) const;
00138
00139 template<class toaType>
00140 Bool_t TestTObjArrayPtrEquivalence(const char* arrName,
00141 const toaType* thisTOA,
00142 const toaType* rCndTOA,
00143 Bool_t testEquivalence=true) const;
00144
00145
00146 static const TString& GetIndentString() { return fgIndentString; }
00147 static const TString& GetDataIndent() { return fgDataIndentString; }
00148 static void SetDataIndent(const TString& distr)
00149 { fgDataIndentString=distr;}
00150 static Int_t DecIndent()
00151 { --fgIndentLevel; return ResizeIndent(); }
00152 static Int_t IncIndent()
00153 { ++fgIndentLevel; return ResizeIndent(); }
00154
00155
00156 private:
00157 UInt_t fArchUidInt;
00158 CandUid *fCandUid;
00159 static Int_t fsNAlloc;
00160 CandBase &operator=(const CandBase &);
00161
00162
00163 static Int_t fgIndentLevel;
00164 static TString fgIndentString;
00165 static TString fgDataIndentString;
00166
00167 static Int_t ResizeIndent();
00168
00169 ClassDef(CandBase,2)
00170
00171 };
00172
00173 #if defined(MACOSX) && (__GNUC__ <= 3)
00174 #include "Candidate/CandBase.tpl"
00175 #endif
00176
00177 #endif // CANDBASE_H