00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef TRKFUNCTORS_H
00019 #define TRKFUNCTORS_H
00020 #include <functional>
00021
00022 #include "TrkBase/TrkHitOnTrk.h"
00023 #include "TrkBase/TrkErrCode.h"
00024 class TrkHitOnTrkUpdater;
00025 class TrkRep;
00026
00027 namespace TrkBase { namespace Functors {
00028
00029
00030
00031 class cloneHot : public std::unary_function<TrkHitOnTrk,TrkHitOnTrk*> {
00032 public:
00033 cloneHot(TrkRep *parentRep, const TrkDifTraj* trkTraj=0) : _r(parentRep), _t(trkTraj) {}
00034
00035 TrkHitOnTrk *operator()(const TrkHitOnTrk& h) const
00036 { return h.clone(_r,_t); }
00037 private:
00038 TrkRep *_r;
00039 const TrkDifTraj* _t;
00040 };
00041
00042 template <class T> struct takeAddress : std::unary_function<T,T*> {
00043 T* operator()(T& t) { return &t; }
00044 };
00045
00046
00047
00048
00049
00050 class updateMeasurement : public std::unary_function<TrkHitOnTrk,TrkErrCode> {
00051 public:
00052 TrkErrCode operator()(TrkHitOnTrk& h) const
00053 { return h.updateMeasurement(_t,_m); }
00054 private:
00055
00056 friend class ::TrkHitOnTrkUpdater;
00057 updateMeasurement(const TrkDifTraj* traj=0,bool maintainAmbiguity=false) : _t(traj), _m(maintainAmbiguity) {}
00058 const TrkDifTraj *_t;
00059 bool _m;
00060 };
00061
00062 class setActive : public std::unary_function<TrkHitOnTrk,void> {
00063 public:
00064 TrkHitOnTrk* operator()(TrkHitOnTrk& h) const
00065 { return h.setActive(_a); }
00066 TrkHitOnTrk* operator()(TrkHitOnTrk*& h) const
00067 { return h->setActive(_a); }
00068 private:
00069
00070 friend class ::TrkHitOnTrkUpdater;
00071 setActive(bool active) : _a(active){}
00072 bool _a;
00073 };
00074
00075 class setParent : public std::unary_function<TrkHitOnTrk,void> {
00076 public:
00077 TrkHitOnTrk* operator()(TrkHitOnTrk& h) const
00078 { return h.setParent(_p); }
00079 private:
00080
00081 friend class ::TrkHitOnTrkUpdater;
00082 setParent(TrkRep* parent) : _p(parent){}
00083 TrkRep* _p;
00084 };
00085 }}
00086 #endif