TObjectExecute.h

Go to the documentation of this file.
00001 // @(#)root/qt:$Id: TObjectExecute.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: Valeri Fine   21/01/2002
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers.               *
00006  * Copyright (C) 2002 by Valeri Fine.                                    *
00007  * All rights reserved.                                                  *
00008  *                                                                       *
00009  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00010  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00011  *************************************************************************/
00012 
00013 #ifndef ROOT_TObjectExecute
00014 #define ROOT_TObjectExecute
00015 
00016 #include "TQtRConfig.h"
00017 
00018 #include "TObject.h"
00019 #include "TFunction.h"
00020 #include "TObjArray.h"
00021 #include "TObjString.h"
00022 #include "TROOT.h"
00023 
00024 //______________________________________________________________________________
00025 class TObjectExecute :  public TObject {
00026 private:
00027   TObject *fObject;
00028   TMethod *fMethod;
00029   TFunction *fFunction;
00030   TObjArray *fParams;
00031 protected:
00032 
00033 public:
00034   //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
00035   TObjectExecute():fObject(0),fMethod(0),fFunction(0),fParams(0)
00036   {}
00037   //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
00038   void Execute(TObject *o,TMethod *m,TObjArray *p=0)
00039   {
00040     if (o && m) {
00041       fFunction=0;fObject=o;fMethod=m;fParams=p;
00042       o->Execute(m,p);
00043     }
00044   }
00045   //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
00046   void  Execute(const char *method,  const char *params, Int_t *error=0)
00047   {TObject::Execute(method,params,error);}
00048   //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
00049   void  Execute(TMethod *method, TObjArray *params, Int_t *error=0)
00050   {TObject::Execute(method,params,error);}
00051 
00052   //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
00053   void Execute(TObject *o,TFunction *f,TObjArray *p=0)
00054   {
00055     if (o && f) {
00056       fMethod=0;fObject=o;fFunction=f;fParams=p;
00057 //      o->Execute(f,p);
00058     }
00059   }
00060   //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
00061   void Execute(TFunction *f,TObjArray *p=0)
00062   {
00063     if (f) {
00064       fMethod=0;fObject=0;fFunction=f;fParams=p;
00065       TString args;
00066       TIter next(p);
00067       TObjString *s;
00068       while ((s = (TObjString*) next())) {
00069         if (!args.IsNull()) args += ",";
00070         args += s->String();
00071       }
00072       char *cmd = Form("%s(%s);", f->GetName(), args.Data());
00073       gROOT->ProcessLine(cmd);
00074     }
00075   }
00076   //_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
00077   virtual ~TObjectExecute(){}
00078 };
00079 
00080 #endif

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