ROOT logo
#ifndef __TMrbLofData_h__
#define __TMrbLofData_h__

//_________________________________________________[C++ CLASS DEFINITION FILE]
//////////////////////////////////////////////////////////////////////////////
// Name:           utils/inc/TMrbLofData.h
// Purpose:        Define utilities to be used with MARaBOU
// Class:          TMrbLofData    -- a list of (structured) data
// Description:    Common class definitions to be used within MARaBOU
// Author:         R. Lutter
// Revision:       $Id: TMrbLofData.h,v 1.6 2006-01-25 12:21:27 Rudolf.Lutter Exp $       
// Date:           
// Keywords:
//////////////////////////////////////////////////////////////////////////////

#include "Rtypes.h"
#include "TString.h"
#include "TSystem.h"
#include "TNamed.h"

//______________________________________________________[C++ CLASS DEFINITION]
//////////////////////////////////////////////////////////////////////////////
// Name:           TMrbLofData
// Purpose:        Define a list of data
// Description:    Class to manage a list of structured data.
// Keywords:
//////////////////////////////////////////////////////////////////////////////

class TMrbLofData: public TNamed {

	public:
		TMrbLofData() {};													 	// default ctor
		TMrbLofData(const Char_t * Name, Int_t NofEntries, Int_t EntrySize); 	// ctor

		~TMrbLofData() { if (fData) delete [] fData; };							// dtor: delete data area

		Bool_t Reset(Bool_t ClearFlag = kFALSE);	// reset index (& clear data)
		Bool_t Fill(Int_t Index = -1, const Char_t Data = 0);	// fill entry
				
		Char_t * At(Int_t Index) const;		// return pointer to data item at given index
		Char_t * Next(Bool_t ClearFlag = kFALSE);		// return pointer to next item

		void Clear(const Option_t * Option) { TObject::Clear(Option); };
		Bool_t Clear(Int_t Index = -1); 	// clear data at given index
		Bool_t Clear(Char_t * Address); 	// clear data given by addr

		Char_t * FindEmpty(Char_t * After = NULL) const;		// find next empty slot
		Char_t * FindNonEmpty(Char_t * After = NULL) const; 	// find next active slot
				
		Int_t GetIndex(Char_t * Addr) const;					// calculate entry index from address
		
		virtual Bool_t IsEmpty(Char_t * Addr) const;			// check if slot is empty
		virtual Bool_t IsEmpty(Int_t Index) const;

		void Print(Option_t * Option) const { TObject::Print(Option); }
		void Print(ostream & Out, Char_t * Addr = NULL, Bool_t NonEmpty = kFALSE) const;			// print data
		void Print(ostream & Out, Int_t Index, Bool_t NonEmpty = kFALSE) const;
		inline void Print(Char_t * Addr = NULL, Bool_t NonEmpty = kFALSE) const { Print(cout, Addr, NonEmpty); };
		inline void Print(Int_t Index, Bool_t NonEmpty = kFALSE) const { Print(cout, Index, NonEmpty); };
		
		inline Int_t GetNofEntries() const { return(fNofEntries); };	// get number of entries
		inline Int_t GetEntrySize() const { return(fEntrySize); };	// get entry size
				
		inline void Help() { gSystem->Exec(Form("mrbHelp %s", this->ClassName())); };

	protected:
			
		Int_t fNofEntries;				// number of entries
		Int_t fEntrySize;				// entry size in bytes
		Char_t * fData; 				//! address of data

		Int_t fCurIndex;				// current index
		
	ClassDef(TMrbLofData, 1)			// [Utils] A list of structured data
};

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