Logo ROOT   6.07/09
Reference Guide
RooCatType.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 \file RooCatType.cxx
19 \class RooCatType
20 \ingroup Roofitcore
21 
22 RooCatType is an auxilary class for RooAbsCategory and defines a
23 a single category state. The class holds a string label and an integer
24 index value which define the state
25 **/
26 
27 #include "RooFit.h"
28 
29 #include <stdlib.h>
30 #include <stdlib.h>
31 #include "TClass.h"
32 #include "RooCatType.h"
33 
34 #include "Riostream.h"
35 
36 
37 using namespace std;
38 
40 ;
41 
42 
43 
44 ////////////////////////////////////////////////////////////////////////////////
45 /// Constructor with name argument
46 
48 {
49  if (strlen(name)>255) {
50  std::cout << "RooCatType::SetName warning: label '" << name << "' truncated at 255 chars" << std::endl ;
51  _label[255]=0 ;
52  }
53  strncpy(_label,name,255) ;
54 }
55 
56 
57 
58 ////////////////////////////////////////////////////////////////////////////////
59 /// Print the name of the state
60 
61 void RooCatType::printName(ostream& os) const
62 {
63  os << GetName() ;
64 }
65 
66 
67 
68 ////////////////////////////////////////////////////////////////////////////////
69 /// Print the title of the state
70 
71 void RooCatType::printTitle(ostream& os) const
72 {
73  os << GetTitle() ;
74 }
75 
76 
77 
78 ////////////////////////////////////////////////////////////////////////////////
79 /// Print the class name of the state
80 
81 void RooCatType::printClassName(ostream& os) const
82 {
83  os << IsA()->GetName() ;
84 }
85 
86 
87 
88 ////////////////////////////////////////////////////////////////////////////////
89 /// Print the value (index integer) of the state
90 
91 void RooCatType::printValue(ostream& os) const
92 {
93  os << getVal() ;
94 }
95 
virtual void printName(std::ostream &os) const
Print the name of the state.
Definition: RooCatType.cxx:61
virtual void printValue(std::ostream &os) const
Print the value (index integer) of the state.
Definition: RooCatType.cxx:91
STL namespace.
RooCatType is an auxilary class for RooAbsCategory and defines a a single category state...
Definition: RooCatType.h:23
#define ClassImp(name)
Definition: Rtypes.h:279
virtual void SetName(const Text_t *name)
Constructor with name argument.
Definition: RooCatType.cxx:47
virtual void printTitle(std::ostream &os) const
Print the title of the state.
Definition: RooCatType.cxx:71
char Text_t
Definition: RtypesCore.h:58
char name[80]
Definition: TGX11.cxx:109
virtual void printClassName(std::ostream &os) const
Print the class name of the state.
Definition: RooCatType.cxx:81