ROOT  6.06/09
Reference Guide
RooPrintable.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooPrintable.h,v 1.12 2007/05/11 09:11:30 verkerke Exp $
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 #ifndef ROO_PRINTABLE
17 #define ROO_PRINTABLE
18 
19 
20 class TNamed ;
21 
22 #include "Riosfwd.h"
23 #include "Rtypes.h"
24 #include "TString.h"
25 
26 class RooPrintable {
27 public:
28  inline RooPrintable() { }
29  inline virtual ~RooPrintable() { }
30 
31  // New-style printing
32 
33  // Master print function
34  enum ContentsOption { kName=1, kClassName=2, kValue=4, kArgs=8, kExtras=16, kAddress=32, kTitle=64, kCollectionHeader=128} ; // Can be ORed
35  enum StyleOption { kInline=1, kSingleLine=2, kStandard=3, kVerbose=4, kTreeStructure=5 } ; // Exclusive
36  virtual void printStream(std::ostream& os, Int_t contents, StyleOption style, TString indent="") const ;
37 
38  // Virtual hook function for class-specific content implementation
39  virtual void printAddress(std::ostream& os) const ;
40  virtual void printName(std::ostream& os) const ;
41  virtual void printTitle(std::ostream& os) const ;
42  virtual void printClassName(std::ostream& os) const ;
43  virtual void printValue(std::ostream& os) const ;
44  virtual void printArgs(std::ostream& os) const ;
45  virtual void printExtras(std::ostream& os) const ;
46  virtual void printMultiline(std::ostream& os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const ;
47  virtual void printTree(std::ostream& os, TString indent="") const ;
48 
49  static std::ostream& defaultPrintStream(std::ostream *os= 0);
50  virtual Int_t defaultPrintContents(Option_t* opt) const ;
51  virtual StyleOption defaultPrintStyle(Option_t* opt) const ;
52 
53  // Formatting control
54  static void nameFieldLength(Int_t newLen) ;
55 
56 protected:
57 
58  static Int_t _nameLength ;
59 
60  ClassDef(RooPrintable,1) // Interface for printable objects
61 
62 
63 };
64 
65 namespace RooFit {
66 std::ostream& operator<<(std::ostream& os, const RooPrintable& rp) ;
67 }
68 
69 #ifndef __CINT__
70 using RooFit::operator<< ;
71 #endif
72 
73 #endif
virtual void printStream(std::ostream &os, Int_t contents, StyleOption style, TString indent="") const
Print description of object on ostream, printing contents set by contents integer, which is interpreted as an OR of 'enum ContentsOptions' values and in the style given by 'enum StyleOption'.
const char Option_t
Definition: RtypesCore.h:62
static void nameFieldLength(Int_t newLen)
Set length of field reserved from printing name of RooAbsArgs in multi-line collection printing to gi...
Basic string class.
Definition: TString.h:137
static Int_t _nameLength
Definition: RooPrintable.h:58
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual StyleOption defaultPrintStyle(Option_t *opt) const
virtual Int_t defaultPrintContents(Option_t *opt) const
Default choice of contents to be printed (name and value)
virtual void printMultiline(std::ostream &os, Int_t contents, Bool_t verbose=kFALSE, TString indent="") const
Interface for detailed printing of object.
virtual void printName(std::ostream &os) const
Print name of object.
#define ClassDef(name, id)
Definition: Rtypes.h:254
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:33
std::ostream & operator<<(std::ostream &os, const RooPrintable &rp)
virtual void printExtras(std::ostream &os) const
Interface to print extras of object.
virtual void printTitle(std::ostream &os) const
Print title of object.
virtual void printAddress(std::ostream &os) const
Print class name of object.
virtual void printArgs(std::ostream &os) const
Interface for printing of object arguments.
bool verbose
static void indent(ostringstream &buf, int indent_level)
virtual void printClassName(std::ostream &os) const
Print class name of object.
static std::ostream & defaultPrintStream(std::ostream *os=0)
Return a reference to the current default stream to use in Print().
TCanvas * style()
Definition: style.C:1
virtual void printTree(std::ostream &os, TString indent="") const
Interface for tree structure printing of object.
virtual void printValue(std::ostream &os) const
Interface to print value of object.
virtual ~RooPrintable()
Definition: RooPrintable.h:29