Geant4 11.1.1
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VisListManager< T > Class Template Reference

#include <G4VisListManager.hh>

Public Member Functions

 G4VisListManager ()
 
virtual ~G4VisListManager ()
 
void Register (T *ptr)
 
void SetCurrent (const G4String &name)
 
const T * Current () const
 
const std::map< G4String, T * > & Map () const
 
void Print (std::ostream &ostr, const G4String &name="") const
 

Detailed Description

template<typename T>
class G4VisListManager< T >

Definition at line 42 of file G4VisListManager.hh.

Constructor & Destructor Documentation

◆ G4VisListManager()

template<typename T >
G4VisListManager< T >::G4VisListManager

Definition at line 72 of file G4VisListManager.hh.

73 :fpCurrent(0)
74{}

◆ ~G4VisListManager()

template<typename T >
G4VisListManager< T >::~G4VisListManager
virtual

Definition at line 77 of file G4VisListManager.hh.

78{
79 typename std::map<G4String, T*>::iterator iter = fMap.begin();
80
81 while (iter != fMap.end()) {
82 delete iter->second;
83 iter++;
84 }
85}

Member Function Documentation

◆ Current()

template<typename T >
const T * G4VisListManager< T >::Current ( ) const
inline

Definition at line 57 of file G4VisListManager.hh.

57{return fpCurrent;}

◆ Map()

template<typename T >
const std::map< G4String, T * > & G4VisListManager< T >::Map

Definition at line 148 of file G4VisListManager.hh.

149{
150 return fMap;
151}

◆ Print()

template<typename T >
void G4VisListManager< T >::Print ( std::ostream &  ostr,
const G4String name = "" 
) const

Definition at line 116 of file G4VisListManager.hh.

117{
118 if (0 == fMap.size()) {
119 G4cout<<" None"<<std::endl;
120 return;
121 }
122
123 ostr<<" Current: "<<fpCurrent->Name()<<std::endl;
124
125 if (!name.empty()) {
126 // Print out specified object
127 typename std::map<G4String, T*>::const_iterator iter = fMap.find(name);
128
129 if (iter != fMap.end()) {
130 iter->second->Print(ostr);
131 }
132 else {
133 ostr<<name<<" not found "<<std::endl;
134 }
135 }
136 else {
137 typename std::map<G4String, T*>::const_iterator iter = fMap.begin();
138 while (iter != fMap.end()) {
139 iter->second->Print(ostr);
140 ostr<<std::endl;
141 iter++;
142 }
143 }
144}
G4GLOB_DLL std::ostream G4cout
const char * name(G4int ptype)

◆ Register()

template<typename T >
void G4VisListManager< T >::Register ( T *  ptr)

Definition at line 89 of file G4VisListManager.hh.

90{
91 assert (0 != ptr);
92
93 // Add to map. Replace if name the same.
94 fMap[ptr->Name()] = ptr;
95 fpCurrent = ptr;
96}

◆ SetCurrent()

template<typename T >
void G4VisListManager< T >::SetCurrent ( const G4String name)

Definition at line 100 of file G4VisListManager.hh.

101{
102 typename std::map<G4String, T*>::const_iterator iter = fMap.find(name);
103
104 if (iter != fMap.end()) fpCurrent = fMap[name];
105 else {
107 ed << "Key \"" << name << "\" has not been registered";
109 ("G4VisListManager<T>::SetCurrent(T* ptr) ",
110 "visman0102", JustWarning, ed, "Non-existent name");
111 }
112}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40

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