// $Id: BrDataObject.cxx,v 1.7 1998/08/20 14:11:52 hagel Exp $
//
// $Log: BrDataObject.cxx,v $
// Revision 1.7  1998/08/20 14:11:52  hagel
// Add Copy method
//
// Revision 1.6  1998/08/17 16:36:40  hagel
// Make BrDataObject inherit from TObject instead of TNamed
// Include fName and fTitle data members
// Include SetName, GetName, SetTitle, GetTitle methods
// All this done because TTree seems to have problems with TString that is
// used for fName and fTitle in TNamed.
//
// Revision 1.5  1998/08/14 21:26:24  videbaek
// Some cleanup mods
//
// Revision 1.4  1998/08/13 22:20:46  hagel
// Eliminate fCreationID for the moment
//
// Revision 1.3  1998/04/06 21:11:50  videbaek
// Clean up and additions for Win95
//
//
#include "BrDataObject.h"


ClassImp(BrDataObject)

///////////////////////////////////////////////////////////////////////
//                                                                   //
// BrDataObject is the base class for all BRAHMS classes             //
// containing data, either as raw data from the DAQ or               //
// calibrated data from the calibration procedures or the            //
// results from the reconstruction or analysis processors.           //
//                                                                   //
// The main purpose of the BrDataObject class is to provide          //
// a uniform interface for bookkeeping, information exchange         //
// between procedural classes and persistent I/O                     //
//                                                                   //
// The individual data objects referring to one event are            //
// kept with the BrEvent object, where they are stored in            //
// a hash table using a unique name for retrieval.                   //
//                                                                   //
///////////////////////////////////////////////////////////////////////

  BrDataObject::BrDataObject()
{
// Default constructor. Does nothing.
// Don't use this constructor unless you have to and know
// what you are doing
// Use BrDataObject(Char_t *name) instead.
  fIsPersistent = kTRUE;
#ifdef _use_creation_id  
  fCreationID   = NULL;
#endif
}

  BrDataObject::BrDataObject(Char_t *Name, Char_t *Title)
{
  // Constructor. Create the data container setting the name
  // (and title, if supplied)
  //
  
  SetName(Name);
  if(Title)
    SetTitle(Title);
  else
    SetTitle(Name);
  
  fIsPersistent = kTRUE;
#ifdef _use_creation_id
  fCreationID = NULL;
#endif
}

 BrDataObject::~BrDataObject()
{
  // Destructor. Delete BrDataObject and all the data objects
  // currently owned by BrDataObject
#ifdef _use_creation_id  
  if(fCreationID)
    delete fCreationID;
#endif
}

 void BrDataObject::SetCreationID(TObject *Creator)
{
  // Store the details on when, by which calling class and by
  // which user the data object was added to the event.
  
//fCreationID = new BrCreationID(Creator);
#ifdef _use_creation_id    
  fCreationID = new BrCreationID(Creator);
#endif  
}

 void BrDataObject::SetName(const Text_t *name) {
//Set Name of object.  
//This object does not inherit from TNamed as originally because ROOT crashes 
//when a BrDataObject is used in the top level of a Tree with split=1
//Problem was traced back to TString not writing or reading (or both) correctly.  We
//therefore inherit from TObject and set our own name as a character variable.
if(strlen(name)>64) strncpy(fName,name,64);
else strcpy(fName,name);
}

 void BrDataObject::SetTitle(const Text_t *title) {
//Set Title of object.  
//This object does not inherit from TNamed as originally because ROOT crashes 
//when a BrDataObject is used in the top level of a Tree with split=1
//Problem was traced back to TString not writing or reading (or both) correctly.  We
//therefore inherit from TObject and set our own title as a character variable.
if(strlen(title)>64) strncpy(fTitle,title,64);
else strcpy(fTitle,title);
}

 void BrDataObject::Copy(BrDataObject &dataobject) {
//Copy method.  Copy All elements of object from argument; also involk copy method
//of object we inherit from.
TObject::Copy(dataobject);
dataobject.fIsPersistent = fIsPersistent;
dataobject.SetName(fName);
dataobject.SetTitle(fTitle);

/*
fIsPersistent = dataobject.IsPersistent();
strcpy(fName,dataobject.GetName());
strcpy(fTitle,dataobject.GetTitle());
*/
}


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.