#include "TMacro.h"

TMacro


class description - source file - inheritance tree (.pdf)

class TMacro : public TNamed

Inheritance Chart:
TObject
<-
TNamed
<-
TMacro

    public:
TMacro() TMacro(const TMacro&) TMacro(const char* name, const char* title = "") virtual ~TMacro() virtual TObjString* AddLine(const char* text) virtual void Browse(TBrowser* b) static TClass* Class() virtual void Exec(const char* params = "0") virtual TObjString* GetLineWith(const char* text) const TList* GetListOfLines() const virtual TClass* IsA() const TMacro& operator=(const TMacro&) virtual void Paint(Option_t* option = "") virtual void Print(Option_t* option = "") const virtual Int_t ReadFile(const char* filename) virtual void SavePrimitive(ofstream& out, Option_t* option) virtual void SaveSource(const char* filename) virtual void SetParams(const char* params = "0") virtual void ShowMembers(TMemberInspector& insp, char* parent) virtual void Streamer(TBuffer& b) void StreamerNVirtual(TBuffer& b)

Data Members


    protected:
TList* fLines collection of lines TString fParams default string of macro parameters

Class Description

                                                                      
 TMacro                                                               
                                                                      
 class supporting a collection of lines with C++ code.                
 A TMacro can be executed, saved to a ROOT file, edited, etc          
                                                                      
 A macro can be built line by line by calling the AddLine function.   
 or it can be created directly from a file via the special constructor
 when the first argument is a file name.                              
                                                                      
 A macro can be executed via the Exec function.                       
 Arguments can be specified when calling Exec.                        
                                                                      
 A macro can be drawn in a pad. When the pad is updated, the macro is 
 automatically executed.                                              
                                                                      
 The code in the macro can be saved via the SaveSource function.      
 If the macro is in the list of primitives of a pad/canvas, the macro 
 will be saved in the script generated by TCanvas::SaveSource.        
                                                                      
 A macro can be written to a ROOT file via TObject::Write.            
                                                                      
 Examples:                                                            
   TMacro m("Peaks.C");  //macro m with name "Peaks" is created       
                         //from file  Peaks.C                         
   m.Exec();             //macro executed with default arguments      
   m.Exec("4");          //macro executed with argument               
   m.SaveSource("newPeaks.C");                                        
   TFile f("mymacros.root","recreate");                               
   m.Write();   //macro saved to file with name "Peaks"               
                                                                      


TMacro(): TNamed()
 create an empty macro
 use AddLine or ReadFile to fill this macro.

TMacro(const char *name, const char *title) :TNamed(name,title)
 create a macro with a name and a title.
 if name is the name of a file, the macro is automatically filled
 by reading all the lines in the file. In this case, if the title
 is empty, it will be the name of the file.

TMacro(const TMacro &macro): TNamed(macro)
 copy constructor

~TMacro()
 delete this macro

TObjString* AddLine(const char *text)
add line with text in the list of lines of this macro

void Browse(TBrowser * /*b*/)
 when clicking in the browser, the macro will be executed.

void Exec(const char *params)
 execute this macro with params
 if params is null, default parameters (set via SetParams)  are used

TObjString* GetLineWith(const char *text) const
search the first line containing text

void Paint(Option_t *option)
 execute this macro (called by TPad::Paint)

void Print(Option_t * /*option*/) const
 print contents of this macro

Int_t ReadFile(const char *filename)
read lines in filename in this macro

void SaveSource(const char *filename)
save macro source in filename

void SavePrimitive(ofstream &out, Option_t *option)
save macro source on stream out

void SetParams(const char *params)
set default parameters to execute this macro



Inline Functions


             TList* GetListOfLines() const
            TClass* Class()
            TClass* IsA() const
               void ShowMembers(TMemberInspector& insp, char* parent)
               void Streamer(TBuffer& b)
               void StreamerNVirtual(TBuffer& b)
            TMacro& operator=(const TMacro&)


Author: Rene Brun 16/08/2005
Last update: root/base:$Name: $:$Id: TMacro.cxx,v 1.3 2005/08/16 17:25:54 brun Exp $
Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *


ROOT page - Class index - Class Hierarchy - Top of the page

This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.