ECCE @ EIC Software
Reference for
ECCE @ EIC
simulation and reconstruction software on GitHub
Home page
Related Pages
Modules
Namespaces
Classes
Files
External Links
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
G4GenericMessenger.hh
Go to the documentation of this file.
Or view
the newest version in sPHENIX GitHub for file G4GenericMessenger.hh
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
//
27
//
28
29
#ifndef G4GenericMessenger_h
30
#define G4GenericMessenger_h 1
31
32
#include "
G4UImessenger.hh
"
33
#include "
G4UIcommand.hh
"
34
#include "
G4AnyType.hh
"
35
#include "
G4AnyMethod.hh
"
36
#include "
G4ApplicationState.hh
"
37
38
#include <map>
39
#include <vector>
40
41
class
G4UIdirectory
;
42
44
45
class
G4GenericMessenger
:
public
G4UImessenger
46
{
47
public
:
49
G4GenericMessenger
(
void
* obj,
const
G4String
&
dir
=
""
,
const
G4String
& doc =
""
);
51
virtual
~G4GenericMessenger
();
53
virtual
G4String
GetCurrentValue
(
G4UIcommand
* command);
55
virtual
void
SetNewValue
(
G4UIcommand
* command,
G4String
newValue);
56
57
public
:
58
struct
Command
{
59
enum
UnitSpec
{
UnitCategory
,
UnitDefault
};
60
Command
(
G4UIcommand
* cmd,
const
std::type_info& ti) : command(cmd),
type
(&ti) {}
61
Command
() : command(0),
type
(0) {}
62
// Command& operator =(const Command& rhs) { command = rhs.command; type = rhs.type; }
63
Command
&
SetStates
(
G4ApplicationState
s0
) {command->
AvailableForStates
(s0);
return
*
this
;}
64
Command
&
SetStates
(
G4ApplicationState
s0
,
G4ApplicationState
s1
) {command->
AvailableForStates
(s0, s1);
return
*
this
;}
65
Command
&
SetStates
(
G4ApplicationState
s0
,
G4ApplicationState
s1
,
G4ApplicationState
s2){command->
AvailableForStates
(s0,s1,s2);
return
*
this
;}
66
Command
&
SetStates
(
G4ApplicationState
s0
,
G4ApplicationState
s1
,
G4ApplicationState
s2,
G4ApplicationState
s3) {command->
AvailableForStates
(s0,s1,s2,s3);
return
*
this
;}
67
Command
&
SetStates
(
G4ApplicationState
s0
,
G4ApplicationState
s1
,
G4ApplicationState
s2,
G4ApplicationState
s3,
G4ApplicationState
s4) {command->
AvailableForStates
(s0,s1,s2,s3,s4);
return
*
this
;}
68
Command
&
SetRange
(
const
G4String
& range) {command->
SetRange
(range.c_str());
return
*
this
;}
69
Command
&
SetGuidance
(
const
G4String
&
s0
) { command->
SetGuidance
(s0);
return
*
this
; }
70
Command
&
SetUnit
(
const
G4String
&,
UnitSpec
=
UnitDefault
);
71
Command
&
SetUnitCategory
(
const
G4String
&
u
) {
return
SetUnit
(u,
UnitCategory
);}
72
Command
&
SetDefaultUnit
(
const
G4String
&
u
) {
return
SetUnit
(u,
UnitDefault
);}
73
Command
&
SetParameterName
(
const
G4String
&,
G4bool
,
G4bool
=
false
);
74
Command
&
SetDefaultValue
(
const
G4String
&);
75
Command
&
SetCandidates
(
const
G4String
&);
76
Command
&
SetToBeBroadcasted
(
G4bool
s0
) { command->
SetToBeBroadcasted
(s0);
return
*
this
; }
77
Command
&
SetToBeFlushed
(
G4bool
s0
) { command->
SetToBeFlushed
(s0);
return
*
this
; }
78
Command
&
SetWorkerThreadOnly
(
G4bool
s0
) { command->
SetWorkerThreadOnly
(s0);
return
*
this
; }
79
80
G4UIcommand
*
command
;
81
const
std::type_info*
type
;
82
};
83
struct
Property
:
public
Command
{
84
Property
(
const
G4AnyType
& var,
G4UIcommand
* cmd) :
Command
(cmd, var.TypeInfo()) ,
variable
(var) {}
85
Property
() {}
86
G4AnyType
variable
;
87
};
88
struct
Method
:
public
Command
{
89
Method
(
const
G4AnyMethod
& fun,
void
* obj,
G4UIcommand
* cmd) :
Command
(cmd, fun.ArgType()),
method
(fun),
object
(obj) {}
90
Method
() :
object
(0) {}
91
G4AnyMethod
method
;
92
void
*
object
;
93
};
94
96
Command
&
DeclareProperty
(
const
G4String
&
name
,
const
G4AnyType
&
variable
,
const
G4String
& doc =
""
);
97
Command
&
DeclarePropertyWithUnit
98
(
const
G4String
&
name
,
const
G4String
& defaultUnit,
const
G4AnyType
&
variable
,
const
G4String
& doc =
""
);
99
Command
&
DeclareMethod
(
const
G4String
&
name
,
const
G4AnyMethod
& fun,
const
G4String
& doc =
""
);
100
Command
&
DeclareMethodWithUnit
101
(
const
G4String
&
name
,
const
G4String
& defaultUnit,
const
G4AnyMethod
& fun,
const
G4String
& doc =
""
);
102
void
SetDirectory
(
const
G4String
&
dir
) {
directory
=
dir
;}
103
void
SetGuidance
(
const
G4String
&
s
);
104
105
private
:
106
std::map<G4String, Property>
properties
;
107
std::map<G4String, Method>
methods
;
108
G4UIdirectory
*
dircmd
;
109
G4String
directory
;
110
void
*
object
;
111
};
112
113
114
#endif
115
geant4
tree
geant4-10.6-release
source
intercoms
include
G4GenericMessenger.hh
Built by
Jin Huang
. updated:
Wed Jun 29 2022 17:25:21
using
1.8.2 with
ECCE GitHub integration