Geant4-11
Public Types | Public Member Functions | Protected Types | Protected Attributes | Private Attributes
G4ManyFastLists< OBJECT > Class Template Reference

#include <G4ManyFastLists.hh>

Inheritance diagram for G4ManyFastLists< OBJECT >:
G4FastList< OBJECT >::Watcher

Public Types

typedef G4ManyFastLists_iterator< OBJECT > iterator
 
typedef G4FastList< OBJECT > list
 
enum  Priority {
  eExtreme , eHigh , eNormal , eLow ,
  eVeryLow
}
 

Public Member Functions

void Add (G4FastList< OBJECT > *__list)
 
void AddGlobalWatcher (typename G4FastList< OBJECT >::Watcher *watcher)
 
iterator begin ()
 
void ClearLists ()
 
iterator end ()
 
 G4ManyFastLists ()
 
Priority GetPriority () const
 
virtual G4String GetWatcherName ()
 
bool Holds (OBJECT *__track) const
 
virtual void NotifyAddObject (OBJECT *, G4FastList< OBJECT > *)
 
virtual void NotifyDeletingList (G4FastList< OBJECT > *__list)
 
virtual void NotifyRemoveObject (OBJECT *, G4FastList< OBJECT > *)
 
void pop (OBJECT *)
 
void Remove (G4FastList< OBJECT > *__list)
 
void RemoveLists ()
 
size_t size () const
 
void StopWatching (G4FastList< OBJECT > *fastList, bool removeWatcher=true)
 
void Watch (G4FastList< OBJECT > *fastList)
 
virtual ~G4ManyFastLists ()=default
 

Protected Types

typedef G4FastList< G4FastList< OBJECT > > ManyLists
 
typedef std::set< typename G4FastList< OBJECT >::Watcher *, sortWatcher< OBJECT > > WatcherSet
 

Protected Attributes

ManyLists fAssociatedLists
 
WatcherSetfMainListWatchers
 
Priority fPriority
 

Private Attributes

std::set< G4FastList< OBJECT > * > fWatching
 

Detailed Description

template<class OBJECT>
class G4ManyFastLists< OBJECT >

Definition at line 45 of file G4ManyFastLists.hh.

Member Typedef Documentation

◆ iterator

template<class OBJECT >
typedef G4ManyFastLists_iterator<OBJECT> G4ManyFastLists< OBJECT >::iterator

Definition at line 57 of file G4ManyFastLists.hh.

◆ list

template<class OBJECT >
typedef G4FastList<OBJECT> G4FastList< OBJECT >::Watcher::list
inherited

Definition at line 244 of file G4FastList.hh.

◆ ManyLists

template<class OBJECT >
typedef G4FastList<G4FastList<OBJECT> > G4ManyFastLists< OBJECT >::ManyLists
protected

Definition at line 48 of file G4ManyFastLists.hh.

◆ WatcherSet

template<class OBJECT >
typedef std::set<typename G4FastList<OBJECT>::Watcher*, sortWatcher<OBJECT> > G4ManyFastLists< OBJECT >::WatcherSet
protected

Definition at line 53 of file G4ManyFastLists.hh.

Member Enumeration Documentation

◆ Priority

template<class OBJECT >
enum G4FastList::Watcher::Priority
inherited
Enumerator
eExtreme 
eHigh 
eNormal 
eLow 
eVeryLow 

Definition at line 235 of file G4FastList.hh.

Constructor & Destructor Documentation

◆ G4ManyFastLists()

template<class OBJECT >
G4ManyFastLists< OBJECT >::G4ManyFastLists ( )
inline

Definition at line 59 of file G4ManyFastLists.hh.

◆ ~G4ManyFastLists()

template<class OBJECT >
virtual G4ManyFastLists< OBJECT >::~G4ManyFastLists ( )
virtualdefault

Member Function Documentation

◆ Add()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::Add ( G4FastList< OBJECT > *  __list)
inline

Definition at line 91 of file G4ManyFastLists.hh.

