RooCmdArg.h

Go to the documentation of this file.
00001 /*****************************************************************************
00002  * Project: RooFit                                                           *
00003  * Package: RooFitCore                                                       *
00004  *    File: $Id: RooCmdArg.h,v 1.10 2007/05/11 09:11:30 verkerke Exp $
00005  * Authors:                                                                  *
00006  *   WV, Wouter Verkerke, UC Santa Barbara, verkerke@slac.stanford.edu       *
00007  *   DK, David Kirkby,    UC Irvine,         dkirkby@uci.edu                 *
00008  *                                                                           *
00009  * Copyright (c) 2000-2005, Regents of the University of California          *
00010  *                          and Stanford University. All rights reserved.    *
00011  *                                                                           *
00012  * Redistribution and use in source and binary forms,                        *
00013  * with or without modification, are permitted according to the terms        *
00014  * listed in LICENSE (http://roofit.sourceforge.net/license.txt)             *
00015  *****************************************************************************/
00016 
00017 #ifndef ROO_CMD_ARG
00018 #define ROO_CMD_ARG
00019 
00020 #include <string>
00021 #include "TNamed.h"
00022 #include "TString.h"
00023 #include "RooLinkedList.h"
00024 class RooAbsData ;
00025 class RooArgSet ;
00026 
00027 class RooCmdArg : public TNamed {
00028 public:
00029 
00030   RooCmdArg();
00031   RooCmdArg(const char* name, 
00032             Int_t i1=0, Int_t i2=0, 
00033             Double_t d1=0, Double_t d2=0, 
00034             const char* s1=0, const char* s2=0, 
00035             const TObject* o1=0, const TObject* o2=0, const RooCmdArg* ca=0, const char* s3=0,
00036             const RooArgSet* c1=0, const RooArgSet* c2=0) ;
00037   RooCmdArg(const RooCmdArg& other) ;
00038   RooCmdArg& operator=(const RooCmdArg& other) ;
00039   void addArg(const RooCmdArg& arg) ;
00040   void setProcessRecArgs(Bool_t flag, Bool_t prefix=kTRUE) { 
00041     // If true flag this object as containing recursive arguments
00042     _procSubArgs = flag ; 
00043     _prefixSubArgs = prefix ;
00044   }
00045 
00046   RooLinkedList& subArgs() { 
00047     // Return list of sub-arguments in this RooCmdArg
00048     return _argList ; 
00049   }
00050 
00051   virtual TObject* Clone(const char* newName=0) const {
00052     RooCmdArg* newarg = new RooCmdArg(*this) ;
00053     if (newName) { newarg->SetName(newName) ; }
00054     return newarg ;
00055   }
00056 
00057   virtual ~RooCmdArg();
00058 
00059   static const RooCmdArg& none() ;
00060 
00061   const char* opcode() const { 
00062     // Return operator code
00063     return strlen(GetName()) ? GetName() : 0 ; 
00064   }
00065 
00066   void setInt(Int_t idx,Int_t value) {
00067     _i[idx] = value ;
00068   }
00069   void setDouble(Int_t idx,Double_t value) {
00070     _d[idx] = value ;
00071   }
00072   void setString(Int_t idx,const char* value) {
00073     _s[idx] = value ;
00074   }
00075   void setObject(Int_t idx,TObject* value) {
00076     _o[idx] = value ;
00077   }
00078   void setSet(Int_t idx,const RooArgSet& set) ;
00079 
00080   Int_t getInt(Int_t idx) const { 
00081     // Return integer stored in slot idx
00082     return _i[idx] ; 
00083   }
00084   Double_t getDouble(Int_t idx) const { 
00085     // Return double stored in slot idx
00086     return _d[idx] ; 
00087   }
00088   const char* getString(Int_t idx) const { 
00089     // Return string stored in slot idx
00090       return (_s[idx].size()>0) ? _s[idx].c_str() : 0 ; 
00091   }
00092   const TObject* getObject(Int_t idx) const { 
00093   // Return TObject stored in slot idx
00094     return _o[idx] ; 
00095   }
00096 
00097   const RooArgSet* getSet(Int_t idx) const ;
00098 
00099 protected:
00100 
00101   static const RooCmdArg _none  ; // Static instance of null object
00102   friend class RooCmdConfig ;
00103 
00104 private:
00105 
00106   friend class RooAbsCollection ;
00107 
00108   // Payload
00109   Double_t _d[2] ;       // Payload doubles
00110   Int_t _i[2] ;          // Payload integers
00111   std::string _s[3] ;    // Payload strings
00112   TObject* _o[2] ;       // Payload objects
00113   Bool_t _procSubArgs ;  // If true argument requires recursive processing
00114   RooArgSet* _c ;        // Payload RooArgSets 
00115   RooLinkedList _argList ; // Payload sub-arguments
00116   Bool_t _prefixSubArgs ; // Prefix subarguments with container name?
00117   
00118   ClassDef(RooCmdArg,2) // Generic named argument container
00119 };
00120 
00121 #endif
00122 
00123 

Generated on Tue Jul 5 14:26:06 2011 for ROOT_528-00b_version by  doxygen 1.5.1