library: libCore #include "TMacro.h" |
TMacro
class description - header file - source file - inheritance tree (.pdf)
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)
virtual TMD5* Checksum()
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(ostream& 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)
protected:
TList* fLines collection of lines
TString fParams default string of macro parameters
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(const char *name, const char *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.
TObjString * AddLine(const char *text)
Add line with text in the list of lines of this macro.
TMD5 * Checksum()
Returns checksum of the current content. The returned TMD5 object must
be deleted by the user. Returns 0 in case of error.
void Exec(const char *params)
Execute this macro with params, if params is 0, default parameters
(set via SetParams) are used.
void SaveSource(const char *filename)
Save macro source in filename.
void SetParams(const char *params)
Set default parameters to execute this macro.
Author: Rene Brun 16/08/2005
Last update: root/base:$Name: $:$Id: TMacro.cxx,v 1.9 2006/07/03 16:10:43 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.