Geant4  10.02.p03
G4VisListManager< T > Class Template Reference

#include <G4VisListManager.hh>

Collaboration diagram for G4VisListManager< T >:

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
 

Private Attributes

std::map< G4String, T * > fMap
 
T * fpCurrent
 

Detailed Description

template<typename T>
class G4VisListManager< T >

Definition at line 43 of file G4VisListManager.hh.

Constructor & Destructor Documentation

◆ G4VisListManager()

template<typename T >
G4VisListManager< T >::G4VisListManager ( )

Definition at line 73 of file G4VisListManager.hh.

74  :fpCurrent(0)
75 {}

◆ ~G4VisListManager()

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

Definition at line 78 of file G4VisListManager.hh.

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

Member Function Documentation

◆ Current()

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

Definition at line 58 of file G4VisListManager.hh.

58 {return fpCurrent;}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map()

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

Definition at line 149 of file G4VisListManager.hh.

150 {
151  return fMap;
152 }
std::map< G4String, T * > fMap
Here is the caller graph for this function:

◆ Print()

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

Definition at line 117 of file G4VisListManager.hh.

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

◆ Register()

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

Definition at line 90 of file G4VisListManager.hh.

91 {
92  assert (0 != ptr);
93 
94  // Add to map. Replace if name the same.
95  fMap[ptr->Name()] = ptr;
96  fpCurrent = ptr;
97 }
std::map< G4String, T * > fMap
Here is the caller graph for this function:

◆ SetCurrent()

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

Definition at line 101 of file G4VisListManager.hh.

102 {
103  typename std::map<G4String, T*>::const_iterator iter = fMap.find(name);
104 
105  if (iter != fMap.end()) fpCurrent = fMap[name];
106  else {
108  ed << "Key \"" << name << "\" has not been registered";
110  ("G4VisListManager<T>::SetCurrent(T* ptr) ",
111  "visman0102", JustWarning, ed, "Non-existent name");
112  }
113 }
std::map< G4String, T * > fMap
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ fMap

template<typename T>
std::map<G4String, T*> G4VisListManager< T >::fMap
private

Definition at line 67 of file G4VisListManager.hh.

◆ fpCurrent

template<typename T>
T* G4VisListManager< T >::fpCurrent
private

Definition at line 68 of file G4VisListManager.hh.


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