00001 //-------------------------------------------------------------------------- 00002 // File and Version Information: 00003 // $Id: HTRange.h,v 1.2 2009/12/23 02:59:56 zhangy Exp $ 00004 // 00005 // Description: 00006 // Template of HTRange class - class to hold lower/upper limits 00007 // for tuple columns 00008 // 00009 // Environment: 00010 // Software developed for the BaBar Detector at the SLAC B-Factory. 00011 // 00012 // Author List: 00013 // Salnikov 00014 // 00015 // Copyright Information: 00016 // Copyright (C) 1994 <Institution> 00017 // 00018 // History: 00019 // Migration for BESIII MDC 00020 // 00021 //------------------------------------------------------------------------ 00022 00023 #ifndef HTRange_H 00024 #define HTRange_H 00025 00026 //------------- 00027 // C Headers -- 00028 //------------- 00029 extern "C" { 00030 } 00031 00032 //---------------------- 00033 // Base Class Headers -- 00034 //---------------------- 00035 00036 //------------------------------- 00037 // Collaborating Class Headers -- 00038 //------------------------------- 00039 00040 //------------------------------------ 00041 // Collaborating Class Declarations -- 00042 //------------------------------------ 00043 00044 // --------------------- 00045 // -- Class Interface -- 00046 // --------------------- 00047 00048 template<class T> 00049 class HTRange { 00050 00051 //-------------------- 00052 // Declarations -- 00053 //-------------------- 00054 00055 // Typedefs, consts, and enums 00056 00057 //-------------------- 00058 // Instance Members -- 00059 //-------------------- 00060 00061 public: 00062 00063 // Constructors 00064 HTRange() : 00065 _defined(false), _lower(0), _upper(0) 00066 { 00067 } 00068 HTRange(T lower, T upper) : 00069 _defined(true), _lower(lower), _upper(upper) 00070 { 00071 } 00072 00073 // Copy Constructor 00074 HTRange( const HTRange<T>& o) : 00075 _defined(o._defined), _lower(o._lower), _upper(o._upper) 00076 { 00077 } 00078 00079 // Destructor 00080 ~HTRange( ) {} 00081 00082 // Operators 00083 00084 HTRange<T>& operator= ( const HTRange<T>& o) 00085 { 00086 if (&o == this) return *this; 00087 _defined = o._defined ; 00088 _lower = o._lower ; 00089 _upper = o._upper ; 00090 return *this ; 00091 } 00092 00093 // Selectors (const) 00094 bool operator()() const { return _defined ; } 00095 00096 // get upper/lower limits 00097 T lower() const { return _lower ; } 00098 T upper() const { return _upper ; } 00099 00100 // Modifiers 00101 00102 protected: 00103 00104 // Helper functions 00105 00106 private: 00107 00108 // Friends 00109 00110 // Data members 00111 bool _defined ; 00112 T _lower, _upper ; 00113 00114 }; 00115 00116 // 00117 // Some compilers require definitions of template methods to reside 00118 // in a separate .cc file, and some require them to reside in the .hh 00119 // file (this file). The following construct allows us to control 00120 // this from the makefile. 00121 00122 // 1. Implement your methods in HTRange.cc. 00123 // 2. Exclude the HTRange.cc file from the list of compilations. 00124 00125 //SKIP #ifdef BES_COMP_INST 00126 //CHANGE #include "MdcTrkRecon/Tools/HTRange.cxx" 00127 #include "HTRange.icc" 00128 00129 //SKIP #endif // BES_COMP_INST 00130 00131 #endif // TEMPLATE_H