Geant4-11
Public Types | Public Member Functions | Protected Attributes | Private Attributes
G4FastList< OBJECT >::Watcher Class Reference

#include <G4FastList.hh>

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

Public Types

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

Public Member Functions

Priority GetPriority () const
 
virtual G4String GetWatcherName ()
 
virtual void NotifyAddObject (OBJECT *, G4FastList< OBJECT > *)
 
void NotifyDeletingList (G4FastList< OBJECT > *)
 
virtual void NotifyRemoveObject (OBJECT *, G4FastList< OBJECT > *)
 
void StopWatching (G4FastList< OBJECT > *fastList, bool removeWatcher=true)
 
void Watch (G4FastList< OBJECT > *fastList)
 
 Watcher ()
 
virtual ~Watcher ()
 

Protected Attributes

Priority fPriority
 

Private Attributes

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

Detailed Description

template<class OBJECT>
class G4FastList< OBJECT >::Watcher

Definition at line 232 of file G4FastList.hh.

Member Typedef Documentation

◆ list

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

Definition at line 244 of file G4FastList.hh.

Member Enumeration Documentation

◆ Priority

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

Definition at line 235 of file G4FastList.hh.

Constructor & Destructor Documentation

◆ Watcher()

template<class OBJECT >
G4FastList< OBJECT >::Watcher::Watcher ( )
inline

Definition at line 246 of file G4FastList.hh.

247 {
248 fPriority = Priority::eVeryLow;
249 }

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

◆ ~Watcher()

template<class OBJECT >
virtual G4FastList< OBJECT >::Watcher::~Watcher ( )
inlinevirtual

Definition at line 251 of file G4FastList.hh.

252 {
253 typename std::set<G4FastList<OBJECT>*>::iterator it = fWatching.begin();
254 typename std::set<G4FastList<OBJECT>*>::iterator end = fWatching.end();
255 for(;it!=end;it++)
256 {
257 (*it)->RemoveWatcher(this);
258 }
259 }
std::set< G4FastList< OBJECT > * > fWatching
Definition: G4FastList.hh:298
iterator end()
G4FastList_iterator< OBJECT > iterator
Definition: G4FastList.hh:321

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

Member Function Documentation

◆ GetPriority()

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

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 ( )
inlinevirtual

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

Definition at line 261 of file G4FastList.hh.

261 {
262 return "";
263 }

◆ NotifyAddObject()

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

Definition at line 274 of file G4FastList.hh.

274{;}

◆ NotifyDeletingList()

template<class OBJECT >
void G4FastList< OBJECT >::Watcher::NotifyDeletingList ( G4FastList< OBJECT > *  )
inline

Definition at line 271 of file G4FastList.hh.

271{;}

◆ NotifyRemoveObject()

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

Definition at line 275 of file G4FastList.hh.

275{;}

◆ StopWatching()

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

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 }
void RemoveWatcher(Watcher *watcher)
Definition: G4FastList.hh:343

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)
inline

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

◆ fPriority

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

◆ fWatching

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

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