XrdSutBuckList.hh

Go to the documentation of this file.
00001 // $Id: XrdSutBuckList.hh 22437 2008-03-04 14:35:16Z rdm $
00002 #ifndef __SUT_BUCKLIST_H__
00003 #define __SUT_BUCKLIST_H__
00004 /******************************************************************************/
00005 /*                                                                            */
00006 /*                    X r d S u t B u c k L i s t . h h                       */
00007 /*                                                                            */
00008 /* (c) 2004 by the Board of Trustees of the Leland Stanford, Jr., University  */
00009 /*       All Rights Reserved. See XrdInfo.cc for complete License Terms       */
00010 /*   Produced by Andrew Hanushevsky for Stanford University under contract    */
00011 /*              DE-AC03-76-SFO0515 with the Department of Energy              */
00012 /******************************************************************************/
00013 
00014 #ifndef __SUT_BUCKET_H__
00015 #include <XrdSut/XrdSutBucket.hh>
00016 #endif
00017 
00018 /******************************************************************************/
00019 /*                                                                            */
00020 /*  Light single-linked list for managing buckets inside the exchanged        */
00021 /*  buffer                                                                    */
00022 /*                                                                            */
00023 /******************************************************************************/
00024 
00025 //
00026 // Node definition
00027 //
00028 class XrdSutBuckListNode {
00029 private:
00030    XrdSutBucket       *buck;
00031    XrdSutBuckListNode *next;
00032 public:
00033    XrdSutBuckListNode(XrdSutBucket *b = 0, XrdSutBuckListNode *n = 0)
00034         { buck = b; next = n;}
00035    virtual ~XrdSutBuckListNode() { }
00036    
00037    XrdSutBucket       *Buck() const { return buck; }
00038 
00039    XrdSutBuckListNode *Next() const { return next; }
00040 
00041    void SetNext(XrdSutBuckListNode *n) { next = n; }
00042 };
00043 
00044 class XrdSutBuckList {
00045 
00046 private:
00047    XrdSutBuckListNode *begin;
00048    XrdSutBuckListNode *current;
00049    XrdSutBuckListNode *end;
00050    XrdSutBuckListNode *previous;
00051    int                 size;
00052 
00053    XrdSutBuckListNode *Find(XrdSutBucket *b);
00054 
00055 public:
00056    XrdSutBuckList(XrdSutBucket *b = 0);
00057    virtual ~XrdSutBuckList();
00058 
00059    // Access information
00060    int                 Size() const { return size; }
00061    XrdSutBucket       *End() const { return end->Buck(); }
00062 
00063    // Modifiers
00064    void                PutInFront(XrdSutBucket *b);
00065    void                PushBack(XrdSutBucket *b);
00066    void                Remove(XrdSutBucket *b);
00067    
00068    // Pseudo - iterator functionality
00069    XrdSutBucket       *Begin();
00070    XrdSutBucket       *Next();
00071 };
00072 
00073 #endif
00074 

Generated on Tue Jul 5 14:47:02 2011 for ROOT_528-00b_version by  doxygen 1.5.1