BRAT 2.4.5
Class index
Full class index
brahmlib
BRAHMS
ROOT page
//____________________________________________________________________
// 
// The BrModuleManager maintains a list of all BrModule , and all BrModuleContainer
// that are defined within a single Brat program. It is implemented as a singleton
// and the entries are filled automaticaly by the contsructor of the
// BrModule or the derived class. The user do not have to do anythinngs. This
// class is ment to be a vehicle to keep track of modules used, give a convenient way
// of printing all relevant versions etc for book keeping, and possible to develop a better
// MainModule in connections with such lists. 
// 

//____________________________________________________________________
//
// $Id: BrModuleManager.cxx,v 1.1.1.1 2001/06/21 14:55:15 hagel Exp $
// $Author: hagel $
// $Date: 2001/06/21 14:55:15 $
// $Copyright: (C) 2001 BRAHMS Collaboration <brahmlib@rhic.bnl.gov>
//
#ifndef BRAT_BrModuleManager
#include "BrModuleManager.h"
#endif
#ifndef ROOT_TDirectory
#include "TDirectory.h"
#endif
#ifndef ROOT_TString
#include "TString.h"
#endif
#ifndef BRAT_BrModuleContainer
#include "BrModuleContainer.h"
#endif
#ifndef BRAT_BrModule
#include "BrModule.h"
#endif


#include <iostream.h>
#include <iomanip.h>




//____________________________________________________________________
ClassImp(BrModuleManager);


//____________________________________________________________________
BrModuleManager* BrModuleManager::fgInstance = 0;
//____________________________________________________________________
 BrModuleManager::BrModuleManager()
{
  // Default constructor

  fModuleList = new TObjArray();
  fModuleContainerList = new TObjArray();
}

//____________________________________________________________________
 BrModuleManager::~BrModuleManager()
{
  // Default desctructor
  delete fModuleList;
  delete fModuleContainerList;
}

//____________________________________________________________________
 BrModuleManager* BrModuleManager::Instance(){
  // Instanciate singleton if not here.
  //
  if(!fgInstance){
    fgInstance = new BrModuleManager();
  }
  return  fgInstance;
}

//____________________________________________________________________
 void BrModuleManager::AddModule(BrModule* module){
  //
  // Add a module to the list
  //
  fModuleList->Add(module);
}

//____________________________________________________________________
 void BrModuleManager::AddModuleContainer(BrModuleContainer* module){
  //
  // Add a module to the list
  //
  fModuleContainerList->Add(module);
}


//_________________________________________________________________
 void BrModuleManager::Print(Option_t* option) const
{
  // Information module. In the final implementation this MUST be
  // overwritten by the derived class. Here a default behaviour is
  // implemented. 
  //  
  // Options: 
  //     D             show all the details
  //     B             show basic information (default)
  // 
  TString opt(option);
  opt.ToLower();
  if (opt.Contains("b")) {
    cout << "*************************************************" << endl;
    TIter next(fModuleList);
    TObject* o = 0;
    while ((o = next())) 
      o->Print("B");
    
    cout << "*************************************************" << endl;
  }  

  if (opt.Contains("d")) {
    cout << "  Module Details:      " << endl;
    cout << endl;
    TIter next(fModuleList);
    TObject* o = 0;
    while ((o = next())) 
      o->Print("D");
  }    
  cout << "-------------------------------------------------" << endl; 
  
}
//____________________________________________________________________
//
// $Log: BrModuleManager.cxx,v $
// Revision 1.1.1.1  2001/06/21 14:55:15  hagel
// Initial revision of brat2
//
// Revision 1.1  2001/06/16 17:40:47  videbaek
// Added a ModuleManager. This class will contain a complete list
// of all module constructed in a session, and may be useful to
// keep track of parameters etc.
// The usage is complete transparent. If one has no intention of
// using it all activity is in the constructor of any BrModule, that is it.
// At present the manager only has one useful method Print that in turns
// call the Print method for all Modules.
//
//

This page automatically generated by script docBrat by Christian Holm

Copyright ; 2002 BRAHMS Collaboration <brahmlib@rcf.rhic.bnl.gov>
Last Update on by

Validate HTML
Validate CSS