#ifndef ROO_CAT_TYPE
#define ROO_CAT_TYPE
#include "Riosfwd.h"
#include "TObject.h"
#include "RooPrintable.h"
class RooCatType : public TObject, public RooPrintable {
public:
inline RooCatType() : TObject(), RooPrintable() {
_value = 0 ; _label[0] = 0 ;
}
inline RooCatType(const char* name, Int_t value) : TObject(), RooPrintable(), _value(value) {
SetName(name) ;
}
inline RooCatType(const RooCatType& other) :
TObject(other), RooPrintable(other), _value(other._value) {
strlcpy(_label,other._label,256) ;
} ;
virtual ~RooCatType() {
} ;
virtual TObject* Clone(const char*) const { return new RooCatType(*this); }
virtual const Text_t* GetName() const {
return _label[0] ? _label : 0 ;
}
virtual void SetName(const Text_t* name) ;
inline RooCatType& operator=(const RooCatType& other) {
if (&other==this) return *this ;
_label[0] = 0 ;
_value = other._value ;
return *this ; }
inline void assignFast(const RooCatType& other) {
_label[0] = 0 ;
_value = other._value ;
}
inline Bool_t operator==(const RooCatType& other) {
return (_value==other._value) ;
}
inline Bool_t operator==(Int_t index) {
return (_value==index) ;
}
Bool_t operator==(const char* label) {
return !strcmp(_label,label) ;
}
inline Int_t getVal() const {
return _value ;
}
void setVal(Int_t newValue) {
_value = newValue ;
}
virtual void printName(std::ostream& os) const ;
virtual void printTitle(std::ostream& os) const ;
virtual void printClassName(std::ostream& os) const ;
virtual void printValue(std::ostream& os) const ;
inline virtual void Print(Option_t *options= 0) const {
printStream(defaultPrintStream(),defaultPrintContents(options),defaultPrintStyle(options));
}
protected:
friend class RooAbsCategoryLValue ;
friend class RooAbsCategory ;
Int_t _value ;
char _label[256] ;
ClassDef(RooCatType,1)
} ;
#endif