xrootd
XrdNetBuffer.hh
Go to the documentation of this file.
1 #ifndef __NET_BUFF__
2 #define __NET_BUFF__
3 /******************************************************************************/
4 /* */
5 /* X r d N e t B u f f e r . h h */
6 /* */
7 /* (c) 2003 by the Board of Trustees of the Leland Stanford, Jr., University */
8 /* All Rights Reserved */
9 /* Produced by Andrew Hanushevsky for Stanford University under contract */
10 /* DE-AC03-76-SFO0515 with the Department of Energy */
11 /******************************************************************************/
12 
13 // $Id$
14 
15 #include <stdlib.h>
16 
17 #include "XrdOuc/XrdOucChain.hh"
18 #include "XrdSys/XrdSysPthread.hh"
19 
20 /******************************************************************************/
21 /* X r d N e t B u f f e r Q */
22 /******************************************************************************/
23 
24 class XrdNetBuffer;
25 
27 {
28 public:
29 
31 
32 inline int BuffSize(void) {return size;}
33 
34  void Recycle(XrdNetBuffer *bp);
35 
36  void Set(int maxb);
37 
38  XrdNetBufferQ(int bsz, int maxb=16);
40 
41  int alignit;
44  int maxbuff;
45  int numbuff;
46  int size;
47 };
48 
49 /******************************************************************************/
50 /* X r d N e t B u f f e r */
51 /******************************************************************************/
52 
54 {
55 friend class XrdNetBufferQ;
56 
57 public:
58  char *data;
59  int dlen;
60 
61 inline int BuffSize(void) {return BuffQ->BuffSize();}
62 
63  void Recycle(void) {BuffQ->Recycle(this);}
64 
66  ~XrdNetBuffer() {if (data) free(data);}
67 
68 private:
69 
72 };
73 #endif