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

#include <G4VisFilterManager.hh>

Public Types

typedef G4VFilter< T > Filter
 
typedef G4VModelFactory< FilterFactory
 

Public Member Functions

 G4VisFilterManager (const G4String &)
 
virtual ~G4VisFilterManager ()
 
void Register (Filter *)
 
void Register (Factory *)
 
bool Accept (const T &)
 
G4String Placement () const
 
void SetMode (const FilterMode::Mode &)
 
void SetMode (const G4String &)
 
FilterMode::Mode GetMode () const
 
void Print (std::ostream &ostr, const G4String &name="") const
 
const std::vector< Filter * > & FilterList () const
 
const std::vector< Factory * > & FactoryList () const
 

Detailed Description

template<typename T>
class G4VisFilterManager< T >

Definition at line 46 of file G4VisFilterManager.hh.

Member Typedef Documentation

◆ Factory

template<typename T >
G4VModelFactory<Filter> G4VisFilterManager< T >::Factory

Definition at line 57 of file G4VisFilterManager.hh.

◆ Filter

template<typename T >
G4VFilter<T> G4VisFilterManager< T >::Filter

Definition at line 56 of file G4VisFilterManager.hh.

Constructor & Destructor Documentation

◆ G4VisFilterManager()

template<typename T >
G4VisFilterManager< T >::G4VisFilterManager ( const G4String & placement)

Definition at line 93 of file G4VisFilterManager.hh.

94 :fPlacement(placement)
95{
96 fMode = FilterMode::Hard;
97}

◆ ~G4VisFilterManager()

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

Definition at line 100 of file G4VisFilterManager.hh.

101{
102 // Cleanup
103 std::vector<G4UImessenger*>::iterator iterMsgr = fMessengerList.begin();
104
105 while (iterMsgr != fMessengerList.end()) {
106 delete *iterMsgr;
107 iterMsgr++;
108 }
109
110 typename std::vector<Factory*>::iterator iterFactory = fFactoryList.begin();
111
112 while (iterFactory != fFactoryList.end()) {
113 delete *iterFactory;
114 iterFactory++;
115 }
116
117 typename std::vector<Filter*>::iterator iterFilter = fFilterList.begin();
118
119 while (iterFilter != fFilterList.end()) {
120 delete *iterFilter;
121 iterFilter++;
122 }
123}

Member Function Documentation

◆ Accept()

template<typename T >
bool G4VisFilterManager< T >::Accept ( const T & obj)

Definition at line 143 of file G4VisFilterManager.hh.

144{
145 typename std::vector<Filter*>::const_iterator iter = fFilterList.begin();
146 bool passed(true);
147
148 while (passed && (iter != fFilterList.end())) {
149 passed = (*iter)->Accept(obj);
150 iter++;
151 }
152
153 return passed;
154}

Referenced by G4VisManager::FilterDigi(), G4VisManager::FilterHit(), and G4VisManager::FilterTrajectory().

◆ FactoryList()

template<typename T >
const std::vector< G4VModelFactory< G4VFilter< T > > * > & G4VisFilterManager< T >::FactoryList ( ) const

Definition at line 237 of file G4VisFilterManager.hh.

238{
239 return fFactoryList;
240}

◆ FilterList()

template<typename T >
const std::vector< G4VFilter< T > * > & G4VisFilterManager< T >::FilterList ( ) const

Definition at line 230 of file G4VisFilterManager.hh.

231{
232 return fFilterList;
233}

◆ GetMode()

template<typename T >
FilterMode::Mode G4VisFilterManager< T >::GetMode ( ) const

Definition at line 191 of file G4VisFilterManager.hh.

192{
193 return fMode;
194}

Referenced by G4VisManager::DispatchToModel().

◆ Placement()

template<typename T >
G4String G4VisFilterManager< T >::Placement ( ) const

Definition at line 158 of file G4VisFilterManager.hh.

159{
160 return fPlacement;
161}

Referenced by G4VisManager::RegisterMessengers().

◆ Print()

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

Definition at line 198 of file G4VisFilterManager.hh.

199{
200 ostr<<"Registered filter factories:"<<std::endl;
201 typename std::vector<Factory*>::const_iterator iterFactory = fFactoryList.begin();
202
203 while (iterFactory != fFactoryList.end()) {
204 (*iterFactory)->Print(ostr);
205 iterFactory++;
206 }
207
208 if (0 == fFactoryList.size()) ostr<<" None"<<std::endl;
209
210 ostr<<std::endl;
211 ostr<<"Registered filters:"<<std::endl;
212
213 typename std::vector<Filter*>::const_iterator iterFilter = fFilterList.begin();
214
215 while (iterFilter != fFilterList.end()) {
216 if (!name.empty()) {
217 if ((*iterFilter)->Name() == name) (*iterFilter)->PrintAll(ostr);
218 }
219 else {
220 (*iterFilter)->PrintAll(ostr);
221 }
222 iterFilter++;
223 }
224
225 if (0 == fFilterList.size()) ostr<<" None"<<std::endl;
226}
const char * name(G4int ptype)

◆ Register() [1/2]

template<typename T >
void G4VisFilterManager< T >::Register ( Factory * factory)

Definition at line 134 of file G4VisFilterManager.hh.

135{
136 fFactoryList.push_back(factory);
137
138 fMessengerList.push_back(new G4VisCommandModelCreate<Factory>(factory, fPlacement));
139}

◆ Register() [2/2]

template<typename T >
void G4VisFilterManager< T >::Register ( Filter * filter)

◆ SetMode() [1/2]

template<typename T >
void G4VisFilterManager< T >::SetMode ( const FilterMode::Mode & mode)

Definition at line 184 of file G4VisFilterManager.hh.

185{
186 fMode = mode;
187}

◆ SetMode() [2/2]

template<typename T >
void G4VisFilterManager< T >::SetMode ( const G4String & mode)

Definition at line 165 of file G4VisFilterManager.hh.

166{
167 bool result(false);
168
169 G4String myMode = G4StrUtil::to_lower_copy(mode);
170
171 if (myMode == "soft") {result = true; SetMode(FilterMode::Soft);}
172 else if (myMode == "hard") {result = true; SetMode(FilterMode::Hard);}
173
174 if (!result) {
176 ed << "Invalid Filter mode: "<<mode;
178 ("G4VisFilterManager::SetMode(const G4String& mode)", "visman0101", JustWarning, ed);
179 }
180}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
void SetMode(const FilterMode::Mode &)

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