00001 #ifndef __XRDXROOTDPIO__ 00002 #define __XRDXROOTDPIO__ 00003 /******************************************************************************/ 00004 /* */ 00005 /* X r d X r o o t d P i o . h h */ 00006 /* */ 00007 /* (c) 2007 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: XrdXrootdPio.hh 22437 2008-03-04 14:35:16Z rdm $ 00014 00015 #include "XProtocol/XPtypes.hh" 00016 #include "XrdSys/XrdSysPthread.hh" 00017 00018 class XrdXrootdFile; 00019 00020 class XrdXrootdPio 00021 { 00022 public: 00023 00024 XrdXrootdPio *Next; 00025 XrdXrootdFile *myFile; 00026 long long myOffset; 00027 int myIOLen; 00028 kXR_char StreamID[2]; 00029 char isWrite; 00030 00031 static XrdXrootdPio *Alloc(int n=1); 00032 00033 inline XrdXrootdPio *Clear(XrdXrootdPio *np=0) 00034 {static const kXR_char zed[2] = {0,0}; 00035 Set(0, 0, 0, zed,'\0'); 00036 Next = np; return this; 00037 } 00038 00039 void Recycle(); 00040 00041 inline void Set(XrdXrootdFile *theFile, long long theOffset, 00042 int theIOLen, const kXR_char *theSID, char theW) 00043 {myFile = theFile; 00044 myOffset = theOffset; 00045 myIOLen = theIOLen; 00046 StreamID[0] = theSID[0]; StreamID[1] = theSID[1]; 00047 isWrite = theW; 00048 } 00049 00050 XrdXrootdPio(XrdXrootdPio *np=0) {Clear(np);} 00051 ~XrdXrootdPio() {} 00052 00053 private: 00054 00055 static const int FreeMax = 256; 00056 static XrdSysMutex myMutex; 00057 static XrdXrootdPio *Free; 00058 static int FreeNum; 00059 }; 00060 #endif