Logo ROOT  
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
34class XpdObjectQ;
36class XrdScheduler;
37
38class XpdObject {
39public:
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
54private:
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
67class XrdOucTrace;
68
69class XpdObjectQ : public XrdJob {
70public:
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
85private:
86
89 int fCount;
93 time_t fMaxage;
94 XrdOucTrace *fTrace;
95 XrdScheduler *fSched;
97 const char *fTraceID;
98};
99
100#endif
XFontStruct * id
Definition: TGX11.cxx:109
#define XrdSysMutex
Definition: XrdSysToOuc.h:16
int fMininQ
Definition: XpdObject.h:91
int fTraceON
Definition: XpdObject.h:96
~XpdObjectQ()
Definition: XpdObject.h:83
XrdOucTrace * fTrace
Definition: XpdObject.h:94
XrdSysMutex fQMutex
Definition: XpdObject.h:87
const char * fTraceID
Definition: XpdObject.h:97
void Set(int inQMax, time_t agemax=1800)
Lock the data area and set the values.
Definition: XpdObject.cxx:64
int fCount
Definition: XpdObject.h:89
void Set(XrdScheduler *sp, XrdOucTrace *tp, int traceChk=0)
Definition: XpdObject.h:75
XpdObjectQ(const char *id, const char *desc)
Definition: XpdObject.h:79
XrdScheduler * fSched
Definition: XpdObject.h:95
time_t fMaxage
Definition: XpdObject.h:93
void Push(XpdObject *Node)
Push back a protocol.
Definition: XpdObject.cxx:47
int fMaxinQ
Definition: XpdObject.h:92
XpdObject * fFirst
Definition: XpdObject.h:88
int fCurage
Definition: XpdObject.h:90
XrdProofdProtocol * Pop()
Pop up a protocol object.
Definition: XpdObject.cxx:31
void DoIt()
Process method.
Definition: XpdObject.cxx:79
XrdProofdProtocol * fItem
Definition: XpdObject.h:56
XrdProofdProtocol * objectItem()
Definition: XpdObject.h:43
XpdObject * nextObject()
Definition: XpdObject.h:46
XpdObject * fNext
Definition: XpdObject.h:55
void setItem(XrdProofdProtocol *ival)
Definition: XpdObject.h:49
time_t fQTime
Definition: XpdObject.h:57
~XpdObject()
Definition: XpdObject.h:52
XpdObject(XrdProofdProtocol *ival=0)
Definition: XpdObject.h:51