92 {
93 if (__list == 0) return;
94 fAssociatedLists.push_back(__list); // TODO use the table doubling tech
95 //__list->AddWatcher(this);
96 this->Watch(__list);
97
98 if(fMainListWatchers == 0) return;
99
100 typename WatcherSet::iterator it_watcher = fMainListWatchers->begin();
101 typename WatcherSet::iterator end_watcher = fMainListWatchers->end();
102
103// G4cout << "G4ManyFastLists::Add -- N watchers ="
104// << fMainListWatchers->size()
105// << G4endl;
106
107 for(;it_watcher != end_watcher ;++it_watcher)
108 {
109// G4cout << " *** *** *** WATCH --- "
110// << (*it_watcher)->GetWatcherName()
111// << G4endl;
112 (*it_watcher)->Watch(__list);
113 }
114
115 if(__list->empty() == false)
116 {
117 it_watcher = fMainListWatchers->begin();
118
119 for(;it_watcher != end_watcher ;++it_watcher)
120 {
121 typename G4FastList<OBJECT>::iterator it_obj = __list->begin();
122 for(;it_obj != __list->end() ;++it_obj)
123 {
124// G4cout << " *** *** *** NOTIFY ADD OBJ --- "
125// << (*it_watcher)->GetWatcherName()
126// << G4endl;
127
128 (*it_watcher)->NotifyAddObject(*it_obj,__list);
129 }
130 }
131 }
132// else
133// {
134// G4cout << "__list->empty() == true" << G4endl;
135// }
136
137 /*
138 typename ManyLists::const_iterator __it = fAssociatedLists
139 .begin();
140 typename ManyLists::const_iterator __end = fAssociatedLists
141 .end();
142 for (; __it != __end; __it++)
143 {
144 assert(*__it);
145 }
146 */
147 }
void Watch(G4FastList< OBJECT > *fastList)
Definition: G4FastList.hh:280
iterator begin()
bool empty() const
iterator end()
void push_back(OBJECT *__track)

References G4FastList< OBJECT >::begin(), G4FastList< OBJECT >::empty(), G4FastList< OBJECT >::end(), G4ManyFastLists< OBJECT >::fAssociatedLists, G4ManyFastLists< OBJECT >::fMainListWatchers, G4FastList< OBJECT >::push_back(), and G4FastList< OBJECT >::Watcher::Watch().

Referenced by PriorityList::NewMainList(), and PriorityList::PushToListOfSecondaries().

◆ AddGlobalWatcher()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::AddGlobalWatcher ( typename G4FastList< OBJECT >::Watcher watcher)
inline

Definition at line 71 of file G4ManyFastLists.hh.

72 {
73 if(fMainListWatchers == nullptr)
74 {
76 }
77
78 fMainListWatchers->insert(watcher);
79
82
83 for(;it != _end ;++it)
84 {
85 watcher->Watch(*it);
86// (*it)->AddWatcher(watcher);
87// (*it)->AddWatcher(watcher);
88 }
89 }
G4FastList_iterator< G4FastList< OBJECT > > iterator
Definition: G4FastList.hh:321
std::set< typename G4FastList< OBJECT >::Watcher *, sortWatcher< OBJECT > > WatcherSet

References G4FastList< OBJECT >::begin(), G4FastList< OBJECT >::end(), G4ManyFastLists< OBJECT >::fAssociatedLists, G4ManyFastLists< OBJECT >::fMainListWatchers, and G4FastList< OBJECT >::Watcher::Watch().

Referenced by G4ITTrackHolder::AddWatcherForMainList().

◆ begin()

template<class OBJECT >
G4ManyFastLists< OBJECT >::iterator G4ManyFastLists< OBJECT >::begin
inline

Definition at line 371 of file G4ManyFastLists.hh.

