Bdb packages | Design docs | Source docs | Guidelines | Recent releases

Search | Site Map .

Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

/BdbTime/BdbIntervalBase.hh

Go to the documentation of this file.
00001 
00002 //-----------------------------------------------------------------------------
00003 //
00004 // File and Version Information:
00005 //      $Id: BdbIntervalBase.hh,v 1.3 2002/04/05 00:29:37 gpdf Exp $
00006 //
00007 // Description:
00008 //      Class BdbIntervalBase. Purely transient class describing a time interval,
00009 //      base for the BdbInterval class used in database lookups.
00010 //
00011 // Environment:
00012 //      Software developed for the BaBar Detector at the SLAC B-Factory.
00013 //
00014 // Author List:
00015 //      Dave Brown, 11-12-97
00016 //
00017 // Copyright Information:
00018 //      Copyright (C) 1997      Lawrence Berkeley Laboratory
00019 //
00020 //-----------------------------------------------------------------------------
00021 
00022 #ifndef BDBINTERVALBASE_HH
00023 #define BDBINTERVALBASE_HH
00024 
00025 //-------------------------------
00026 // Collaborating Class Headers --
00027 //-------------------------------
00028 #include "BdbTime/BdbTime.hh"
00029 //              ---------------------
00030 //              -- Class Interface --
00031 //              ---------------------
00032 
00033 class BdbIntervalBase {
00034 
00035 public:
00036 
00037   // Constructors
00038   BdbIntervalBase( const BdbTime& startTime = BdbTime::minusInfinity,
00039                    const BdbTime& endTime   = BdbTime::plusInfinity   );
00040 
00041   BdbIntervalBase( const BdbIntervalBase& other );
00042 
00043   // Destructor
00044   virtual ~BdbIntervalBase( )
00045     { 
00046     }
00047 
00048   // Operators
00049   BdbIntervalBase & operator = ( const BdbIntervalBase& other )
00050     {
00051       if( &other != this ) 
00052         {
00053           _beginTime = other._beginTime;
00054           _endTime   = other._endTime;
00055         }
00056       return *this;
00057     }
00058 
00059   // Selectors (const)
00060   BdbTime getBeginTime( ) const 
00061     {
00062       return _beginTime; 
00063     }
00064 
00065   BdbTime getEndTime( ) const 
00066     {
00067       return _endTime; 
00068     }
00069 
00070   const BdbTime& beginTime( ) const 
00071     { 
00072       return _beginTime;
00073     }
00074 
00075   const BdbTime& endTime( ) const 
00076     { 
00077       return _endTime; 
00078     }
00079 
00080   // Modifiers
00081   void setBeginTime( const BdbTime& theTime ) 
00082     {
00083       _beginTime = theTime; 
00084     }
00085 
00086   void setEndTime( const BdbTime& theTime ) 
00087     {
00088       _endTime = theTime; 
00089     }
00090 
00091   // Member Functions
00092   bool inInterval( const BdbTime& time ) const 
00093     {
00094       return ( time >= _beginTime && time < _endTime ); 
00095     }
00096 
00097   bool inInterval( const BdbIntervalBase& other ) const 
00098     {
00099       return ( other._beginTime >= _beginTime &&
00100                other._endTime   <= _endTime      ); 
00101     }
00102 
00103   bool operator == ( const BdbIntervalBase & o   ) const     
00104     { 
00105       return (    _beginTime  == o._beginTime 
00106                && _endTime    == o._endTime     );
00107     }
00108 
00109 
00110   // overloaded stream-insertion operator <<
00111   friend ostream & operator << ( ostream& os, const BdbIntervalBase& t );   
00112 
00113 
00114 protected:
00115 
00116   // Data members
00117   BdbTime            _beginTime;
00118   BdbTime            _endTime;
00119 
00120 };
00121 #endif
00122 
00123 
00124 
00125 
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 
00162 
00163 
00164 
00165 
00166 
00167 
00168 
00169 
00170 
00171 
00172 
00173 
00174 
00175 
00176 
00177 
00178 
00179 
00180 
00181 
00182 
00183 
00184 
00185 
00186 
00187 
00188 
00189 
00190 
00191 
00192 
00193 
00194 
00195 
00196 
00197 
00198 
00199 
00200 
00201 
00202 
00203 
00204 
00205 
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218 
00219 
00220 
00221 
00222 
00223 
00224 
00225 
00226 
00227 
00228 
00229 
00230 
00231 
00232 
00233 
00234 
00235 
00236 
00237 
00238 
00239 
00240 
00241 
00242 
00243 
00244 
00245 
00246 
00247 
00248 
00249 
00250 
00251 
00252 
00253 
00254 
00255 
00256 
00257 
00258 
00259 
00260 
00261 

 


BaBar Public Site | SLAC | News | Links | Who's Who | Contact Us

Page Owner: Jacek Becla
Last Update: October 04, 2002