// $Id: BrDataTable.cxx,v 1.4 1998/04/06 21:11:50 videbaek Exp $
// $Log: BrDataTable.cxx,v $
// Revision 1.4  1998/04/06 21:11:50  videbaek
// Clean up and additions for Win95
//
// Revision 1.3  1998/03/09 20:53:50  videbaek
// Ensure that pointers are non-NULL before deleting
//
// Revision 1.2  1998/03/06 22:09:58  videbaek
// Working update
//
// Revision 1.1.1.1  1998/03/04 21:32:48  brahmlib
// Brat base
//
//
#include "BrDataTable.h"
#include <iostream.h>

ClassImp(BrDataTable)


///////////////////////////////////////////////////////////////////////
//                                                                   //
// BrDataTable is a BRAHMS data object that has a list of            //
// data objects.  It is meant to be used in grouping like kinds      //
// of information together.  The list is fObjectList which is a      //
// TObjArray.  Several methods manage the fObjectList with the same  //
// names as TObjArray                                                //
//                                                                   //
///////////////////////////////////////////////////////////////////////

  BrDataTable::BrDataTable()
{
// Defaults constructor. Does nothing.
// Don't use this constructor unless you have to and know
// what you are doing
// Use BrDataTable(Char_t *name) instead.

    fObjectList = NULL;
}

  BrDataTable::BrDataTable(Char_t *Name, Char_t *Title) : BrDataObject(Name)
{
// Constructor. Create the data container setting the name
// (and title, if supplied)
   
  if(Title)
    SetTitle(Title);
  fObjectList = new TObjArray();
}

  BrDataTable::~BrDataTable()
{
// Destructor. Delete BrDataTable and all the data objects
// currently owned by BrDataTable
#ifdef _BRDEBUG
cout << "BrDataTable : dtor" << endl;
#endif
 if(fObjectList){
  fObjectList->Delete();
  delete fObjectList;
 }
}

 void BrDataTable::Add(TObject *object)
{
// Add an object to the object list.  Essentially uses TObjArray::Add(object);
  if(!fObjectList)
    fObjectList = new TObjArray();
  
  fObjectList->Add(object);
}

 void BrDataTable::AddAt(TObject *object,Int_t idx)
{
// Add an object to the object list at a specific index.  Essentially 
// uses TObjArray::AddAt(object,idx);
  if(!fObjectList)
    fObjectList = new TObjArray();
  
  fObjectList->AddAt(object,idx);
}

 void BrDataTable::DeleteAndCompressAt(Int_t i)
{
// Removes an object an object at specified index from the Object List.
// Essentially uses TObjArray::RemoveAt(i);
// After object is removed, it is deleted.
  TObject *obj = fObjectList->At(i);
  fObjectList->RemoveAt(i);
  delete obj;
}

 void BrDataTable::DeleteAndCompress(TObject *obj)
{
// Removes an object from the Object List.  Object is then deleted.
  fObjectList->Remove(obj);
  delete obj;
}


ROOT page - Class index - 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.