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.

00074   :fpCurrent(0) 
00075 {}

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

Definition at line 78 of file G4VisListManager.hh.

00079 {
00080   typename std::map<G4String, T*>::iterator iter = fMap.begin();
00081 
00082   while (iter != fMap.end()) {
00083     delete iter->second;    
00084     iter++;
00085   }
00086 }


Member Function Documentation

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

Definition at line 58 of file G4VisListManager.hh.

Referenced by G4VisModelManager< Model >::Current().

00058 {return fpCurrent;}

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

Definition at line 149 of file G4VisListManager.hh.

00150 {
00151   return fMap;
00152 }

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

Definition at line 117 of file G4VisListManager.hh.

References G4cout, and G4String::isNull().

Referenced by G4VisModelManager< Model >::Print().

00118 {
00119   if (0 == fMap.size()) {
00120     G4cout<<"  None"<<std::endl;
00121     return;
00122   }
00123     
00124   ostr<<"  Current: "<<fpCurrent->Name()<<std::endl;
00125 
00126   if (!name.isNull()) {
00127     // Print out specified object
00128     typename std::map<G4String, T*>::const_iterator iter = fMap.find(name);
00129 
00130     if (iter != fMap.end()) {
00131       iter->second->Print(ostr);
00132     }
00133     else {
00134       ostr<<name<<" not found "<<std::endl;
00135     }
00136   }
00137   else {
00138     typename std::map<G4String, T*>::const_iterator iter = fMap.begin();
00139     while (iter != fMap.end()) {
00140       iter->second->Print(ostr);
00141       ostr<<std::endl;
00142       iter++;
00143     }
00144   }
00145 }

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

Definition at line 90 of file G4VisListManager.hh.

Referenced by G4VisModelManager< Model >::Register().

00091 {
00092   assert (0 != ptr);
00093 
00094   // Add to map.  Replace if name the same.
00095   fMap[ptr->Name()] = ptr;
00096   fpCurrent = ptr;    
00097 }

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

Definition at line 101 of file G4VisListManager.hh.

References G4Exception(), and JustWarning.

Referenced by G4VisModelManager< Model >::SetCurrent().

00102 {
00103   typename std::map<G4String, T*>::const_iterator iter = fMap.find(name);
00104 
00105   if (iter != fMap.end()) fpCurrent = fMap[name];
00106   else {
00107     G4ExceptionDescription ed;
00108     ed << "Key \"" << name << "\" has not been registered";
00109     G4Exception
00110       ("G4VisListManager<T>::SetCurrent(T* ptr) ",
00111        "visman0102", JustWarning, ed, "Non-existent name");
00112   }
00113 }


The documentation for this class was generated from the following file:
Generated on Mon May 27 17:53:47 2013 for Geant4 by  doxygen 1.4.7