00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: TrkFitTypeKey.h,v 1.1.1.1 2005/04/21 06:01:42 zhangy Exp $ 00004 // 00005 // Description: 00006 // Class TrkFitTypeKey 00007 // 00008 // Environment: 00009 // Software developed for BaBar expirment @ SLAC B-Factory 00010 // 00011 // Author List: 00012 // Eric A Charles 00013 // 00014 // Copyright Information: 00015 // Copyright (C) 1998 Univ. Wisconsin-Madsion 00016 // 00017 //------------------------------------------------------------------------ 00018 00019 #ifndef TRKFITTYPEKEY_HH 00020 #define TRKFITTYPEKEY_HH 00021 00022 //------------- 00023 // C Headers -- 00024 //------------- 00025 #include <vector> 00026 #include <iostream> 00027 #include "MdcRecoUtil/PdtPid.h" 00028 00029 class IfdKey; 00030 00031 class TrkFitTypeKey { 00032 00033 //-------------------- 00034 // static Members -- 00035 //-------------------- 00036 00037 public: 00038 // methods 00039 static int currentKey() { return _keys.size(); } 00040 00041 static void killFitType(const TrkFitTypeKey key); 00042 00043 protected: 00044 static int newFitType(const char* name=0); 00045 00046 private: 00047 00048 // Data members 00049 static std::vector<IfdKey*> _keys; 00050 static std::vector<PdtPid::PidType> _pidTypes; 00051 static const int _defaultValue; 00052 00053 //-------------------- 00054 // Instance Members -- 00055 //-------------------- 00056 00057 public: 00058 00059 // standard c'tor makes a new IfdKey from a char* and associates a PidType 00060 TrkFitTypeKey( const char* name = 0, 00061 const PdtPid::PidType pid = PdtPid::null ); 00062 00063 // copy c'tor 00064 TrkFitTypeKey( const TrkFitTypeKey& ); 00065 TrkFitTypeKey( const int& ); 00066 00067 // Destructor 00068 virtual ~TrkFitTypeKey( ); 00069 00070 // Operators 00071 bool operator==( const TrkFitTypeKey& rhs ) const{ 00072 return _value == rhs.value(); 00073 } 00074 bool operator< ( const TrkFitTypeKey& rhs ) const{ 00075 return _value < rhs.value(); 00076 } 00077 TrkFitTypeKey& operator= ( const TrkFitTypeKey& rhs ) { 00078 _value = rhs.value(); 00079 return *this; 00080 } 00081 00082 // Selectors (const) 00083 const int& value() const { return _value; } 00084 00085 const IfdKey* ifdKey() const { 00086 if ( _value < 0 || _value >= currentKey() ) return 0; 00087 return _keys[_value]; 00088 } 00089 00090 PdtPid::PidType pidType() const { 00091 if ( _value < 0 || _value >= currentKey() ) return PdtPid::null; 00092 return _pidTypes[_value]; 00093 } 00094 00095 void printAll( std::ostream& os = std::cout ) const; 00096 00097 private: 00098 00099 // Data members 00100 int _value; 00101 00102 }; 00103 00104 std::ostream& operator<<(std::ostream& os, const TrkFitTypeKey& key); 00105 00106 #endif