00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: TrkExtInterface.h,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $ 00004 // 00005 // Description: 00006 // Abstract base class; derived classes enable TrkRecoTrk to give 00007 // users access to representation-specific functions without having 00008 // the functions in the RecoTrk interface. Users create an object of 00009 // of one of the derived TrkExtInterface classes and pass it to 00010 // TrkRecoTrk::attach(), which will either accept it or reject it, 00011 // depending on whether the TrkRep inside recognizes it. Recognition 00012 // is implemented by a simple equality test on the Rep's key. 00013 // 00014 // Environment: 00015 // Software developed for the BaBar Detector at the SLAC B-Factory. 00016 // 00017 // Author(s): Steve Schaffner 00018 // 00019 //------------------------------------------------------------------------ 00020 00021 #ifndef TRKEXTINTERFACE_HH 00022 #define TRKEXTINTERFACE_HH 00023 00024 class TrkRep; 00025 class IfdKey; 00026 00027 // Class interface // 00028 class TrkExtInterface { 00029 00030 public: 00031 TrkExtInterface(); 00032 virtual ~TrkExtInterface(); 00033 virtual bool attach(TrkRep*); 00034 virtual bool attach(const TrkRep*); 00035 bool isAttached() const {return _myRep != 0;} 00036 bool nonConstAttachment() const { return _nonconst; } 00037 protected: 00038 TrkRep* myRep(); 00039 const TrkRep* myConstRep() const; 00040 virtual const IfdKey& myKey() const = 0; 00041 void setRep(const TrkRep*); 00042 void setRep(TrkRep*); 00043 private: 00044 TrkRep* _myRep; 00045 bool _nonconst; // keep track of whether we attached const or not 00046 // Preempt 00047 TrkExtInterface& operator= (const TrkExtInterface&); 00048 TrkExtInterface(const TrkExtInterface &); 00049 }; 00050 00051 #endif 00052 00053 00054 00055 00056 00057 00058