ROOT logo
// @(#)root/tree:$Id: TQueryResult.h 25716 2008-10-07 09:10:47Z rdm $
// Author: G Ganis Sep 2005

/*************************************************************************
 * Copyright (C) 1995-2005, 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_TQueryResult
#define ROOT_TQueryResult


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TQueryResult                                                         //
//                                                                      //
// A container class for the results of a query.                        //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef ROOT_TNamed
#include "TNamed.h"
#endif
#ifndef ROOT_TDatime
#include "TDatime.h"
#endif
#ifndef ROOT_TMacro
#include "TMacro.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif

class TBrowser;
class TTreePlayer;
class TQueryResult;

Bool_t operator==(const TQueryResult &qr1, const TQueryResult &qr2);


class TQueryResult : public TNamed {

friend class TTreePlayer;
friend class TProofPlayerLite;
friend class TProofPlayerRemote;
friend class TProof;
friend class TProofLite;
friend class TProofServ;
friend class TQueryResultManager;

public:
   enum EQueryStatus {
      kAborted = 0, kSubmitted, kRunning, kStopped, kCompleted
   };

protected:
   Int_t           fSeqNum;       //query unique sequential number
   Bool_t          fDraw;         //true if draw action query
   EQueryStatus    fStatus;       //query status
   TDatime         fStart;        //time when processing started
   TDatime         fEnd;          //time when processing ended
   Float_t         fUsedCPU;      //real CPU time used (seconds)
   TString         fOptions;      //processing options + aclic mode (<opt>#<aclic_mode>)
   TList          *fInputList;    //input list; contains also data sets, entry list, ...
   Long64_t        fEntries;      //number of entries processed
   Long64_t        fFirst;        //first entry processed
   Long64_t        fBytes;        //number of bytes processed
   TMacro         *fLogFile;      //file with log messages from the query
   TMacro         *fSelecHdr;     //selector header file
   TMacro         *fSelecImp;     //selector implementation file
   TString         fLibList;      //blank-separated list of libs loaded at fStart
   TString         fParList;      //colon-separated list of PAR loaded at fStart
   TList          *fOutputList;   //output list
   Bool_t          fFinalized;    //whether Terminate has been run
   Bool_t          fArchived;     //whether the query has been archived
   TString         fResultFile;   //URL of the file where results have been archived
   Float_t         fInitTime;     //Initialization time (seconds) (millisec precision)
   Float_t         fProcTime;     //Processing time (seconds) (millisec precision)

   TQueryResult(Int_t seqnum, const char *opt, TList *inlist,
                Long64_t entries, Long64_t first,
                const char *selec);

   void            AddInput(TObject *obj);
   void            AddLogLine(const char *logline);
   TQueryResult   *CloneInfo();
   virtual void    RecordEnd(EQueryStatus status, TList *outlist = 0);
   void            SaveSelector(const char *selec);
   void            SetArchived(const char *archfile);
   virtual void    SetFinalized() { fFinalized = kTRUE; }
   virtual void    SetInputList(TList *in, Bool_t adopt = kTRUE);
   virtual void    SetOutputList(TList *out, Bool_t adopt = kTRUE);
   virtual void    SetProcessInfo(Long64_t ent, Float_t cpu = 0.,
                                  Long64_t siz = -1,
                                  Float_t inittime = 0., Float_t proctime = 0.);

public:
   TQueryResult() : fSeqNum(-1), fDraw(0), fStatus(kSubmitted), fUsedCPU(0.),
                    fInputList(0), fEntries(-1), fFirst(-1), fBytes(0),
                    fLogFile(0), fSelecHdr(0), fSelecImp(0),
                    fLibList("-"), fOutputList(0),
                    fFinalized(kFALSE), fArchived(kFALSE),
                    fInitTime(0.), fProcTime(0.) { }
   virtual ~TQueryResult();

   void           Browse(TBrowser *b = 0);

   Int_t          GetSeqNum() const { return fSeqNum; }
   EQueryStatus   GetStatus() const { return fStatus; }
   TDatime        GetStartTime() const { return fStart; }
   TDatime        GetEndTime() const { return fEnd; }
   const char    *GetOptions() const { return fOptions; }
   TList         *GetInputList() { return fInputList; }
   TObject       *GetInputObject(const char *classname) const;
   Long64_t       GetEntries() const { return fEntries; }
   Long64_t       GetFirst() const { return fFirst; }
   Long64_t       GetBytes() const { return fBytes; }
   Float_t        GetUsedCPU() const { return fUsedCPU; }
   TMacro        *GetLogFile() const { return fLogFile; }
   TMacro        *GetSelecHdr() const { return fSelecHdr; }
   TMacro        *GetSelecImp() const { return fSelecImp; }
   const char    *GetLibList() const { return fLibList; }
   const char    *GetParList() const { return fParList; }
   TList         *GetOutputList() { return fOutputList; }
   const char    *GetResultFile() const { return fResultFile; }
   Float_t        GetInitTime() const { return fInitTime; }
   Float_t        GetProcTime() const { return fProcTime; }

   Bool_t         IsArchived() const { return fArchived; }
   virtual Bool_t IsDone() const { return (fStatus > kRunning); }
   Bool_t         IsDraw() const { return fDraw; }
   Bool_t         IsFinalized() const { return fFinalized; }

   Bool_t         Matches(const char *ref);

   void Print(Option_t *opt = "") const;

   ClassDef(TQueryResult,3)  //Class describing a query
};

inline Bool_t operator!=(const TQueryResult &qr1,  const TQueryResult &qr2)
   { return !(qr1 == qr2); }

#endif
 TQueryResult.h:1
 TQueryResult.h:2
 TQueryResult.h:3
 TQueryResult.h:4
 TQueryResult.h:5
 TQueryResult.h:6
 TQueryResult.h:7
 TQueryResult.h:8
 TQueryResult.h:9
 TQueryResult.h:10
 TQueryResult.h:11
 TQueryResult.h:12
 TQueryResult.h:13
 TQueryResult.h:14
 TQueryResult.h:15
 TQueryResult.h:16
 TQueryResult.h:17
 TQueryResult.h:18
 TQueryResult.h:19
 TQueryResult.h:20
 TQueryResult.h:21
 TQueryResult.h:22
 TQueryResult.h:23
 TQueryResult.h:24
 TQueryResult.h:25
 TQueryResult.h:26
 TQueryResult.h:27
 TQueryResult.h:28
 TQueryResult.h:29
 TQueryResult.h:30
 TQueryResult.h:31
 TQueryResult.h:32
 TQueryResult.h:33
 TQueryResult.h:34
 TQueryResult.h:35
 TQueryResult.h:36
 TQueryResult.h:37
 TQueryResult.h:38
 TQueryResult.h:39
 TQueryResult.h:40
 TQueryResult.h:41
 TQueryResult.h:42
 TQueryResult.h:43
 TQueryResult.h:44
 TQueryResult.h:45
 TQueryResult.h:46
 TQueryResult.h:47
 TQueryResult.h:48
 TQueryResult.h:49
 TQueryResult.h:50
 TQueryResult.h:51
 TQueryResult.h:52
 TQueryResult.h:53
 TQueryResult.h:54
 TQueryResult.h:55
 TQueryResult.h:56
 TQueryResult.h:57
 TQueryResult.h:58
 TQueryResult.h:59
 TQueryResult.h:60
 TQueryResult.h:61
 TQueryResult.h:62
 TQueryResult.h:63
 TQueryResult.h:64
 TQueryResult.h:65
 TQueryResult.h:66
 TQueryResult.h:67
 TQueryResult.h:68
 TQueryResult.h:69
 TQueryResult.h:70
 TQueryResult.h:71
 TQueryResult.h:72
 TQueryResult.h:73
 TQueryResult.h:74
 TQueryResult.h:75
 TQueryResult.h:76
 TQueryResult.h:77
 TQueryResult.h:78
 TQueryResult.h:79
 TQueryResult.h:80
 TQueryResult.h:81
 TQueryResult.h:82
 TQueryResult.h:83
 TQueryResult.h:84
 TQueryResult.h:85
 TQueryResult.h:86
 TQueryResult.h:87
 TQueryResult.h:88
 TQueryResult.h:89
 TQueryResult.h:90
 TQueryResult.h:91
 TQueryResult.h:92
 TQueryResult.h:93
 TQueryResult.h:94
 TQueryResult.h:95
 TQueryResult.h:96
 TQueryResult.h:97
 TQueryResult.h:98
 TQueryResult.h:99
 TQueryResult.h:100
 TQueryResult.h:101
 TQueryResult.h:102
 TQueryResult.h:103
 TQueryResult.h:104
 TQueryResult.h:105
 TQueryResult.h:106
 TQueryResult.h:107
 TQueryResult.h:108
 TQueryResult.h:109
 TQueryResult.h:110
 TQueryResult.h:111
 TQueryResult.h:112
 TQueryResult.h:113
 TQueryResult.h:114
 TQueryResult.h:115
 TQueryResult.h:116
 TQueryResult.h:117
 TQueryResult.h:118
 TQueryResult.h:119
 TQueryResult.h:120
 TQueryResult.h:121
 TQueryResult.h:122
 TQueryResult.h:123
 TQueryResult.h:124
 TQueryResult.h:125
 TQueryResult.h:126
 TQueryResult.h:127
 TQueryResult.h:128
 TQueryResult.h:129
 TQueryResult.h:130
 TQueryResult.h:131
 TQueryResult.h:132
 TQueryResult.h:133
 TQueryResult.h:134
 TQueryResult.h:135
 TQueryResult.h:136
 TQueryResult.h:137
 TQueryResult.h:138
 TQueryResult.h:139
 TQueryResult.h:140
 TQueryResult.h:141
 TQueryResult.h:142
 TQueryResult.h:143
 TQueryResult.h:144
 TQueryResult.h:145
 TQueryResult.h:146
 TQueryResult.h:147