#ifndef __TMrbNamedX_h__
#define __TMrbNamedX_h__
namespace std {} using namespace std;
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include "Rtypes.h"
#include "TObject.h"
#include "TNamed.h"
#include "TSystem.h"
#include "TString.h"
struct sMrbNamedX {
Int_t Index;
Char_t * ShortName;
Char_t * LongName;
};
typedef struct sMrbNamedX SMrbNamedX;
struct sMrbNamedXShort {
Int_t Index;
const Char_t * ShortName;
};
typedef struct sMrbNamedXShort SMrbNamedXShort;
class TMrbNamedX: public TNamed {
public:
TMrbNamedX() {
fHasTitle = kFALSE;
fIndex = -1;
fObject = NULL;
};
TMrbNamedX(Int_t Index,
const Char_t * ShortName,
const Char_t * LongName = NULL,
TObject * Obj = NULL) : TNamed(ShortName, LongName ? LongName : ShortName) {
fHasTitle = (LongName != NULL);
fIndex = Index;
fSortedByName = kFALSE;
fObject = Obj;
};
~TMrbNamedX() {};
const Char_t * GetFullName(TString & FullName, Int_t Base = 10, Bool_t IndexFlag = kFALSE) const;
inline Int_t GetIndex() const { return(fIndex); };
inline void ChangeIndex(Int_t Index) { fIndex = Index; };
inline void AssignObject(TObject * Obj) { fObject = Obj; };
inline TObject * GetAssignedObject() const { return(fObject); };
inline void Set(Int_t Index, const Char_t * ShortName = NULL, const Char_t * LongName = NULL) {
fHasTitle = (LongName != NULL);
fIndex = Index;
if (ShortName) this->SetName(ShortName);
this->SetTitle(LongName ? LongName : this->GetName());
};
inline void Set(TMrbNamedX * NamedX) {
this->Set(NamedX->GetIndex(), NamedX->GetName(), NamedX->GetTitle());
};
inline void SetIndex(Int_t Index) { fIndex = Index; };
inline Bool_t HasTitle() const { return(fHasTitle); };
void Print(Option_t * Option) const { TObject::Print(Option); }
void Print(ostream & Out, Int_t Base = 10, Bool_t CrFlag = kTRUE) const;
inline void Print(Int_t Base) const { Print(cout, Base, kTRUE); };
inline void Print() const { Print(cout, 10, kTRUE); };
inline Bool_t IsSortable() const { return(kTRUE); };
inline void SortByName(Bool_t SortFlag = kTRUE) { fSortedByName = SortFlag; };
inline Bool_t IsSortedByName() const { return(fSortedByName); };
Int_t Compare(const TObject * Nx) const;
inline void Help() { gSystem->Exec(Form("mrbHelp %s", this->ClassName())); };
protected:
Bool_t fHasTitle;
Int_t fIndex;
Bool_t fSortedByName;
TObject * fObject;
ClassDef(TMrbNamedX, 1)
};
#endif