mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[9775] Cleanups in framework library.
* Removed last bits of threading in grid code. * Removed some weird and unneeded declarations. * General code style fixes. * (Perhaps some things I forgot.) Thanks to Lynx3d for the usual GCC-stabbing...
This commit is contained in:
parent
4d89b41f60
commit
7532061a79
25 changed files with 774 additions and 398 deletions
|
|
@ -18,21 +18,24 @@
|
|||
|
||||
#ifndef _REFMANAGER_H
|
||||
#define _REFMANAGER_H
|
||||
|
||||
//=====================================================
|
||||
|
||||
#include "Utilities/LinkedList.h"
|
||||
#include "Utilities/LinkedReference/Reference.h"
|
||||
|
||||
template <class TO, class FROM> class RefManager : public LinkedListHead
|
||||
template <class TO, class FROM>
|
||||
class RefManager : public LinkedListHead
|
||||
{
|
||||
public:
|
||||
typedef LinkedListHead::Iterator< Reference<TO, FROM> > iterator;
|
||||
RefManager() { }
|
||||
|
||||
typedef LinkedListHead::Iterator<Reference<TO, FROM> > iterator;
|
||||
RefManager() {}
|
||||
virtual ~RefManager() { clearReferences(); }
|
||||
|
||||
Reference<TO, FROM>* getFirst() { return ((Reference<TO, FROM>*) LinkedListHead::getFirst()); }
|
||||
Reference<TO, FROM>* getFirst() { return ((Reference<TO, FROM> *) LinkedListHead::getFirst()); }
|
||||
Reference<TO, FROM> const* getFirst() const { return ((Reference<TO, FROM> const*) LinkedListHead::getFirst()); }
|
||||
Reference<TO, FROM>* getLast() { return ((Reference<TO, FROM>*) LinkedListHead::getLast()); }
|
||||
Reference<TO, FROM>* getLast() { return ((Reference<TO, FROM> *) LinkedListHead::getLast()); }
|
||||
Reference<TO, FROM> const* getLast() const { return ((Reference<TO, FROM> const*) LinkedListHead::getLast()); }
|
||||
|
||||
iterator begin() { return iterator(getFirst()); }
|
||||
|
|
@ -43,7 +46,7 @@ template <class TO, class FROM> class RefManager : public LinkedListHead
|
|||
void clearReferences()
|
||||
{
|
||||
LinkedListElement* ref;
|
||||
while((ref = getFirst()) != NULL)
|
||||
while ((ref = getFirst()) != NULL)
|
||||
{
|
||||
((Reference<TO, FROM>*) ref)->invalidate();
|
||||
ref->delink(); // the delink might be already done by invalidate(), but doing it here again does not hurt and insures an empty list
|
||||
|
|
@ -52,4 +55,5 @@ template <class TO, class FROM> class RefManager : public LinkedListHead
|
|||
};
|
||||
|
||||
//=====================================================
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue