]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveMacro.cxx
Update master to aliroot
[u/mrichter/AliRoot.git] / EVE / EveBase / AliEveMacro.cxx
1 // @(#)root/eve:$Id$
2 // Author: Matevz Tadel 2007
3
4 /**************************************************************************
5  * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
6  * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for          *
7  * full copyright notice.                                                 *
8  **************************************************************************/
9
10 #include "AliEveMacro.h"
11
12 //______________________________________________________________________________
13 //
14 // Member fSources is a bitfield, but we do not have a widget
15 // that can show/edit this (a combo-box with a check-box for each
16 // entry). So ... use a single value for now,
17
18 ClassImp(AliEveMacro)
19
20 //______________________________________________________________________________
21 AliEveMacro::AliEveMacro(Int_t src, const TString& tags, const TString& mac,
22                          const TString& foo, const TString& args, Bool_t act) :
23   TObject(),
24   fSources(src), fTags(tags), fMacro (mac),
25   fFunc   (foo), fArgs(args), fActive(act),
26   fExecStatus(kNotRun), 
27   fExecExcString(), 
28   fExecResult(0)
29 {
30   // Constructor.
31 }
32
33 /******************************************************************************/
34
35 void AliEveMacro::ResetExecState()
36 {
37   // Reset exec variables into state as if the macro has not been run.
38
39   fExecStatus      = kNotRun;
40   fExecExcString = "";
41   fExecResult      = 0;
42 }
43
44 void AliEveMacro::SetExecNoData()
45 {
46   // Set last execution state to 'NoData'.
47
48   fExecStatus = kNoData;
49 }
50
51
52 void AliEveMacro::SetExecOK(TEveElement* result)
53 {
54   // Set last execution state to 'OK' and register result.
55
56   fExecStatus = kOK;
57   fExecResult = result;
58 }
59
60
61 void AliEveMacro::SetExecException(const TString& exception)
62 {
63   // Set last execution state to 'Exception' and store the exception string.
64
65   fExecStatus    = kException;
66   fExecExcString = exception;
67 }
68
69 void AliEveMacro::SetExecError()
70 {
71   // Set last execution state to 'Error'.
72
73   fExecStatus = kError;
74 }
75
76 /******************************************************************************/
77
78 TString AliEveMacro::FormForExec() const
79 {
80   // Return string suitable for execution.
81
82   return fFunc + "(" + fArgs + ");";
83 }
84
85 TString AliEveMacro::FormForDisplay() const
86 {
87   // Return string suitable for display.
88
89   return TString::Format
90     (" %c %-22s  %-30s  %-30s  %-s", fActive ? 'x' : ' ',
91      fMacro.Data(), fFunc.Data(), fArgs.Data(), fTags.Data());
92 }