diff --git a/src/framework/Makefile.am b/src/framework/Makefile.am index 9a1e8bb06..756f5493e 100644 --- a/src/framework/Makefile.am +++ b/src/framework/Makefile.am @@ -51,9 +51,6 @@ EXTRA_DIST = \ Policies/Singleton.h \ Policies/SingletonImp.h \ Policies/ThreadingModel.h \ - Utilities/CountedReference/Reference.h \ - Utilities/CountedReference/ReferenceHolder.h \ - Utilities/CountedReference/ReferenceImpl.h \ Utilities/LinkedReference/RefManager.h \ Utilities/LinkedReference/Reference.h \ Utilities/ByteConverter.h \ diff --git a/src/framework/Utilities/CountedReference/Reference.h b/src/framework/Utilities/CountedReference/Reference.h deleted file mode 100644 index 8fd513bb5..000000000 --- a/src/framework/Utilities/CountedReference/Reference.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MANGOS_REFERENCE_H -#define MANGOS_REFERENCE_H - -/** - * Referencer - * Referencer is an object that holds a reference holder that hold a reference - * counted object. When an object's reference count drop to zero, it removes - * the object. This is a non intrusive mechanism and any object at any point - * in time can be referenced. When and object is reference counted, do not - * pass the object directly to other methods but rather, pass its - * reference around. Objects can be reference counted in both single threaded - * model and multi-threaded model - */ - -#include -#include "Platform/Define.h" -#include "Policies/ThreadingModel.h" -#include "ReferenceHolder.h" - -template -< -typename T, -class THREADING_MODEL = MaNGOS::SingleThreaded -> -class MANGOS_DLL_DECL Referencer -{ - typedef typename THREADING_MODEL::Lock Lock; - typedef ReferenceHolder ReferenceeHolder; - public: - - /// Constructs a referencer. - Referencer(T *ref = NULL); - - /// Copy constructor - Referencer(const Referencer &obj) : i_holder(NULL) { *this = obj; } - - /// Destructor - ~Referencer(); - - /// Referencee accessor - T* referencee(void) { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - const T* referencee(void) const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - - //T& referencee(void){ return _referencee(); } - //const T& referencee(void) const { return const_cast(this)->_referencee(); } - operator T&(void) { return _referencee(); } - operator const T&(void) const { return *const_cast(this)->_referencee(); } - - /// cast operators - T* operator*() { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - T const * operator*() const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - - /// overload operators - T* operator->() { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - const T * operator->() const { return (i_holder == NULL ? NULL : i_holder->i_referencee); } - - /// operator = - Referencer& operator=(const Referencer &obj); - Referencer& operator=(T *); - - /// returns true if i_referencee is null - bool isNull(void) const { return i_holder == NULL; } - - private: - - T& _referencee(void) - { - if( i_holder == NULL ) - throw std::runtime_error("Invalid access to null pointer"); - return *i_holder->i_referencee; - } - - void deReference(ReferenceeHolder *); - void addReference(ReferenceeHolder *); - - // private data - ReferenceeHolder *i_holder; -}; -#endif diff --git a/src/framework/Utilities/CountedReference/ReferenceHolder.h b/src/framework/Utilities/CountedReference/ReferenceHolder.h deleted file mode 100644 index d0bb2cb3e..000000000 --- a/src/framework/Utilities/CountedReference/ReferenceHolder.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MANGOS_REFERENCEHOLDER_H -#define MANGOS_REFERENCEHOLDER_H - -/** ReferenceHolder holds the actualy referenced obejct as well the refence - count. The ReferenecHolder implements as a policy base object and - will decided by the Reference class to be consnsitent. - */ - -template -< -typename T, -class THREADING_MODEL -> -struct ReferenceHolder : public THREADING_MODEL -{ - explicit ReferenceHolder(T *ref) : i_referencee(ref), i_referenceCount(0) {} - T *i_referencee; - unsigned int i_referenceCount; - typedef typename THREADING_MODEL::Lock Lock; -}; -#endif diff --git a/src/framework/Utilities/CountedReference/ReferenceImpl.h b/src/framework/Utilities/CountedReference/ReferenceImpl.h deleted file mode 100644 index cd0143748..000000000 --- a/src/framework/Utilities/CountedReference/ReferenceImpl.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright (C) 2005-2009 MaNGOS - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef MANGOS_REFERENCEIMPL_H -#define MANGOS_REFERENCEIMPL_H - -#include "Reference.h" - -template -< -typename T, -class THREADING_MODEL -> -Referencer::Referencer(T *ref) -: i_holder(NULL) -{ - if( ref != NULL ) - { - i_holder = new ReferenceeHolder(ref); - ++i_holder->i_referenceCount; - } -} - -template -< -typename T, -class THREADING_MODEL -> -Referencer::~Referencer() -{ - if( i_holder != NULL ) - deReference(i_holder); - i_holder = NULL; -} - -template -< -typename T, -class THREADING_MODEL -> -Referencer& -Referencer::operator=(const Referencer &obj) -{ - if( i_holder != NULL ) - deReference(i_holder); - if( obj.i_holder != NULL ) - addReference(obj.i_holder); - i_holder = obj.i_holder; - return *this; -} - -template -< -typename T, -class THREADING_MODEL -> -Referencer& -Referencer::operator=(T *ref) -{ - if( i_holder != NULL ) - deReference(i_holder); - i_holder = NULL; - if( ref != NULL ) - { - i_holder = new ReferenceeHolder(ref); - ++i_holder->i_referenceCount; - } - - return *this; -} - -template -< -typename T, -class THREADING_MODEL -> -void -Referencer::deReference(ReferenceHolder *holder) -{ - assert( holder != NULL && holder->i_referenceCount > 0); - bool delete_object = false; - - { - // The guard is within the scope due to the guard - // must release earlier than expected. - Lock guard(*holder); - Guard(&guard); - - --holder->i_referenceCount; - if( holder->i_referenceCount == 0 ) - delete_object = true; - } - - if( delete_object ) - { - delete holder->i_referencee; - delete holder; - } -} - -template -< -typename T, -class THREADING_MODEL -> -void -Referencer::addReference(ReferenceHolder *holder) -{ - assert( i_holder != NULL ); - Lock guard(*holder); - Guard(&guard); - - ++holder->i_referenceCount; -} -#endif diff --git a/src/shared/Base.cpp b/src/shared/Base.cpp deleted file mode 100644 index 9929cd41f..000000000 --- a/src/shared/Base.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - Base class interface - Copyright (C) 1998,1999 by Andrew Zabolotny - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#include "Base.h" - -Base::~Base () -{ -} - -/** - * Decrement object's reference count; as soon as the last reference - * to the object is removed, it is destroyed. - */ - -void Base::DecRef () -{ - if (!--RefCount) - delete this; -} - -/** - * Object initialization. The initial reference count is set to one; - * this means if you call DecRef() immediately after creating the object, - * it will be destroyed. - */ -Base::Base () -{ - RefCount = 1; -} - -/** - * Increment reference count. - * Every time when you copy a pointer to a object and store it for - * later use you MUST call IncRef() on it; this will allow to keep - * objects as long as they are referenced by some entity. - */ -void Base::IncRef () -{ - ++RefCount; - -} - -/** - * Query number of references to this object. - * I would rather prefer to have the reference counter strictly private, - * but sometimes, mostly for debugging, such a function can help. - */ -int Base::GetRefCount () -{ - return RefCount; -} diff --git a/src/shared/Base.h b/src/shared/Base.h deleted file mode 100644 index d5907fdf4..000000000 --- a/src/shared/Base.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - Base class interface - Copyright (C) 1998,1999 by Andrew Zabolotny - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef __BASE_H__ -#define __BASE_H__ - -#include "Common.h" - -/** - * This class is intended to be a base class for every other class. - * It defines the basic interface available for any object. - */ -class Base -{ - private: - /// Object reference count - int RefCount; - - protected: - /** - * Destroy this object. Destructor is virtual, because class contains - * virtual methods; also it is private because it is never intended - * to be called directly; use DecRef() instead: when reference counter - * reaches zero, the object will be destroyed. - */ - virtual ~Base (); - - public: - - Base (); - - void IncRef (); - - void DecRef (); - int GetRefCount (); - -}; -#endif // __BASE_H__ diff --git a/src/shared/Makefile.am b/src/shared/Makefile.am index e72c2fbb8..4f5912045 100644 --- a/src/shared/Makefile.am +++ b/src/shared/Makefile.am @@ -30,8 +30,6 @@ noinst_LIBRARIES = libmangosshared.a # libmangosshared library will later be reused by ... libmangosshared_a_SOURCES = \ - Base.cpp \ - Base.h \ ByteBuffer.h \ Common.cpp \ Common.h \ diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 56938ac78..3a2685c5a 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8789" + #define REVISION_NR "8790" #endif // __REVISION_NR_H__ diff --git a/win/VC100/framework.vcxproj b/win/VC100/framework.vcxproj index 90ff8548e..a9532a2be 100644 --- a/win/VC100/framework.vcxproj +++ b/win/VC100/framework.vcxproj @@ -312,9 +312,6 @@ - - - diff --git a/win/VC100/shared.vcxproj b/win/VC100/shared.vcxproj index 27e231e6a..c0e1ef747 100644 --- a/win/VC100/shared.vcxproj +++ b/win/VC100/shared.vcxproj @@ -435,7 +435,6 @@ - @@ -472,7 +471,6 @@ - diff --git a/win/VC80/framework.vcproj b/win/VC80/framework.vcproj index 60c60b7c5..9ccf1a7a9 100644 --- a/win/VC80/framework.vcproj +++ b/win/VC80/framework.vcproj @@ -582,22 +582,6 @@ RelativePath="..\..\src\framework\Utilities\UnorderedMap.h" > - - - - - - - - diff --git a/win/VC80/shared.vcproj b/win/VC80/shared.vcproj index c0991b3bd..0a7a79081 100644 --- a/win/VC80/shared.vcproj +++ b/win/VC80/shared.vcproj @@ -616,14 +616,6 @@ - - - - diff --git a/win/VC90/framework.vcproj b/win/VC90/framework.vcproj index cda4de128..64c0bc5a9 100644 --- a/win/VC90/framework.vcproj +++ b/win/VC90/framework.vcproj @@ -587,22 +587,6 @@ RelativePath="..\..\src\framework\Utilities\UnorderedMap.h" > - - - - - - - - diff --git a/win/VC90/shared.vcproj b/win/VC90/shared.vcproj index b5701f503..65de0fcdd 100644 --- a/win/VC90/shared.vcproj +++ b/win/VC90/shared.vcproj @@ -622,14 +622,6 @@ - - - -