// Author: Pierre-Luc Drouin <http://www.pldrouin.net>
// Copyright Carleton University

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// QSigExDirHandler                                                     //
//                                                                      //
// This class is an abstract base class that provides a basic interface //
// for all the classes that need to handle the TDirectory instance in   //
// which QSigEx stores its information. A new handler can be created by //
// deriving a new class from QSigExDirHandler.                          //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifndef _QSIGEXDIRHANDLER_
#define _QSIGEXDIRHANDLER_

#include "Rtypes.h"
#include "TObject.h"
#include "TDirectory.h"
#include "TList.h"
#include "TKey.h"
#include "QDatReader.h"

#include "TROOT.h"
#include "TChain.h"
#include "TEventList.h"
#include "TH1.h"
#include "TH2.h"


//#define DEBUG
//#define DEBUG2

#include "debugger.h"

class QSigExDirHandler: public TObject{
 public:
  QSigExDirHandler():TObject(),fMyDir(NULL),fReader(){PRINTF2(this,"\tQSigExDirHandler::QSigExDirHandler()\n")}

  QSigExDirHandler(const QSigExDirHandler &rhs): TObject(*this),fMyDir(rhs.fMyDir),fReader(rhs.fReader) {PRINTF2(this,"\tQSigExDirHandler::QSigExDirHandler(const QSigExDirHandler &rhs)")}

  virtual ~QSigExDirHandler(){PRINTF2(this,"\t~QSigExDirHandler::QSigExDirHandler()\n")}

  virtual void LoadCardFile(const Char_t* cardfilename=NULL)=0;

  void SetDir(TDirectory* folder)
    {
      PRINTF4(this,"\tQSigExDirHandler::SetDir(TDirectory* folder<",folder,">)\n")
      try{
	if(folder) fMyDir=folder;
	else {cout << "A NULL pointer has been passed\n"; throw 5000;}
      }catch(int e){
	cout << "Exception handled by QSigExDirHandler::SetDir\n";
	throw e;
      }
    }

  TDirectory* GetDir() const
    {
      PRINTF2(this,"\tQSigExDirHandler::GetDir()\n")
      return fMyDir;
    }

  virtual Int_t Get()=0;

  virtual void CleanDir()=0;
  virtual void ClearCardBuf()=0;

 protected:
  virtual void FormatDir()=0;
  void GetObjs(TList* list, TDirectory* dir);
  void GetDirs(TList* list, TDirectory* dir);
  void GetListOfObjsKeys(TList* list, TDirectory* dir);
  Int_t DelObjsKeys(const Char_t* name, TDirectory* dir);
  Bool_t FindObjKey(const Char_t* name, const TDirectory* dir) const;
  TDirectory* CopyDir(TDirectory* fromdir, TDirectory* todir);
  TDirectory* SetDirectory(TDirectory* dir, TObject* obj);

  TDirectory* fMyDir; //Pointer to the TDirectory instance filled by QSigExDirHandler
  QDatReader fReader; //QDatReader instance used to read the card file

  void CheckCardNFields(Int_t nfields, Int_t min, Int_t max=-1);

  ClassDef(QSigExDirHandler,1) //Abstract base class for TDirectory handler classes
};

#include "debugger.h"
#endif







ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.