// @(#)root/treeplayer:$Id$
// Author: Philippe Canal   20/03/02

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

#ifndef ROOT_TTreeFormulaManager
#define ROOT_TTreeFormulaManager


//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TTreeFormulaManager                                                  //
//                                                                      //
// A class coordinating several TTreeFormula objects.                   //
//                                                                      //
//////////////////////////////////////////////////////////////////////////


#ifndef ROOT_TObjArray
#include "TObjArray.h"
#endif

#include "TTreeFormula.h"

class TArrayI;


class TTreeFormulaManager : public TObject {
private:
   TObjArray   fFormulas;
   Int_t       fMultiplicity;     // Indicator of the variability of the formula
   Bool_t      fMultiVarDim;      // True if one of the variable has 2 variable size dimensions.
   Int_t       fNdata;            //! Last value calculated by GetNdata

   //the next line should be: mutable Int_t fCumulUsedSizes[kMAXFORMDIM+1]; See GetNdata()
   Int_t       fCumulUsedSizes[kMAXFORMDIM+1];      //Accumulated size of lower dimensions as seen for this entry
   TArrayI    *fCumulUsedVarDims;                   //fCumulUsedSizes(1) for multi variable dimensions case
   //the next line should be: mutable Int_t fUsedSizes[kMAXFORMDIM+1]; See GetNdata()
   Int_t       fUsedSizes[kMAXFORMDIM+1];           //Actual size of the dimensions as seen for this entry.
   TArrayI    *fVarDims[kMAXFORMDIM+1];             //List of variable sizes dimensions.
   Int_t       fVirtUsedSizes[kMAXFORMDIM+1];       //Virtual size of lower dimensions as seen for this formula

   Bool_t      fNeedSync;         // Indicate whether a new formula has been added since the last synchronization

   friend class TTreeFormula;

private:
   // Not implemented yet
   TTreeFormulaManager(const TTreeFormulaManager&);
   TTreeFormulaManager& operator=(const TTreeFormulaManager&);

#if !defined(_MSC_VER) || (_MSC_VER < 1300) || defined(__CINT__)
   // Deletion is the sole responsability of the TTreeFormulas
   ~TTreeFormulaManager();
#endif

protected:

   virtual void       AddVarDims(Int_t virt_dim);
   virtual void       CancelDimension(Int_t virt_dim);
   virtual void       EnableMultiVarDims();
   virtual void       UpdateUsedSize(Int_t &virt_dim, Int_t vsize);

public:
   TTreeFormulaManager();
#if _MSC_VER >= 1300
   // cannot be private due to a bug in VC++7
   ~TTreeFormulaManager();
#endif

   virtual void       Add(TTreeFormula*);
   virtual Int_t      GetMultiplicity() const {return fMultiplicity;}
   virtual Int_t      GetNdata(Bool_t forceLoadDim = kFALSE);
   virtual Bool_t     Notify() { UpdateFormulaLeaves(); return kTRUE; }
   virtual void       Remove(TTreeFormula*);
   virtual Bool_t     Sync();
   virtual void       UpdateFormulaLeaves();

   ClassDef(TTreeFormulaManager,0) // A class coordinating several TTreeFormula objects.
};


#endif // ROOT_TTreeFormulaManager

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