33 #ifndef G4MANYFASTLISTS_HH_ 34 #define G4MANYFASTLISTS_HH_ 39 template<
class OBJECT>
45 template<
class OBJECT>
53 typedef std::set<typename G4FastList<OBJECT>::Watcher*,
61 fAssociatedLists(), fMainListWatchers(0)
69 fAssociatedLists.
pop(__list);
74 if(fMainListWatchers == 0)
81 fMainListWatchers->insert(watcher);
86 for(;it != _end ;++it)
96 if (__list == 0)
return;
101 if(fMainListWatchers == 0)
return;
103 typename WatcherSet::iterator it_watcher = fMainListWatchers->begin();
104 typename WatcherSet::iterator end_watcher = fMainListWatchers->end();
110 for(;it_watcher != end_watcher ;++it_watcher)
115 (*it_watcher)->Watch(__list);
118 if(__list->
empty() ==
false)
120 it_watcher = fMainListWatchers->begin();
122 for(;it_watcher != end_watcher ;++it_watcher)
125 for(;it_obj != __list->
end() ;++it_obj)
131 (*it_watcher)->NotifyAddObject(*it_obj,__list);
154 if (__list == 0)
return;
155 fAssociatedLists.
pop(__list);
159 typename WatcherSet::iterator it = fMainListWatchers->begin();
160 typename WatcherSet::iterator _end = fMainListWatchers->end();
162 for(;it != _end ;++it)
164 (*it)->StopWatching(__list);
175 inline bool Holds(OBJECT* __track)
const 179 for (; __it != __end; __it++)
180 if ((*__it)->Holds(__track))
return true;
191 for (; __it != __end; __it++)
193 __size += (*__it)->size();
202 for (; __it != __end; __it++)
221 fAssociatedLists.
clear();
228 for (; __it != __end; __it++)
229 if (*__it) (*__it)->clear();
232 inline iterator
begin();
233 inline iterator
end();
238 template<
class OBJECT>
253 fIterator(), fLists(0)
261 ManyLists* __lists) :
262 fIterator(__x), fCurrentListIt(__it), fLists(__lists)
267 fIterator(__x.fIterator),
268 fCurrentListIt(__x.fCurrentListIt),
280 return *fCurrentListIt;
300 _Self UpdateToNextValidList();
316 if (fCurrentListIt == fLists->
begin())
318 if (fIterator == (*fCurrentListIt)->begin())
325 if (fCurrentListIt == fLists->
end())
328 fIterator = (*fCurrentListIt)->end();
330 else if (fIterator == (*fCurrentListIt)->begin())
333 fIterator = (*fCurrentListIt)->end();
338 while (((*fCurrentListIt)->empty() || fIterator.
GetNode() == 0
340 && fCurrentListIt != fLists->
begin())
342 fIterator = (*fCurrentListIt)->begin();
344 fIterator = (*fCurrentListIt)->end();
348 if (fIterator.
GetNode() == 0 && fCurrentListIt == fLists->
begin())
375 if (fLists->
empty() ==
false)
377 fIterator = (*(fLists->
end()--))->end();
386 template<
class OBJECT>
404 if (*it && (*it)->empty() ==
false)
406 trackList_it = (*it)->begin();
424 template<
class OBJECT>
439 #include "G4ManyFastLists.icc"
G4ManyFastLists_iterator _Self
bool operator==(const HepRotation &r, const HepLorentzRotation <)
virtual void NotifyDeletingList(G4FastList< OBJECT > *__list)
G4ManyFastLists< OBJECT > * GetTrackList()
void Add(G4FastList< OBJECT > *__list)
G4ManyFastLists_iterator()
G4ManyFastLists_iterator(G4FastList_iterator< OBJECT > __x, typename ManyLists::iterator __it, ManyLists *__lists)
WatcherSet * fMainListWatchers
G4GLOB_DLL std::ostream G4cout
ManyLists::iterator fCurrentListIt
virtual G4String GetWatcherName()
bool Holds(OBJECT *__track) const
bool operator==(const _Self &__x) const
bool operator!=(const _Self &__x) const
ManyLists fAssociatedLists
G4FastListNode< OBJECT > _Node
G4FastList< G4FastList< OBJECT > > ManyLists
G4ManyFastLists_iterator< OBJECT > iterator
virtual ~G4ManyFastLists()
void Remove(G4FastList< OBJECT > *__list)
void SetListNode(G4FastListNode< G4FastList< OBJECT > > *__node)
const OBJECT * operator->() const
std::set< typename G4FastList< OBJECT >::Watcher *, sortWatcher< OBJECT > > WatcherSet
void push_back(OBJECT *__track)
void RemoveWatcher(Watcher *watcher)
const OBJECT * operator*() const
G4ManyFastLists_iterator(const G4ManyFastLists_iterator &__x)
void StopWatching(G4FastList< OBJECT > *fastList, bool removeWatcher=true)
G4FastList_iterator< OBJECT > fIterator
void Watch(G4FastList< OBJECT > *fastList)
G4FastList< G4FastList< OBJECT > > ManyLists
void AddGlobalWatcher(typename G4FastList< OBJECT >::Watcher *watcher)