Logo ROOT  
Reference Guide
RooCmdArg.h
Go to the documentation of this file.
1 /*****************************************************************************
2  * Project: RooFit *
3  * Package: RooFitCore *
4  * File: $Id: RooCmdArg.h,v 1.10 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 
17 #ifndef ROO_CMD_ARG
18 #define ROO_CMD_ARG
19 
20 #include "TNamed.h"
21 #include "RooLinkedList.h"
22 #include <string>
23 
24 class RooAbsData ;
25 class RooArgSet ;
26 
27 class RooCmdArg : public TNamed {
28 public:
29 
30  RooCmdArg();
31  RooCmdArg(const char* name,
32  Int_t i1=0, Int_t i2=0,
33  Double_t d1=0, Double_t d2=0,
34  const char* s1=0, const char* s2=0,
35  const TObject* o1=0, const TObject* o2=0, const RooCmdArg* ca=0, const char* s3=0,
36  const RooArgSet* c1=0, const RooArgSet* c2=0) ;
37  RooCmdArg(const RooCmdArg& other) ;
38  RooCmdArg& operator=(const RooCmdArg& other) ;
39  void addArg(const RooCmdArg& arg) ;
40  void setProcessRecArgs(Bool_t flag, Bool_t prefix=kTRUE) {
41  // If true flag this object as containing recursive arguments
42  _procSubArgs = flag ;
43  _prefixSubArgs = prefix ;
44  }
45 
47  // Return list of sub-arguments in this RooCmdArg
48  return _argList ;
49  }
50 
51  virtual TObject* Clone(const char* newName=0) const {
52  RooCmdArg* newarg = new RooCmdArg(*this) ;
53  if (newName) { newarg->SetName(newName) ; }
54  return newarg ;
55  }
56 
57  virtual ~RooCmdArg();
58 
59  static const RooCmdArg& none() ;
60 
61  const char* opcode() const {
62  // Return operator code
63  return strlen(GetName()) ? GetName() : 0 ;
64  }
65 
66  void setInt(Int_t idx,Int_t value) {
67  _i[idx] = value ;
68  }
69  void setDouble(Int_t idx,Double_t value) {
70  _d[idx] = value ;
71  }
72  void setString(Int_t idx,const char* value) {
73  _s[idx] = value ;
74  }
75  void setObject(Int_t idx,TObject* value) {
76  _o[idx] = value ;
77  }
78  void setSet(Int_t idx,const RooArgSet& set) ;
79 
80  Int_t getInt(Int_t idx) const {
81  // Return integer stored in slot idx
82  return _i[idx] ;
83  }
84  Double_t getDouble(Int_t idx) const {
85  // Return double stored in slot idx
86  return _d[idx] ;
87  }
88  const char* getString(Int_t idx) const {
89  // Return string stored in slot idx
90  return (_s[idx].size()>0) ? _s[idx].c_str() : 0 ;
91  }
92  const TObject* getObject(Int_t idx) const {
93  // Return TObject stored in slot idx
94  return _o[idx] ;
95  }
96 
97  const RooArgSet* getSet(Int_t idx) const ;
98 
99  void Print(const char* = "") const;
100 
101 protected:
102 
103  static const RooCmdArg _none ; // Static instance of null object
104  friend class RooCmdConfig ;
105 
106 private:
107 
108  friend class RooAbsCollection ;
109 
110  // Payload
111  Double_t _d[2] ; // Payload doubles
112  Int_t _i[2] ; // Payload integers
113  std::string _s[3] ; // Payload strings
114  TObject* _o[2] ; // Payload objects
115  Bool_t _procSubArgs ; // If true argument requires recursive processing
116  RooArgSet* _c ; // Payload RooArgSets
117  RooLinkedList _argList ; // Payload sub-arguments
118  Bool_t _prefixSubArgs ; // Prefix subarguments with container name?
119 
120  ClassDef(RooCmdArg,2) // Generic named argument container
121 };
122 
123 #endif
124 
125 
RooCmdArg
Definition: RooCmdArg.h:27
RooCmdArg::_argList
RooLinkedList _argList
Definition: RooCmdArg.h:117
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
RooCmdArg::getSet
const RooArgSet * getSet(Int_t idx) const
Return RooArgSet stored in slot idx.
Definition: RooCmdArg.cxx:200
RooCmdArg::operator=
RooCmdArg & operator=(const RooCmdArg &other)
Assignment operator.
Definition: RooCmdArg.cxx:142
RooCmdArg::getInt
Int_t getInt(Int_t idx) const
Definition: RooCmdArg.h:80
TNamed::SetName
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
RooAbsData
Definition: RooAbsData.h:46
RooCmdArg::~RooCmdArg
virtual ~RooCmdArg()
Destructor.
Definition: RooCmdArg.cxx:179
RooCmdArg::getObject
const TObject * getObject(Int_t idx) const
Definition: RooCmdArg.h:92
RooCmdArg::addArg
void addArg(const RooCmdArg &arg)
Utility function to add nested RooCmdArg to payload of this RooCmdArg.
Definition: RooCmdArg.cxx:190
RooCmdArg::setObject
void setObject(Int_t idx, TObject *value)
Definition: RooCmdArg.h:75
TNamed.h
RooCmdArg::_procSubArgs
Bool_t _procSubArgs
Definition: RooCmdArg.h:115
Int_t
int Int_t
Definition: RtypesCore.h:45
RooCmdArg::setInt
void setInt(Int_t idx, Int_t value)
Definition: RooCmdArg.h:66
RooCmdArg::_c
RooArgSet * _c
Definition: RooCmdArg.h:116
RooCmdArg::_prefixSubArgs
Bool_t _prefixSubArgs
Definition: RooCmdArg.h:118
RooCmdArg::getString
const char * getString(Int_t idx) const
Definition: RooCmdArg.h:88
RooCmdArg::getDouble
Double_t getDouble(Int_t idx) const
Definition: RooCmdArg.h:84
RooCmdArg::_none
static const RooCmdArg _none
Definition: RooCmdArg.h:103
RooCmdArg::none
static const RooCmdArg & none()
Return reference to null argument.
Definition: RooCmdArg.cxx:52
bool
RooCmdArg::subArgs
RooLinkedList & subArgs()
Definition: RooCmdArg.h:46
RooCmdArg::setString
void setString(Int_t idx, const char *value)
Definition: RooCmdArg.h:72
RooCmdConfig
Definition: RooCmdConfig.h:27
RooCmdArg::_d
Double_t _d[2]
Definition: RooCmdArg.h:111
RooCmdArg::setSet
void setSet(Int_t idx, const RooArgSet &set)
Definition: RooCmdArg.cxx:208
RooCmdArg::RooCmdArg
RooCmdArg()
Default constructor.
Definition: RooCmdArg.cxx:61
RooCmdArg::_i
Int_t _i[2]
Definition: RooCmdArg.h:112
TNamed
Definition: TNamed.h:29
s1
#define s1(x)
Definition: RSha256.hxx:109
RooLinkedList
Definition: RooLinkedList.h:35
RooAbsCollection
Definition: RooAbsCollection.h:30
RooCmdArg::Clone
virtual TObject * Clone(const char *newName=0) const
Make a clone of an object using the Streamer facility.
Definition: RooCmdArg.h:51
RooCmdArg::setProcessRecArgs
void setProcessRecArgs(Bool_t flag, Bool_t prefix=kTRUE)
Definition: RooCmdArg.h:40
RooCmdArg::Print
void Print(const char *="") const
Print contents.
Definition: RooCmdArg.cxx:220
RooCmdArg::_s
std::string _s[3]
Definition: RooCmdArg.h:113
Double_t
double Double_t
Definition: RtypesCore.h:59
RooCmdArg::_o
TObject * _o[2]
Definition: RooCmdArg.h:114
RooLinkedList.h
TObject
Definition: TObject.h:37
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
name
char name[80]
Definition: TGX11.cxx:110
c2
return c2
Definition: legend2.C:14
RooCmdArg::setDouble
void setDouble(Int_t idx, Double_t value)
Definition: RooCmdArg.h:69
RooCmdArg::opcode
const char * opcode() const
Definition: RooCmdArg.h:61
TNamed::GetName
virtual const char * GetName() const
Returns name of object.
Definition: TNamed.h:53
RooArgSet
Definition: RooArgSet.h:28
int
c1
return c1
Definition: legend1.C:41