source: trunk/examples/advanced/radiation_monitor/analysis/src/RadmonDataAnalysisWithLabelMessenger.cc @ 1321

Last change on this file since 1321 was 807, checked in by garnier, 16 years ago

update

File size: 4.4 KB
Line 
1//
2// ********************************************************************
3// * License and Disclaimer                                           *
4// *                                                                  *
5// * The  Geant4 software  is  copyright of the Copyright Holders  of *
6// * the Geant4 Collaboration.  It is provided  under  the terms  and *
7// * conditions of the Geant4 Software License,  included in the file *
8// * LICENSE and available at  http://cern.ch/geant4/license .  These *
9// * include a list of copyright holders.                             *
10// *                                                                  *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work  make  any representation or  warranty, express or implied, *
14// * regarding  this  software system or assume any liability for its *
15// * use.  Please see the license in the file  LICENSE  and URL above *
16// * for the full disclaimer and the limitation of liability.         *
17// *                                                                  *
18// * This  code  implementation is the result of  the  scientific and *
19// * technical work of the GEANT4 collaboration.                      *
20// * By using,  copying,  modifying or  distributing the software (or *
21// * any work based  on the software)  you  agree  to acknowledge its *
22// * use  in  resulting  scientific  publications,  and indicate your *
23// * acceptance of all terms of the Geant4 Software license.          *
24// ********************************************************************
25//
26//[B
27// File name:     RadmonDataAnalysisWithLabelMessenger.cc
28// Creation date: Nov 2005
29// Main author:   Riccardo Capra <capra@ge.infn.it>
30//
31// Id:            $Id: RadmonDataAnalysisWithLabelMessenger.cc,v 1.3 2006/06/29 16:07:49 gunter Exp $
32// Tag:           $Name:  $
33//
34
35// Messenger commands path
36#define COMMANDS_PATH "/radmon/dataAnalysisFactory/"
37
38// Include files
39#include "RadmonDataAnalysisWithLabelMessenger.hh"
40
41
42
43RadmonDataAnalysisWithLabelMessenger *        RadmonDataAnalysisWithLabelMessenger :: Instance(void)
44{
45 if (instance==0)
46 {
47  instance=new RadmonDataAnalysisWithLabelMessenger;
48 
49  if (!instance)
50   G4Exception("RadmonDataAnalysisWithLabelMessenger::Instance: RadmonDataAnalysisWithLabelMessenger singleton not allocated.");
51 }   
52 
53 return instance;
54}
55
56
57
58
59 
60void                                            RadmonDataAnalysisWithLabelMessenger :: AddAvailableDataAnalysis(const G4String & name)
61{
62 availableDataAnalyses.insert(name);
63}
64
65
66
67void                                            RadmonDataAnalysisWithLabelMessenger :: RemoveAvailableDataAnalysis(const G4String & name)
68{
69 availableDataAnalyses.erase(name);
70}
71
72
73
74
75
76                                                RadmonDataAnalysisWithLabelMessenger :: RadmonDataAnalysisWithLabelMessenger()
77:
78 RadmonMessenger(COMMANDS_PATH, "Interactive labelled analysis data factory commands."),
79 RADMON_INITIALIZE_COMMAND(Dump)
80{
81 RADMON_CREATE_COMMAND_0ARGS(Dump, "Print out the current analysis data constructors");
82}
83
84
85
86                                                RadmonDataAnalysisWithLabelMessenger :: ~RadmonDataAnalysisWithLabelMessenger()
87{
88 RADMON_DESTROY_COMMAND(Dump);
89}
90
91
92
93
94
95G4String                                        RadmonDataAnalysisWithLabelMessenger :: GetCurrentValue(G4UIcommand * /* command */)
96{
97 G4cout << "RadmonDataAnalysisWithLabelMessenger::GetCurrentValue(): Not supported" << G4endl;
98 
99 return G4String();
100}
101
102
103
104void                                            RadmonDataAnalysisWithLabelMessenger :: SetNewValue(G4UIcommand * command, G4String newValue)
105{
106 RADMON_BEGIN_LIST_SET_COMMANDS
107  RADMON_SET_COMMAND(Dump)
108 RADMON_END_LIST_SET_COMMANDS
109}
110
111
112
113
114
115// Events
116void                                            RadmonDataAnalysisWithLabelMessenger :: OnDump(const G4String & /* value */)
117{
118 G4String indent("- ");
119 
120 G4String indent2(indent);
121 indent2.prepend("  ");
122 
123 G4cout << indent << "Available analysis data:\n";
124 
125 AvailableDataAnalyses::const_iterator i(availableDataAnalyses.begin());
126 AvailableDataAnalyses::const_iterator end(availableDataAnalyses.end());
127 
128 if (i==end)
129  G4cout << indent2 << "No analysis data available.\n";
130 else
131 {
132  while (i!=end)
133  {
134   G4cout << indent2 << (*i) << '\n';
135   i++;
136  }
137 }
138 
139 G4cout << G4endl;
140}
141
142
143
144
145
146RadmonDataAnalysisWithLabelMessenger *        RadmonDataAnalysisWithLabelMessenger :: instance(0);
Note: See TracBrowser for help on using the repository browser.