Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VInteractiveSession Class Reference

#include <G4VInteractiveSession.hh>

+ Inheritance diagram for G4VInteractiveSession:

Classes

struct  OutputStyle
 

Public Member Functions

 G4VInteractiveSession ()
 
virtual ~G4VInteractiveSession ()
 
virtual void AddMenu (const char *, const char *)
 
virtual void AddButton (const char *, const char *, const char *)
 
virtual void AddIcon (const char *, const char *, const char *, const char *)
 
virtual void DefaultIcons (bool)
 
virtual void SetOutputStyle (const char *, const char *)
 
virtual void NativeMenu (bool)
 
virtual void ClearMenu ()
 
virtual void UpdateSceneTree (const G4SceneTreeItem &)
 
void AddInteractor (G4String, G4Interactor)
 
G4Interactor GetInteractor (G4String)
 
const std::map< G4String, OutputStyle > & GetOutputStyles () const
 

Protected Member Functions

void SetStyleUtility (const G4String &destination, const G4String &style)
 

Protected Attributes

std::map< G4String, OutputStylefOutputStyles
 

Detailed Description

Definition at line 45 of file G4VInteractiveSession.hh.

Constructor & Destructor Documentation

◆ G4VInteractiveSession()

G4VInteractiveSession::G4VInteractiveSession ( )

Definition at line 33 of file G4VInteractiveSession.cc.

◆ ~G4VInteractiveSession()

G4VInteractiveSession::~G4VInteractiveSession ( )
virtual

Definition at line 36 of file G4VInteractiveSession.cc.

36{ delete messenger; }

Member Function Documentation

◆ AddButton()

void G4VInteractiveSession::AddButton ( const char * ,
const char * ,
const char *  )
virtual

Reimplemented in G4UIQt, G4UIWin32, and G4UIXm.

Definition at line 42 of file G4VInteractiveSession.cc.

42{}

◆ AddIcon()

void G4VInteractiveSession::AddIcon ( const char * ,
const char * ,
const char * ,
const char *  )
virtual

Reimplemented in G4UIQt.

Definition at line 48 of file G4VInteractiveSession.cc.

48{}

◆ AddInteractor()

void G4VInteractiveSession::AddInteractor ( G4String a_name,
G4Interactor a_interactor )

Definition at line 67 of file G4VInteractiveSession.cc.

68{
69 interactors[a_name] = a_interactor;
70}

Referenced by G4UIQt::AddMenu(), G4UIWin32::AddMenu(), G4UIXm::AddMenu(), and G4UIWin32::G4UIWin32().

◆ AddMenu()

void G4VInteractiveSession::AddMenu ( const char * ,
const char *  )
virtual

Reimplemented in G4UIQt, G4UIWin32, and G4UIXm.

Definition at line 39 of file G4VInteractiveSession.cc.

39{}

◆ ClearMenu()

void G4VInteractiveSession::ClearMenu ( )
virtual

Reimplemented in G4UIQt.

Definition at line 61 of file G4VInteractiveSession.cc.

61{}

◆ DefaultIcons()

void G4VInteractiveSession::DefaultIcons ( bool )
virtual

Reimplemented in G4UIQt.

Definition at line 45 of file G4VInteractiveSession.cc.

45{}

◆ GetInteractor()

G4Interactor G4VInteractiveSession::GetInteractor ( G4String a_name)

Definition at line 73 of file G4VInteractiveSession.cc.

74{
75 G4interactor_map::iterator it;
76 if ((it = interactors.find(a_name)) == interactors.end()) return nullptr;
77 return (*it).second;
78}

Referenced by G4UIQt::AddButton(), G4UIWin32::AddButton(), and G4UIXm::AddButton().

◆ GetOutputStyles()

const std::map< G4String, G4VInteractiveSession::OutputStyle > & G4VInteractiveSession::GetOutputStyles ( ) const

Definition at line 82 of file G4VInteractiveSession.cc.

83{
84 return fOutputStyles;
85}
std::map< G4String, OutputStyle > fOutputStyles

◆ NativeMenu()

void G4VInteractiveSession::NativeMenu ( bool )
virtual

Reimplemented in G4UIQt.

Definition at line 58 of file G4VInteractiveSession.cc.

58{}

◆ SetOutputStyle()

void G4VInteractiveSession::SetOutputStyle ( const char * ,
const char *  )
virtual

Reimplemented in G4UIQt.

Definition at line 51 of file G4VInteractiveSession.cc.

52{
53 G4Exception("G4VInteractiveSession::SetOutputStyle", "uiqt0001", JustWarning,
54 "This type of session does not support output styles.");
55}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)

◆ SetStyleUtility()

void G4VInteractiveSession::SetStyleUtility ( const G4String & destination,
const G4String & style )
protected

Definition at line 87 of file G4VInteractiveSession.cc.

88{
89 G4String destinationG4(destination);
90 G4String styleG4(style);
91
92 // Lambda expression for changing styles
93 const auto& setStyle = [&](const G4String& dest) {
94 auto& styleForThisDestination = fOutputStyles[dest];
95 if (styleG4 == "fixed") {
96 styleForThisDestination.fixed = true;
97 }
98 else if (styleG4 == "proportional") {
99 styleForThisDestination.fixed = false;
100 }
101 else if (styleG4 == "bold") {
102 styleForThisDestination.bold = true;
103 }
104 else if (styleG4 == "plain") {
105 styleForThisDestination.bold = false;
106 styleForThisDestination.highlight = false;
107 }
108 else if (styleG4 == "highlight") {
109 styleForThisDestination.highlight = true;
110 }
111 };
112
113 // Here is where the lambda expression is used
114 if (destinationG4 == "all") {
115 for (auto& i : fOutputStyles) {
116 setStyle(i.first);
117 }
118 }
119 else {
120 if (fOutputStyles.find(destinationG4) != fOutputStyles.end()) {
121 setStyle(destinationG4);
122 }
123 else { // Shouldn't happen, but...
125 ed << "Unrecognised output destination \"" << destinationG4 << '"';
126 G4Exception("G4VInteractiveSession::SetStyleUtility", "uiqt0002", JustWarning, ed);
127 }
128 }
129}
std::ostringstream G4ExceptionDescription

Referenced by G4UIQt::SetOutputStyle().

◆ UpdateSceneTree()

void G4VInteractiveSession::UpdateSceneTree ( const G4SceneTreeItem & )
virtual

Reimplemented in G4UIQt.

Definition at line 64 of file G4VInteractiveSession.cc.

64{}

Referenced by G4VViewer::UpdateGUISceneTree().

Member Data Documentation

◆ fOutputStyles

std::map<G4String,OutputStyle> G4VInteractiveSession::fOutputStyles
protected
Initial value:
{
{"cout",{true,false,true}},
{"cerr",{true,true,true}},
{"warn",{true,false,true}},
{"error",{true,true,true}},
{"debug",{true,false,true}}}

Definition at line 70 of file G4VInteractiveSession.hh.

70 {
71 {"cout",{true,false,true}},
72 {"cerr",{true,true,true}},
73 {"warn",{true,false,true}},
74 {"error",{true,true,true}},
75 {"debug",{true,false,true}}};

Referenced by GetOutputStyles(), G4UIQt::ReceiveG4cerr(), G4UIQt::ReceiveG4cout(), G4UIQt::ReceiveG4debug(), and SetStyleUtility().


The documentation for this class was generated from the following files: