Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4ManyFastLists< OBJECT > Class Template Reference

#include <G4FastList.hh>

Inheritance diagram for G4ManyFastLists< OBJECT >:
Collaboration diagram for G4ManyFastLists< OBJECT >:

Public Types

typedef
G4ManyFastLists_iterator
< OBJECT > 
iterator
 
- Public Types inherited from G4FastList< OBJECT >::Watcher
enum  Priority {
  eExtreme, eHigh, eNormal, eLow,
  eVeryLow
}
 
typedef G4FastList< OBJECT > list
 

Public Member Functions

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

Protected Types

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

Protected Attributes

ManyLists fAssociatedLists
 
WatcherSetfMainListWatchers
 
- Protected Attributes inherited from G4FastList< OBJECT >::Watcher
Priority fPriority
 

Detailed Description

template<typename OBJECT>
class G4ManyFastLists< OBJECT >

Definition at line 66 of file G4FastList.hh.

Member Typedef Documentation

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

Definition at line 58 of file G4ManyFastLists.hh.

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

Definition at line 49 of file G4ManyFastLists.hh.

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

Definition at line 54 of file G4ManyFastLists.hh.

Constructor & Destructor Documentation

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

Definition at line 60 of file G4ManyFastLists.hh.

template<typename OBJECT>
virtual G4ManyFastLists< OBJECT >::~G4ManyFastLists ( )
inlinevirtual

Definition at line 65 of file G4ManyFastLists.hh.

65 {;}

Member Function Documentation

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

Definition at line 94 of file G4ManyFastLists.hh.

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

Here is the caller graph for this function:

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

Definition at line 72 of file G4ManyFastLists.hh.

73  {
74  if(fMainListWatchers == 0)
75  {
77  }
78 
79  G4cout << watcher->GetWatcherName() << G4endl;
80 
81  fMainListWatchers->insert(watcher);
82 
84  typename ManyLists::iterator _end = fAssociatedLists.end();
85 
86  for(;it != _end ;++it)
87  {
88  watcher->Watch(*it);
89 // (*it)->AddWatcher(watcher);
90 // (*it)->AddWatcher(watcher);
91  }
92  }
iterator end()
G4FastList_iterator< G4FastList< OBJECT > > iterator
Definition: G4FastList.hh:323
WatcherSet * fMainListWatchers
G4GLOB_DLL std::ostream G4cout
ManyLists fAssociatedLists
std::set< typename G4FastList< OBJECT >::Watcher *, sortWatcher< OBJECT > > WatcherSet
#define G4endl
Definition: G4ios.hh:61
iterator begin()

Here is the caller graph for this function:

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

Definition at line 387 of file G4ManyFastLists.hh.

388  {
389  if (fAssociatedLists.empty())
390  {
394  }
395 
396  typename G4FastList<OBJECT>::iterator trackList_it;
397  int i = 0;
398 
400  typename ManyLists::iterator _end = fAssociatedLists.end();
401 
402  while (it != _end)
403  {
404  if (*it && (*it)->empty() == false)
405  {
406  trackList_it = (*it)->begin();
407  break;
408  }
409  i++;
410  it++;
411  };
412 
413  if (i == fAssociatedLists.size() || it == _end)
414  {
415  return end();
416  }
417 
418  return G4ManyFastLists_iterator<OBJECT>(trackList_it,
419 // fAssociatedLists.begin(),
420  it,
422  }
iterator end()
G4FastList_iterator< G4FastList< OBJECT > > iterator
Definition: G4FastList.hh:323
bool empty() const
ManyLists fAssociatedLists
G4int size() const
Definition: G4FastList.hh:359
iterator begin()

Here is the caller graph for this function:

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

Definition at line 224 of file G4ManyFastLists.hh.

225  {
226  typename ManyLists::iterator __it = fAssociatedLists.begin();
227  typename ManyLists::iterator __end = fAssociatedLists.end();
228  for (; __it != __end; __it++)
229  if (*__it) (*__it)->clear();
230  }
iterator end()
G4FastList_iterator< G4FastList< OBJECT > > iterator
Definition: G4FastList.hh:323
ManyLists fAssociatedLists
iterator begin()

Here is the caller graph for this function:

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

Definition at line 425 of file G4ManyFastLists.hh.

Here is the caller graph for this function:

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

Definition at line 175 of file G4ManyFastLists.hh.

176  {
179  for (; __it != __end; __it++)
180  if ((*__it)->Holds(__track)) return true;
181  return false;
182  }
iterator end()
G4FastList_const_iterator< G4FastList< OBJECT > > const_iterator
Definition: G4FastList.hh:324
ManyLists fAssociatedLists
iterator begin()
template<typename OBJECT>
virtual void G4ManyFastLists< OBJECT >::NotifyDeletingList ( G4FastList< OBJECT > *  __list)
inlinevirtual

Definition at line 67 of file G4ManyFastLists.hh.

68  {
69  fAssociatedLists.pop(__list);
70  }
iterator pop(OBJECT *)
ManyLists fAssociatedLists
template<typename OBJECT>
void G4ManyFastLists< OBJECT >::pop ( OBJECT *  )
template<typename OBJECT>
void G4ManyFastLists< OBJECT >::Remove ( G4FastList< OBJECT > *  __list)
inline

Definition at line 152 of file G4ManyFastLists.hh.

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

Here is the caller graph for this function:

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

Definition at line 198 of file G4ManyFastLists.hh.

199  {
200  typename ManyLists::iterator __it = fAssociatedLists.begin();
201  typename ManyLists::iterator __end = fAssociatedLists.end();
202  for (; __it != __end; __it++)
203  {
204  if (*__it)
205  {
206  (*__it)->clear();
207  typename ManyLists::iterator next = __it;
208  next++;
209  Remove(*__it);
210  typename ManyLists::node* __node = __it.GetNode();
211  if(__node)
212  {
213  __node->GetObject()->SetListNode(0);
214  delete __node;
215  }
216 // delete (*__it);
217 
218  __it = next;
219  }
220  }
222  }
iterator end()
G4FastList_iterator< G4FastList< OBJECT > > iterator
Definition: G4FastList.hh:323
void clear()
G4FastListNode< G4FastList< OBJECT > > node
Definition: G4FastList.hh:325
OBJECT * GetObject()
Definition: G4FastList.hh:154
ManyLists fAssociatedLists
void Remove(G4FastList< OBJECT > *__list)
iterator begin()

Here is the caller graph for this function:

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

Definition at line 184 of file G4ManyFastLists.hh.

185  {
186  size_t __size(0);
188  .begin();
190  .end();
191  for (; __it != __end; __it++)
192  {
193  __size += (*__it)->size();
194  }
195  return __size;
196  }
iterator end()
G4FastList_const_iterator< G4FastList< OBJECT > > const_iterator
Definition: G4FastList.hh:324
ManyLists fAssociatedLists
iterator begin()

Here is the caller graph for this function:

Member Data Documentation

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

Definition at line 50 of file G4ManyFastLists.hh.

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

Definition at line 55 of file G4ManyFastLists.hh.


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