]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVE/EveBase/AliEveMacro.cxx
Coverity
[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), fExecExcString(), fExecResult(0)
27 {
28   // Constructor.
29 }
30
31 /******************************************************************************/
32
33 void AliEveMacro::ResetExecState()
34 {
35   // Reset exec variables into state as if the macro has not been run.
36
37   fExecStatus      = kNotRun;
38   fExecExcString = "";
39   fExecResult      = 0;
40 }
41
42 void AliEveMacro::SetExecNoData()
43 {
44   // Set last execution state to 'NoData'.
45
46   fExecStatus = kNoData;
47 }
48
49
50 void AliEveMacro::SetExecOK(TEveElement* result)
51 {
52   // Set last execution state to 'OK' and register result.
53
54   fExecStatus = kOK;
55   fExecResult = result;
56 }
57
58
59 void AliEveMacro::SetExecException(const TString& exception)
60 {
61   // Set last execution state to 'Exception' and store the exception string.
62
63   fExecStatus    = kException;
64   fExecExcString = exception;
65 }
66
67 void AliEveMacro::SetExecError()
68 {
69   // Set last execution state to 'Error'.
70
71   fExecStatus = kError;
72 }
73
74 /******************************************************************************/
75
76 TString AliEveMacro::FormForExec() const
77 {
78   // Return string suitable for execution.
79
80   return fFunc + "(" + fArgs + ");";
81 }
82
83 TString AliEveMacro::FormForDisplay() const
84 {
85   // Return string suitable for display.
86
87   return TString::Format
88     (" %c %-22s  %-30s  %-30s  %-s", fActive ? 'x' : ' ',
89      fMacro.Data(), fFunc.Data(), fArgs.Data(), fTags.Data());
90 }