|
xrootd
|
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 #include "XProtocol/XPtypes.hh" 00014 #include "XrdSys/XrdSysPthread.hh" 00015 00016 class XrdXrootdFile; 00017 00018 class XrdXrootdPio 00019 { 00020 public: 00021 00022 XrdXrootdPio *Next; 00023 XrdXrootdFile *myFile; 00024 long long myOffset; 00025 int myIOLen; 00026 kXR_char StreamID[2]; 00027 char isWrite; 00028 00029 static XrdXrootdPio *Alloc(int n=1); 00030 00031 inline XrdXrootdPio *Clear(XrdXrootdPio *np=0) 00032 {const kXR_char zed[2] = {0,0}; 00033 Set(0, 0, 0, zed,'\0'); 00034 Next = np; return this; 00035 } 00036 00037 void Recycle(); 00038 00039 inline void Set(XrdXrootdFile *theFile, long long theOffset, 00040 int theIOLen, const kXR_char *theSID, char theW) 00041 {myFile = theFile; 00042 myOffset = theOffset; 00043 myIOLen = theIOLen; 00044 StreamID[0] = theSID[0]; StreamID[1] = theSID[1]; 00045 isWrite = theW; 00046 } 00047 00048 XrdXrootdPio(XrdXrootdPio *np=0) {Clear(np);} 00049 ~XrdXrootdPio() {} 00050 00051 private: 00052 00053 static const int FreeMax = 256; 00054 static XrdSysMutex myMutex; 00055 static XrdXrootdPio *Free; 00056 static int FreeNum; 00057 }; 00058 #endif
1.7.5