ROOT logo
/*****************************************************************************
 * Project: RooFit                                                           *
 * Package: RooFitCore                                                       *
 *    File: $Id: RooCmdArg.h,v 1.10 2007/05/11 09:11:30 verkerke Exp $
 * Authors:                                                                  *
 *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
 *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
 *                                                                           *
 * Copyright (c) 2000-2005, Regents of the University of California          *
 *                          and Stanford University. All rights reserved.    *
 *                                                                           *
 * Redistribution and use in source and binary forms,                        *
 * with or without modification, are permitted according to the terms        *
 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
 *****************************************************************************/

#ifndef ROO_CMD_ARG
#define ROO_CMD_ARG

#include <string>
#include "TNamed.h"
#include "TString.h"
#include "RooLinkedList.h"
class RooAbsData ;
class RooArgSet ;

class RooCmdArg : public TNamed {
public:

  RooCmdArg();
  RooCmdArg(const char* name, 
	    Int_t i1=0, Int_t i2=0, 
	    Double_t d1=0, Double_t d2=0, 
	    const char* s1=0, const char* s2=0, 
	    const TObject* o1=0, const TObject* o2=0, const RooCmdArg* ca=0, const char* s3=0,
	    const RooArgSet* c1=0, const RooArgSet* c2=0) ;
  RooCmdArg(const RooCmdArg& other) ;
  RooCmdArg& operator=(const RooCmdArg& other) ;
  void addArg(const RooCmdArg& arg) ;
  void setProcessRecArgs(Bool_t flag, Bool_t prefix=kTRUE) { 
    // If true flag this object as containing recursive arguments
    _procSubArgs = flag ; 
    _prefixSubArgs = prefix ;
  }

  RooLinkedList& subArgs() { 
    // Return list of sub-arguments in this RooCmdArg
    return _argList ; 
  }

  virtual TObject* Clone(const char* newName=0) const {
    RooCmdArg* newarg = new RooCmdArg(*this) ;
    if (newName) { newarg->SetName(newName) ; }
    return newarg ;
  }

  virtual ~RooCmdArg();

  static const RooCmdArg& none() ;

  const char* opcode() const { 
    // Return operator code
    return strlen(GetName()) ? GetName() : 0 ; 
  }

  void setInt(Int_t idx,Int_t value) {
    _i[idx] = value ;
  }
  void setDouble(Int_t idx,Double_t value) {
    _d[idx] = value ;
  }
  void setString(Int_t idx,const char* value) {
    _s[idx] = value ;
  }
  void setObject(Int_t idx,TObject* value) {
    _o[idx] = value ;
  }
  void setSet(Int_t idx,const RooArgSet& set) ;

  Int_t getInt(Int_t idx) const { 
    // Return integer stored in slot idx
    return _i[idx] ; 
  }
  Double_t getDouble(Int_t idx) const { 
    // Return double stored in slot idx
    return _d[idx] ; 
  }
  const char* getString(Int_t idx) const { 
    // Return string stored in slot idx
      return (_s[idx].size()>0) ? _s[idx].c_str() : 0 ; 
  }
  const TObject* getObject(Int_t idx) const { 
  // Return TObject stored in slot idx
    return _o[idx] ; 
  }

  const RooArgSet* getSet(Int_t idx) const ;

protected:

  static const RooCmdArg _none  ; // Static instance of null object
  friend class RooCmdConfig ;

private:

  friend class RooAbsCollection ;

  // Payload
  Double_t _d[2] ;       // Payload doubles
  Int_t _i[2] ;          // Payload integers
  std::string _s[3] ;    // Payload strings
  TObject* _o[2] ;       // Payload objects
  Bool_t _procSubArgs ;  // If true argument requires recursive processing
  RooArgSet* _c ;        // Payload RooArgSets 
  RooLinkedList _argList ; // Payload sub-arguments
  Bool_t _prefixSubArgs ; // Prefix subarguments with container name?
  
  ClassDef(RooCmdArg,2) // Generic named argument container
};

