Logo ROOT  
Reference Guide
RooCatTypeLegacy.cxx
Go to the documentation of this file.
1/*****************************************************************************
2 * Project: RooFit *
3 * Package: RooFitCore *
4 * @(#)root/roofitcore:$Id$
5 * Authors: *
6 * WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu *
7 * DK, David Kirkby, UC Irvine, dkirkby@uci.edu *
8 * *
9 * Copyright (c) 2000-2005, Regents of the University of California *
10 * and Stanford University. All rights reserved. *
11 * *
12 * Redistribution and use in source and binary forms, *
13 * with or without modification, are permitted according to the terms *
14 * listed in LICENSE (http://roofit.sourceforge.net/license.txt) *
15 *****************************************************************************/
16
17/**
18\class RooCatType
19\ingroup Roofitlegacy
20
21RooCatType is an auxilary class for RooAbsCategory and defines a
22a single category state. The class holds a string label and an integer
23index value which define the state
24**/
25
27
28#include "TClass.h"
29
30#include <iostream>
31
32
33
34using namespace std;
35
37;
38
39
40
41////////////////////////////////////////////////////////////////////////////////
42/// Constructor with name argument
43
45{
46 if (strlen(name)>255) {
47 std::cerr << "RooCatType::SetName warning: label '" << name << "' truncated at 255 chars" << std::endl ;
48 _label[255]=0 ;
49 }
50 strncpy(_label,name,255) ;
51}
52
53
54
55////////////////////////////////////////////////////////////////////////////////
56/// Print the name of the state
57
58void RooCatType::printName(ostream& os) const
59{
60 os << GetName() ;
61}
62
63
64
65////////////////////////////////////////////////////////////////////////////////
66/// Print the title of the state
67
68void RooCatType::printTitle(ostream& os) const
69{
70 os << GetTitle() ;
71}
72
73
74
75////////////////////////////////////////////////////////////////////////////////
76/// Print the class name of the state
77
78void RooCatType::printClassName(ostream& os) const
79{
80 os << IsA()->GetName() ;
81}
82
83
84
85////////////////////////////////////////////////////////////////////////////////
86/// Print the value (index integer) of the state
87
88void RooCatType::printValue(ostream& os) const
89{
90 os << getVal() ;
91}
92
char Text_t
Definition: RtypesCore.h:62
#define ClassImp(name)
Definition: Rtypes.h:375
char name[80]
Definition: TGX11.cxx:110
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state.
void printName(std::ostream &os) const override
Print the name of the state.
void printValue(std::ostream &os) const override
Print the value (index integer) of the state.
void printClassName(std::ostream &os) const override
Print the class name of the state.
char _label[256]
State name.
TClass * IsA() const override
void SetName(const Text_t *name)
Constructor with name argument.
void printTitle(std::ostream &os) const override
Print the title of the state.
Int_t getVal() const
const Text_t * GetName() const override
Returns name of object.
const char * GetName() const override
Returns name of object.
Definition: TNamed.h:47
virtual const char * GetTitle() const
Returns title of object.
Definition: TObject.cxx:403