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 //         $Id$
00014 
00015 class XrdFrmFileset;
00016 
00017 class XrdFrmTSort
00018 {
00019 public:
00020 
00021 int               Add(XrdFrmFileset *fsp);
00022 
00023 int               Count() {return numEnt;}
00024 
00025 XrdFrmFileset    *Oldest();
00026 
00027 void              Purge();
00028 
00029                   XrdFrmTSort(int szSort=0) : sortSZ(szSort) {Reset();}
00030                  ~XrdFrmTSort() {Purge();}
00031 
00032 private:
00033 int               Bin(XrdFrmFileset *fsp, int j, int Shift);
00034 XrdFrmFileset    *Insert(XrdFrmFileset *newP, XrdFrmFileset *oldP);
00035 void              Reset();
00036 
00037 static const int  SCshift =  0;
00038 static const int  MNshift =  6;
00039 static const int  HRshift = 12;
00040 static const int  tMask = 0x3f;
00041 static const int  dVal  = 24*60*60;
00042 
00043 XrdFrmFileset    *FSTab[4][64];
00044 time_t            baseT;
00045 int               sortSZ;
00046 int               numEnt;
00047 
00048 int               DYent;   // [0,DYent]
00049 int               HRent;   // [1,HRent]
00050 int               MNent;   // [2,MNent]
00051 int               SCent;   // [3,SCent]
00052 };
00053 #endif