#endif


 RooCmdArg.h:1
 RooCmdArg.h:2
 RooCmdArg.h:3
 RooCmdArg.h:4
 RooCmdArg.h:5
 RooCmdArg.h:6
 RooCmdArg.h:7
 RooCmdArg.h:8
 RooCmdArg.h:9
 RooCmdArg.h:10
 RooCmdArg.h:11
 RooCmdArg.h:12
 RooCmdArg.h:13
 RooCmdArg.h:14
 RooCmdArg.h:15
 RooCmdArg.h:16
 RooCmdArg.h:17
 RooCmdArg.h:18
 RooCmdArg.h:19
 RooCmdArg.h:20
 RooCmdArg.h:21
 RooCmdArg.h:22
 RooCmdArg.h:23
 RooCmdArg.h:24
 RooCmdArg.h:25
 RooCmdArg.h:26
 RooCmdArg.h:27
 RooCmdArg.h:28
 RooCmdArg.h:29
 RooCmdArg.h:30
 RooCmdArg.h:31
 RooCmdArg.h:32
 RooCmdArg.h:33
 RooCmdArg.h:34
 RooCmdArg.h:35
 RooCmdArg.h:36
 RooCmdArg.h:37
 RooCmdArg.h:38
 RooCmdArg.h:39
 RooCmdArg.h:40
 RooCmdArg.h:41
 RooCmdArg.h:42
 RooCmdArg.h:43
 RooCmdArg.h:44
 RooCmdArg.h:45
 RooCmdArg.h:46
 RooCmdArg.h:47
 RooCmdArg.h:48
 RooCmdArg.h:49
 RooCmdArg.h:50
 RooCmdArg.h:51
 RooCmdArg.h:52
 RooCmdArg.h:53
 RooCmdArg.h:54
 RooCmdArg.h:55
 RooCmdArg.h:56
 RooCmdArg.h:57
 RooCmdArg.h:58
 RooCmdArg.h:59
 RooCmdArg.h:60
 RooCmdArg.h:61
 RooCmdArg.h:62
 RooCmdArg.h:63
 RooCmdArg.h:64
 RooCmdArg.h:65
 RooCmdArg.h:66
 RooCmdArg.h:67
 RooCmdArg.h:68
 RooCmdArg.h:69
 RooCmdArg.h:70
 RooCmdArg.h:71
 RooCmdArg.h:72
 RooCmdArg.h:73
 RooCmdArg.h:74
 RooCmdArg.h:75
 RooCmdArg.h:76
 RooCmdArg.h:77
 RooCmdArg.h:78
 RooCmdArg.h:79
 RooCmdArg.h:80
 RooCmdArg.h:81
 RooCmdArg.h:82
 RooCmdArg.h:83
 RooCmdArg.h:84
 RooCmdArg.h:85
 RooCmdArg.h:86
 RooCmdArg.h:87
 RooCmdArg.h:88
 RooCmdArg.h:89
 RooCmdArg.h:90
 RooCmdArg.h:91
 RooCmdArg.h:92
 RooCmdArg.h:93
 RooCmdArg.h:94
 RooCmdArg.h:95
 RooCmdArg.h:96
 RooCmdArg.h:97
 RooCmdArg.h:98
 RooCmdArg.h:99
 RooCmdArg.h:100
 RooCmdArg.h:101
 RooCmdArg.h:102
 RooCmdArg.h:103
 RooCmdArg.h:104
 RooCmdArg.h:105
 RooCmdArg.h:106
 RooCmdArg.h:107
 RooCmdArg.h:108
 RooCmdArg.h:109
 RooCmdArg.h:110
 RooCmdArg.h:111
 RooCmdArg.h:112
 RooCmdArg.h:113
 RooCmdArg.h:114
 RooCmdArg.h:115
 RooCmdArg.h:116
 RooCmdArg.h:117
 RooCmdArg.h:118
 RooCmdArg.h:119
 RooCmdArg.h:120
 RooCmdArg.h:121
 RooCmdArg.h:122
 RooCmdArg.h:123