ROOT  6.06/09
Reference Guide
XpdObject.h
Go to the documentation of this file.
1 // @(#)root/proofd:$Id$
2 // Author: Gerardo Ganis Feb 2013
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 //////////////////////////////////////////////////////////////////////////
13 // //
14 // XpdObject //
15 // //
16 // Authors: G. Ganis, CERN, 2013 //
17 // //
18 // Auxilliary class to stack protocols. //
19 // Adapted version of XrdObject. //
20 // //
21 //////////////////////////////////////////////////////////////////////////
22 
23 #ifndef ROOT_XpdObject
24 #define ROOT_XpdObject
25 
26 #include <string.h>
27 #include <strings.h>
28 #include <time.h>
29 #include <sys/types.h>
30 #include "Xrd/XrdJob.hh"
31 #include "XrdOuc/XrdOucTrace.hh"
32 #include "XrdSys/XrdSysPthread.hh"
33 
34 class XpdObjectQ;
35 class XrdProofdProtocol;
36 class XrdScheduler;
37 
38 class XpdObject {
39 public:
40  friend class XpdObjectQ;
41 
42  // Item() supplies the item value associated with itself (used with Next()).
44 
45  // Next() supplies the next list node.
46  XpdObject *nextObject() { return fNext; }
47 
48  // Set the item pointer
49  void setItem(XrdProofdProtocol *ival) { fItem = ival; }
50 
51  XpdObject(XrdProofdProtocol *ival=0) { fNext = 0; fItem = ival; fQTime = 0; }
53 
54 private:
57  time_t fQTime; // Only used for time-managed objects
58 };
59 
60 /******************************************************************************/
61 /* x r d _ O b j e c t Q */
62 /******************************************************************************/
63 
64 // Note to properly cleanup this type of queue you must call Set() at least
65 // once to cause the time element to be sceduled.
66 
67 class XrdOucTrace;
68 
69 class XpdObjectQ : public XrdJob {
70 public:
71 
73  void Push(XpdObject *Node);
74  void Set(int inQMax, time_t agemax=1800);
75  void Set(XrdScheduler *sp, XrdOucTrace *tp, int traceChk = 0)
76  {fSched = sp; fTrace = tp; fTraceON = traceChk;}
77  void DoIt();
78 
79  XpdObjectQ(const char *id, const char *desc) : XrdJob(desc)
80  {fCurage = fCount = 0; fMaxage = 0; fTraceID = 0; fSched = 0; fTraceID = id;
81  fMaxinQ = 32; fMininQ = 16; fFirst = 0; }
82 
84 
85 private:
86 
89  int fCount;
90  int fCurage;
91  int fMininQ;
92  int fMaxinQ;
93  time_t fMaxage;
94  XrdOucTrace *fTrace;
95  XrdScheduler *fSched;
96  int fTraceON;
97  const char *fTraceID;
98 };
99 
100 #endif
XpdObject(XrdProofdProtocol *ival=0)
Definition: XpdObject.h:51
XrdProofdProtocol * objectItem()
Definition: XpdObject.h:43
int fMininQ
Definition: XpdObject.h:91
void DoIt()
Process method.
Definition: XpdObject.cxx:79
int fTraceON
Definition: XpdObject.h:96
void setItem(XrdProofdProtocol *ival)
Definition: XpdObject.h:49
XrdSysMutex fQMutex
Definition: XpdObject.h:87
XFontStruct * id
Definition: TGX11.cxx:108
XpdObjectQ(const char *id, const char *desc)
Definition: XpdObject.h:79
~XpdObject()
Definition: XpdObject.h:52
time_t fMaxage
Definition: XpdObject.h:93
void Push(XpdObject *Node)
Push back a protocol.
Definition: XpdObject.cxx:47
XrdProofdProtocol * Pop()
Pop up a protocol object.
Definition: XpdObject.cxx:31
#define XrdSysMutex
Definition: XrdSysToOuc.h:16
int fCount
Definition: XpdObject.h:89
XpdObject * fNext
Definition: XpdObject.h:55
void Set(XrdScheduler *sp, XrdOucTrace *tp, int traceChk=0)
Definition: XpdObject.h:75
int fMaxinQ
Definition: XpdObject.h:92
XpdObject * nextObject()
Definition: XpdObject.h:46
int fCurage
Definition: XpdObject.h:90
XrdScheduler * fSched
Definition: XpdObject.h:95
const char * fTraceID
Definition: XpdObject.h:97
XpdObject * fFirst
Definition: XpdObject.h:88
time_t fQTime
Definition: XpdObject.h:57
XrdOucTrace * fTrace
Definition: XpdObject.h:94
void Set(int inQMax, time_t agemax=1800)
Lock the data area and set the values.
Definition: XpdObject.cxx:64
XrdProofdProtocol * fItem
Definition: XpdObject.h:56
~XpdObjectQ()
Definition: XpdObject.h:83