372 {
374 {
378 }
379
380 typename G4FastList<OBJECT>::iterator trackList_it;
381 int i = 0;
382
384 typename ManyLists::iterator _end = fAssociatedLists.end();
385
386 while (it != _end)
387 {
388 if (*it && (*it)->empty() == false)
389 {
390 trackList_it = (*it)->begin();
391 break;
392 }
393 i++;
394 it++;
395 };
396
397 if (i == fAssociatedLists.size() || it == _end)
398 {
399 return end();
400 }
401
402 return G4ManyFastLists_iterator<OBJECT>(trackList_it,
403// fAssociatedLists.begin(),
404 it,
406 }
G4int size() const
Definition: G4FastList.hh:357

Referenced by G4ITStepProcessor::ComputeInteractionLength(), and G4Scheduler::EndTracking().

◆ ClearLists()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::ClearLists ( )
inline

Definition at line 217 of file G4ManyFastLists.hh.

218 {
220 typename ManyLists::iterator __end = fAssociatedLists.end();
221 for (; __it != __end; __it++)
222 if (*__it) (*__it)->clear();
223 }

References G4FastList< OBJECT >::begin(), G4FastList< OBJECT >::end(), and G4ManyFastLists< OBJECT >::fAssociatedLists.

Referenced by G4ITTrackHolder::Clear().

◆ end()

template<class OBJECT >
G4ManyFastLists< OBJECT >::iterator G4ManyFastLists< OBJECT >::end
inline

◆ GetPriority()

template<class OBJECT >
Priority G4FastList< OBJECT >::Watcher::GetPriority ( ) const
inlineinherited

Definition at line 265 of file G4FastList.hh.

265 {
266 return fPriority;
267 }

References G4FastList< OBJECT >::Watcher::fPriority.

Referenced by sortWatcher< OBJECT >::operator()().

◆ GetWatcherName()

template<class OBJECT >
virtual G4String G4FastList< OBJECT >::Watcher::GetWatcherName ( )
inlinevirtualinherited

Reimplemented in G4FastList< OBJECT >::TWatcher< WATCHER_TYPE >.

Definition at line 261 of file G4FastList.hh.

261 {
262 return "";
263 }

◆ Holds()

template<class OBJECT >
bool G4ManyFastLists< OBJECT >::Holds ( OBJECT *  __track) const
inline

Definition at line 172 of file G4ManyFastLists.hh.

173 {
176 for (; __it != __end; __it++)
177 if ((*__it)->Holds(__track)) return true;
178 return false;
179 }
G4FastList_const_iterator< G4FastList< OBJECT > > const_iterator
Definition: G4FastList.hh:322

References G4FastList< OBJECT >::begin(), G4FastList< OBJECT >::end(), and G4ManyFastLists< OBJECT >::fAssociatedLists.

◆ NotifyAddObject()

template<class OBJECT >
virtual void G4FastList< OBJECT >::Watcher::NotifyAddObject ( OBJECT *  ,
G4FastList< OBJECT > *   
)
inlinevirtualinherited

Definition at line 274 of file G4FastList.hh.

274{;}

◆ NotifyDeletingList()

template<class OBJECT >
virtual void G4ManyFastLists< OBJECT >::NotifyDeletingList ( G4FastList< OBJECT > *  __list)
inlinevirtual

Definition at line 66 of file G4ManyFastLists.hh.

67 {
68 fAssociatedLists.pop(__list);
69 }
iterator pop(OBJECT *)

References G4ManyFastLists< OBJECT >::fAssociatedLists, and G4FastList< OBJECT >::pop().

◆ NotifyRemoveObject()

template<class OBJECT >
virtual void G4FastList< OBJECT >::Watcher::NotifyRemoveObject ( OBJECT *  ,
G4FastList< OBJECT > *   
)
inlinevirtualinherited

Definition at line 275 of file G4FastList.hh.

275{;}

◆ pop()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::pop ( OBJECT *  )

◆ Remove()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::Remove ( G4FastList< OBJECT > *  __list)
inline

Definition at line 149 of file G4ManyFastLists.hh.

150 {
151 if (__list == 0) return;
152 fAssociatedLists.pop(__list); // TODO use the table doubling tech
153 __list->RemoveWatcher(this);
154 this->StopWatching(__list);
155
156 typename WatcherSet::iterator it = fMainListWatchers->begin();
157 typename WatcherSet::iterator _end = fMainListWatchers->end();
158
159 for(;it != _end ;++it)
160 {
161 (*it)->StopWatching(__list);
162 }
163
164// typename ManyLists::node* __node = __list->GetListNode();
165// if(__node)
166// {
167// __list->SetListNode(0);
168// delete __node;
169// }
170 }
void StopWatching(G4FastList< OBJECT > *fastList, bool removeWatcher=true)
Definition: G4FastList.hh:286
void RemoveWatcher(Watcher *watcher)
Definition: G4FastList.hh:343

References G4ManyFastLists< OBJECT >::fAssociatedLists, G4ManyFastLists< OBJECT >::fMainListWatchers, G4FastList< OBJECT >::pop(), G4FastList< OBJECT >::RemoveWatcher(), and G4FastList< OBJECT >::Watcher::StopWatching().

Referenced by G4ManyFastLists< OBJECT >::RemoveLists().

◆ RemoveLists()

template<class OBJECT >
void G4ManyFastLists< OBJECT >::RemoveLists ( )
inline

Definition at line 191 of file G4ManyFastLists.hh.

192 {
194 typename ManyLists::iterator __end = fAssociatedLists.end();
195 for (; __it != __end; __it++)
196 {
197 if (*__it)
198 {
199 (*__it)->clear();
200 typename ManyLists::iterator next = __it;
201 next++;
202 Remove(*__it);
203 typename ManyLists::node* __node = __it.GetNode();
204 if(__node)
205 {
206 __node->GetObject()->SetListNode(0);
207 delete __node;
208 }
209// delete (*__it);
210
211 __it = next;
212 }
213 }
215 }
OBJECT * GetObject()
Definition: G4FastList.hh:152
void clear()
G4FastListNode< G4FastList< OBJECT > > node
Definition: G4FastList.hh:323
void Remove(G4FastList< OBJECT > *__list)

References G4FastList< OBJECT >::begin(), G4FastList< OBJECT >::clear(), G4FastList< OBJECT >::end(), G4ManyFastLists< OBJECT >::fAssociatedLists, G4FastList_iterator< OBJECT >::GetNode(), G4FastListNode< OBJECT >::GetObject(), and G4ManyFastLists< OBJECT >::Remove().

Referenced by G4ITTrackHolder::Clear(), G4ITTrackHolder::MoveMainToWaitingList(), and G4ITTrackHolder::~G4ITTrackHolder().

◆ size()

template<class OBJECT >
size_t G4ManyFastLists< OBJECT >::size ( ) const
inline

Definition at line 181 of file G4ManyFastLists.hh.

182 {
183 size_t __size(0);
184 for (auto __it : fAssociatedLists)
185 {
186 __size += __it->size();
187 }
188 return __size;
189 }

References G4ManyFastLists< OBJECT >::fAssociatedLists.

Referenced by G4ITStepProcessor::DoIt(), and G4ITTrackHolder::GetNTracks().

◆ StopWatching()

template<class OBJECT >
void G4FastList< OBJECT >::Watcher::StopWatching ( G4FastList< OBJECT > *  fastList,
bool  removeWatcher = true 
)
inlineinherited

Definition at line 286 of file G4FastList.hh.

287 {
288 typename std::set<G4FastList<OBJECT>*>::iterator it = fWatching.find(fastList);
289 if(it == fWatching.end()) return; //TODO: exception?
290 fWatching.erase(it);
291 if(removeWatcher) fastList->RemoveWatcher(this);
292 }
std::set< G4FastList< OBJECT > * > fWatching
Definition: G4FastList.hh:298

References G4FastList< OBJECT >::Watcher::fWatching, and G4FastList< OBJECT >::RemoveWatcher().

Referenced by G4ManyFastLists< OBJECT >::Remove().

◆ Watch()

template<class OBJECT >
void G4FastList< OBJECT >::Watcher::Watch ( G4FastList< OBJECT > *  fastList)
inlineinherited

Definition at line 280 of file G4FastList.hh.

281 {
282 fWatching.insert(fastList);
283 fastList->AddWatcher(this);
284 }
void AddWatcher(Watcher *watcher)
Definition: G4FastList.hh:338

References G4FastList< OBJECT >::AddWatcher(), and G4FastList< OBJECT >::Watcher::fWatching.

Referenced by G4ManyFastLists< OBJECT >::Add(), and G4ManyFastLists< OBJECT >::AddGlobalWatcher().

Field Documentation

◆ fAssociatedLists

template<class OBJECT >
ManyLists G4ManyFastLists< OBJECT >::fAssociatedLists
protected

◆ fMainListWatchers

template<class OBJECT >
WatcherSet* G4ManyFastLists< OBJECT >::fMainListWatchers
protected

◆ fPriority

template<class OBJECT >
Priority G4FastList< OBJECT >::Watcher::fPriority
protectedinherited

◆ fWatching

template<class OBJECT >
std::set<G4FastList<OBJECT>*> G4FastList< OBJECT >::Watcher::fWatching
privateinherited

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