Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 43 of file G4VisListManager.hh.

Constructor & Destructor Documentation

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

Definition at line 73 of file G4VisListManager.hh.

74  :fpCurrent(0)
75 {}
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 }

Member Function Documentation

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

Definition at line 58 of file G4VisListManager.hh.

58 {return fpCurrent;}
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 }
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 }
G4GLOB_DLL std::ostream G4cout
G4bool isNull() const

Here is the call graph for this function:

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 }
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::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:


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