ROOT logo
// $Id$
// Author: G. Ganis  Jan 2010

/*************************************************************************
 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TPacketizerMulti
#define ROOT_TPacketizerMulti

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TPacketizerMulti                                                     //
//                                                                      //
// This class allows to do multiple runs in the same query; each run    //
// can be a, for example, different dataset or the same dataset with    //
// entry list.                                                          //
// The multiple packetizer conatins a list of packetizers which are     //
// processed in turn.                                                   //
// The bit TSelector::kNewRun is set in the TSelector object when a new //
// packetizer is used.                                                  //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TVirtualPacketizer
#include "TVirtualPacketizer.h"
#endif


class TIter;
class TList;
class TMap;
class TMessage;
class TProofProgressStatus;
class TSlave;

class TPacketizerMulti : public TVirtualPacketizer {

private:
   TList              *fPacketizers;     // Packetizers to be processed
   TIter              *fPacketizersIter; // Iterator on fPacketizers
   TVirtualPacketizer *fCurrent;         // Packetizer being currently processed
   TMap               *fAssignedPack;    // Map {worker,packetizer} of lat assignement

   TPacketizerMulti();
   TPacketizerMulti(const TPacketizerMulti&);     // no implementation, will generate
   void operator=(const TPacketizerMulti&);  // error on accidental usage

   TVirtualPacketizer *CreatePacketizer(TDSet *dset, TList *wrks, Long64_t first, Long64_t num,
                                        TList *input, TProofProgressStatus *st);

public:
   TPacketizerMulti(TDSet *dset, TList *slaves, Long64_t first, Long64_t num,
                    TList *input, TProofProgressStatus *st);
   virtual ~TPacketizerMulti();

   TDSetElement *GetNextPacket(TSlave *wrk, TMessage *r);

   Int_t    GetEstEntriesProcessed(Float_t f, Long64_t &ent, Long64_t &bytes, Long64_t &calls)
                    { if (fCurrent) return fCurrent->GetEstEntriesProcessed(f,ent,bytes,calls);
                      return 1; }
   Float_t  GetCurrentRate(Bool_t &all) { all = kTRUE;
                                          return (fCurrent? fCurrent->GetCurrentRate(all) : 0.); }
   void     StopProcess(Bool_t abort, Bool_t stoptimer = kFALSE) {
                                        if (fCurrent) fCurrent->StopProcess(abort, stoptimer);
                                        TVirtualPacketizer::StopProcess(abort, stoptimer); }
   void     MarkBad(TSlave *wrk, TProofProgressStatus *st, TList **missing)
                    { if (fCurrent) fCurrent->MarkBad(wrk, st, missing); return; }
   Int_t    AddProcessed(TSlave *wrk, TProofProgressStatus *st, Double_t lat, TList **missing)
                    { if (fCurrent) return fCurrent->AddProcessed(wrk, st, lat, missing);
                      return -1; }

   Int_t    GetActiveWorkers() { if (fCurrent) return fCurrent->GetActiveWorkers(); return 0; }

   ClassDef(TPacketizerMulti,0)  //Generate work packets for parallel processing
};

#endif
 TPacketizerMulti.h:1
 TPacketizerMulti.h:2
 TPacketizerMulti.h:3
 TPacketizerMulti.h:4
 TPacketizerMulti.h:5
 TPacketizerMulti.h:6
 TPacketizerMulti.h:7
 TPacketizerMulti.h:8
 TPacketizerMulti.h:9
 TPacketizerMulti.h:10
 TPacketizerMulti.h:11
 TPacketizerMulti.h:12
 TPacketizerMulti.h:13
 TPacketizerMulti.h:14
 TPacketizerMulti.h:15
 TPacketizerMulti.h:16
 TPacketizerMulti.h:17
 TPacketizerMulti.h:18
 TPacketizerMulti.h:19
 TPacketizerMulti.h:20
 TPacketizerMulti.h:21
 TPacketizerMulti.h:22
 TPacketizerMulti.h:23
 TPacketizerMulti.h:24
 TPacketizerMulti.h:25
 TPacketizerMulti.h:26
 TPacketizerMulti.h:27
 TPacketizerMulti.h:28
 TPacketizerMulti.h:29
 TPacketizerMulti.h:30
 TPacketizerMulti.h:31
 TPacketizerMulti.h:32
 TPacketizerMulti.h:33
 TPacketizerMulti.h:34
 TPacketizerMulti.h:35
 TPacketizerMulti.h:36
 TPacketizerMulti.h:37
 TPacketizerMulti.h:38
 TPacketizerMulti.h:39
 TPacketizerMulti.h:40
 TPacketizerMulti.h:41
 TPacketizerMulti.h:42
 TPacketizerMulti.h:43
 TPacketizerMulti.h:44
 TPacketizerMulti.h:45
 TPacketizerMulti.h:46
 TPacketizerMulti.h:47
 TPacketizerMulti.h:48
 TPacketizerMulti.h:49
 TPacketizerMulti.h:50
 TPacketizerMulti.h:51
 TPacketizerMulti.h:52
 TPacketizerMulti.h:53
 TPacketizerMulti.h:54
 TPacketizerMulti.h:55
 TPacketizerMulti.h:56
 TPacketizerMulti.h:57
 TPacketizerMulti.h:58
 TPacketizerMulti.h:59
 TPacketizerMulti.h:60
 TPacketizerMulti.h:61
 TPacketizerMulti.h:62
 TPacketizerMulti.h:63
 TPacketizerMulti.h:64
 TPacketizerMulti.h:65
 TPacketizerMulti.h:66
 TPacketizerMulti.h:67
 TPacketizerMulti.h:68
 TPacketizerMulti.h:69
 TPacketizerMulti.h:70
 TPacketizerMulti.h:71
 TPacketizerMulti.h:72
 TPacketizerMulti.h:73
 TPacketizerMulti.h:74
 TPacketizerMulti.h:75
 TPacketizerMulti.h:76
 TPacketizerMulti.h:77
 TPacketizerMulti.h:78
 TPacketizerMulti.h:79
 TPacketizerMulti.h:80
 TPacketizerMulti.h:81
 TPacketizerMulti.h:82