]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/AliStackingActionMessenger.cxx
New&delete used for array with variable size
[u/mrichter/AliRoot.git] / AliGeant4 / AliStackingActionMessenger.cxx
1 // $Id$
2 // Category: event
3 //
4 // See the class description in the header file.
5
6 #include "AliStackingActionMessenger.h"
7 #include "AliStackingAction.h"
8 #include "AliGlobals.h"
9
10 #include <G4UIdirectory.hh>
11 #include <G4UIcmdWithAnInteger.hh>
12 #include <G4UIcmdWithoutParameter.hh>
13
14 AliStackingActionMessenger::AliStackingActionMessenger(
15                               AliStackingAction* stackingAction)
16   :fStackingAction(stackingAction)
17 {
18 // 
19   fStackingDirectory = new G4UIdirectory("/aliStacking/");
20   fStackingDirectory->SetGuidance("AliStackingAction control commands.");
21
22   fVerboseCmd = new G4UIcmdWithAnInteger("/aliStacking/verbose", this);
23   fVerboseCmd->SetGuidance("Set verbose level for AliStackingAction");
24   fVerboseCmd->SetParameterName("VerboseLevel", true);
25   fVerboseCmd->SetDefaultValue(0);
26   fVerboseCmd->SetRange("VerboseLevel >= 0 && VerboseLevel <= 1");
27   fVerboseCmd->AvailableForStates(Idle);
28 }
29
30 AliStackingActionMessenger::AliStackingActionMessenger() {
31 //
32 }
33
34 AliStackingActionMessenger::AliStackingActionMessenger(
35                                  const AliStackingActionMessenger& right) {
36 //                               
37   AliGlobals::Exception("AliStackingActionMessenger is protected from copying.");
38 }
39
40 AliStackingActionMessenger::~AliStackingActionMessenger() {
41 //
42   delete fStackingDirectory;
43   delete fVerboseCmd;
44 }
45
46 // operators
47
48 AliStackingActionMessenger& 
49 AliStackingActionMessenger::operator=(const AliStackingActionMessenger &right)
50 {
51   // check assignement to self
52   if (this == &right) return *this;
53   
54   AliGlobals::Exception(
55     "AliStackingActionMessenger is protected from assigning.");
56
57   return *this;
58 }
59
60 // public methods
61
62 void AliStackingActionMessenger::SetNewValue(G4UIcommand* command, 
63        G4String newValue)
64
65 // Applies command to the associated object.
66 // ---
67
68   if (command == fVerboseCmd) { 
69     fStackingAction
70       ->SetVerboseLevel(fVerboseCmd->GetNewIntValue(newValue)); 
71   }  
72 }