library: libCore
#include "TMacro.h"


class description - header file - source file
viewCVS header - viewCVS source

class TMacro: public TNamed

Inheritance Inherited Members Includes Libraries
Class Charts

Function Members (Methods)

Display options:
Show inherited
Show non-public
TMacro(const TMacro&)
TMacro(const char* name, const char* title = "")
voidTObject::AbstractMethod(const char* method) const
virtual TObjString*AddLine(const char* text)
virtual voidTObject::AppendPad(Option_t* option = "")
virtual voidBrowse(TBrowser* b)
virtual TMD5*Checksum()
static TClass*Class()
virtual const char*TObject::ClassName() const
virtual voidTNamed::Clear(Option_t* option = "")
virtual TObject*TNamed::Clone(const char* newname = "") const
virtual Int_tTNamed::Compare(const TObject* obj) const
virtual voidTNamed::Copy(TObject& named) const
virtual voidTObject::Delete(Option_t* option = "")
virtual Int_tTObject::DistancetoPrimitive(Int_t px, Int_t py)
virtual voidTObject::Draw(Option_t* option = "")
virtual voidTObject::DrawClass() const
virtual TObject*TObject::DrawClone(Option_t* option = "") const
virtual voidTObject::Dump() const
virtual voidTObject::Error(const char* method, const char* msgfmt) const
virtual voidExec(const char* params = "0")
virtual voidTObject::Execute(const char* method, const char* params, Int_t* error = 0)
virtual voidTObject::Execute(TMethod* method, TObjArray* params, Int_t* error = 0)
virtual voidTObject::ExecuteEvent(Int_t event, Int_t px, Int_t py)
virtual voidTObject::Fatal(const char* method, const char* msgfmt) const
virtual voidTNamed::FillBuffer(char*& buffer)
virtual TObject*TObject::FindObject(const char* name) const
virtual TObject*TObject::FindObject(const TObject* obj) const
virtual Option_t*TObject::GetDrawOption() const
static Long_tTObject::GetDtorOnly()
virtual const char*TObject::GetIconName() const
virtual TObjString*GetLineWith(const char* text) const
TList*GetListOfLines() const
virtual const char*TNamed::GetName() const
virtual char*TObject::GetObjectInfo(Int_t px, Int_t py) const
static Bool_tTObject::GetObjectStat()
virtual Option_t*TObject::GetOption() const
virtual const char*TNamed::GetTitle() const
virtual UInt_tTObject::GetUniqueID() const
virtual Bool_tTObject::HandleTimer(TTimer* timer)
virtual ULong_tTNamed::Hash() const
virtual voidTObject::Info(const char* method, const char* msgfmt) const
virtual Bool_tTObject::InheritsFrom(const char* classname) const
virtual Bool_tTObject::InheritsFrom(const TClass* cl) const
virtual voidTObject::Inspect() const
voidTObject::InvertBit(UInt_t f)
virtual TClass*IsA() const
virtual Bool_tTObject::IsEqual(const TObject* obj) const
virtual Bool_tTObject::IsFolder() const
Bool_tTObject::IsOnHeap() const
virtual Bool_tTNamed::IsSortable() const
Bool_tTObject::IsZombie() const
virtual voidTNamed::ls(Option_t* option = "") const
voidTObject::MayNotUse(const char* method) const
virtual Bool_tTObject::Notify()
static voidTObject::operator delete(void* ptr)
static voidTObject::operator delete(void* ptr, void* vp)
static voidTObject::operator delete[](void* ptr)
static voidTObject::operator delete[](void* ptr, void* vp)
void*TObject::operator new(size_t sz)
void*TObject::operator new(size_t sz, void* vp)
void*TObject::operator new[](size_t sz)
void*TObject::operator new[](size_t sz, void* vp)
TMacro&operator=(const TMacro&)
virtual voidPaint(Option_t* option = "")
virtual voidTObject::Pop()
virtual voidPrint(Option_t* option = "") const
virtual Int_tTObject::Read(const char* name)
virtual Int_tReadFile(const char* filename)
virtual voidTObject::RecursiveRemove(TObject* obj)
voidTObject::ResetBit(UInt_t f)
virtual voidTObject::SaveAs(const char* filename = "", Option_t* option = "") const
virtual voidSavePrimitive(ostream& out, Option_t* option = "")
virtual voidSaveSource(const char* filename)
voidTObject::SetBit(UInt_t f)
voidTObject::SetBit(UInt_t f, Bool_t set)
virtual voidTObject::SetDrawOption(Option_t* option = "")
static voidTObject::SetDtorOnly(void* obj)
virtual voidTNamed::SetName(const char* name)
virtual voidTNamed::SetNameTitle(const char* name, const char* title)
static voidTObject::SetObjectStat(Bool_t stat)
virtual voidSetParams(const char* params = "0")
virtual voidTNamed::SetTitle(const char* title = "")
virtual voidTObject::SetUniqueID(UInt_t uid)
virtual voidShowMembers(TMemberInspector& insp, char* parent)
virtual Int_tTNamed::Sizeof() const
virtual voidStreamer(TBuffer& b)
voidStreamerNVirtual(TBuffer& b)
virtual voidTObject::SysError(const char* method, const char* msgfmt) const
Bool_tTObject::TestBit(UInt_t f) const
Int_tTObject::TestBits(UInt_t f) const
virtual voidTObject::UseCurrentStyle()
virtual voidTObject::Warning(const char* method, const char* msgfmt) const
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0)
virtual Int_tTObject::Write(const char* name = "0", Int_t option = 0, Int_t bufsize = 0) const
virtual voidTObject::DoError(int level, const char* location, const char* fmt, va_list va) const

Data Members

enum TObject::EStatusBits { kCanDelete
enum TObject::[unnamed] { kIsOnHeap
TList*fLinescollection of lines
TStringfParamsdefault string of macro parameters
TStringTNamed::fNameobject identifier
TStringTNamed::fTitleobject title

Class Description

 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.            
   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               
   TFile f("mymacros.root","recreate");                               
   m.Write();   //macro saved to file with name "Peaks"               

 Create an empty macro, use AddLine() or ReadFile() to fill this macro.
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.
TMacro(const TMacro &macro)
 Copy constructor.
 Delete this macro.
TMacro& operator=(const TMacro &macro)
 Copy constructor.
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 following action is performed
 on this macro, depending the content of the variable TMacro.Browse.
 TMacro.Browse can be set in the system.rootrc or .rootrc file like
     TMacro.Browse   :  Action
 or set via gEnv->SetValue, eg
 By default TMacro.Browse=""
 -if TMacro.Browse ="" the macro is executed
 -if TMacro.Browse ="Print" the macro is printed in stdout
 -if TMacro.Browse is of the form "mymacro.C"
     the macro void mymacro.C(TMacro *m) is called where m=this macro
     An example of macro.C saving the macro into a file and viewing it
     with emacs is shown below:
        void mymacro(TMacro *m) {
           gSystem->Exec("emacs xx.log&");
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.
TObjString * GetLineWith(const char *text)
 Search the first line containing text.
void Paint(Option_t *option)
 Execute this macro (called by TPad::Paint).
void Print(Option_t * /*option*/)
 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(ostream &out, Option_t *option /*= ""*/)
 Save macro source on stream out.
void SetParams(const char *params)
 Set default parameters to execute this macro.
TList * GetListOfLines()
{return fLines;}

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.