xrootd
XrdFrmTSort.hh
Go to the documentation of this file.
00001 #ifndef __FRMTSORT__
00002 #define __FRMTSORT__
00003 /******************************************************************************/
00004 /*                                                                            */
00005 /*                        X r d F r m T S o r t . h h                         */
00006 /*                                                                            */
00007 /* (c) 2009 by the Board of Trustees of the Leland Stanford, Jr., University  */
00008 /*                            All Rights Reserved                             */
00009 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00010 /*              DE-AC02-76-SFO0515 with the Department of Energy              */
00011 /******************************************************************************/
00012 
00013 class XrdFrmFileset;
00014 
00015 class XrdFrmTSort
00016 {
00017 public:
00018 
00019 int               Add(XrdFrmFileset *fsp);
00020 
00021 int               Count() {return numEnt;}
00022 
00023 XrdFrmFileset    *Oldest();
00024 
00025 void              Purge();
00026 
00027                   XrdFrmTSort(int szSort=0) : sortSZ(szSort) {Reset();}
00028                  ~XrdFrmTSort() {Purge();}
00029 
00030 private:
00031 int               Bin(XrdFrmFileset *fsp, int j, int Shift);
00032 XrdFrmFileset    *Insert(XrdFrmFileset *newP, XrdFrmFileset *oldP);
00033 void              Reset();
00034 
00035 static const int  SCshift =  0;
00036 static const int  MNshift =  6;
00037 static const int  HRshift = 12;
00038 static const int  tMask = 0x3f;
00039 static const int  dVal  = 24*60*60;
00040 
00041 XrdFrmFileset    *FSTab[4][64];
00042 time_t            baseT;
00043 int               sortSZ;
00044 int               numEnt;
00045 
00046 int               DYent;   // [0,DYent]
00047 int               HRent;   // [1,HRent]
00048 int               MNent;   // [2,MNent]
00049 int               SCent;   // [3,SCent]
00050 };
00051 #endif