Geant4 9.6.0
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 47 of file G4VisFilterManager.hh.

Member Typedef Documentation

◆ Factory

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

Definition at line 58 of file G4VisFilterManager.hh.

◆ Filter

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

Definition at line 57 of file G4VisFilterManager.hh.

Constructor & Destructor Documentation

◆ G4VisFilterManager()

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

Definition at line 94 of file G4VisFilterManager.hh.

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

◆ ~G4VisFilterManager()

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

Definition at line 101 of file G4VisFilterManager.hh.

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

Member Function Documentation

◆ Accept()

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

Definition at line 144 of file G4VisFilterManager.hh.

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

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

◆ FactoryList()

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

Definition at line 239 of file G4VisFilterManager.hh.

240{
241 return fFactoryList;
242}

◆ FilterList()

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

Definition at line 232 of file G4VisFilterManager.hh.

233{
234 return fFilterList;
235}

◆ GetMode()

template<typename T >
FilterMode::Mode G4VisFilterManager< T >::GetMode

Definition at line 193 of file G4VisFilterManager.hh.

194{
195 return fMode;
196}

Referenced by G4VisManager::DispatchToModel().

◆ Placement()

template<typename T >
G4String G4VisFilterManager< T >::Placement

Definition at line 159 of file G4VisFilterManager.hh.

160{
161 return fPlacement;
162}

Referenced by G4VisManager::RegisterMessengers().

◆ Print()

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

Definition at line 200 of file G4VisFilterManager.hh.

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

◆ Register() [1/2]

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

Definition at line 135 of file G4VisFilterManager.hh.

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

◆ Register() [2/2]

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

Definition at line 128 of file G4VisFilterManager.hh.

129{
130 fFilterList.push_back(filter);
131}

Referenced by G4VisManager::RegisterModel(), and G4VisManager::RegisterModelFactory().

◆ SetMode() [1/2]

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

Definition at line 186 of file G4VisFilterManager.hh.

187{
188 fMode = mode;
189}

◆ SetMode() [2/2]

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

Definition at line 166 of file G4VisFilterManager.hh.

167{
168 bool result(false);
169
170 G4String myMode(mode);
171 myMode.toLower();
172
173 if (myMode == "soft") {result = true; SetMode(FilterMode::Soft);}
174 else if (myMode == "hard") {result = true; SetMode(FilterMode::Hard);}
175
176 if (!result) {
178 ed << "Invalid Filter mode: "<<mode;
180 ("G4VisFilterManager::SetMode(const G4String& mode)", "visman0101", JustWarning, ed);
181 }
182}
@ JustWarning
void SetMode(const FilterMode::Mode &)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
std::ostringstream G4ExceptionDescription
Definition: globals.hh:76

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