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