diff options
author | Campbell Barton <ideasman42@gmail.com> | 2010-11-18 15:54:05 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2010-11-18 15:54:05 +0300 |
commit | 95e7417e0a2ef2b6c813e460ccdf329b6ecc3c0b (patch) | |
tree | d8df59bb7f358c0c274179bd8eef2a60ac8b52a9 /source/kernel | |
parent | da1f288f50238b2205b597f6c421898a97fda061 (diff) |
remove unused classes.
Diffstat (limited to 'source/kernel')
-rw-r--r-- | source/kernel/CMakeLists.txt | 1 | ||||
-rw-r--r-- | source/kernel/gen_system/GEN_DataCache.h | 76 | ||||
-rw-r--r-- | source/kernel/gen_system/GEN_Matrix4x4.cpp | 202 | ||||
-rw-r--r-- | source/kernel/gen_system/GEN_Matrix4x4.h | 76 | ||||
-rw-r--r-- | source/kernel/gen_system/GEN_SmartPtr.h | 233 | ||||
-rw-r--r-- | source/kernel/gen_system/SYS_SingletonSystem.cpp | 2 | ||||
-rw-r--r-- | source/kernel/gen_system/SYS_SingletonSystem.h | 1 |
7 files changed, 1 insertions, 590 deletions
diff --git a/source/kernel/CMakeLists.txt b/source/kernel/CMakeLists.txt index 41e725906c8..8705dbcdc24 100644 --- a/source/kernel/CMakeLists.txt +++ b/source/kernel/CMakeLists.txt @@ -35,7 +35,6 @@ SET(INC SET(SRC gen_messaging/intern/messaging.c gen_system/GEN_HashedPtr.cpp - gen_system/GEN_Matrix4x4.cpp gen_system/SYS_SingletonSystem.cpp gen_system/SYS_System.cpp ) diff --git a/source/kernel/gen_system/GEN_DataCache.h b/source/kernel/gen_system/GEN_DataCache.h deleted file mode 100644 index 96ceafc232d..00000000000 --- a/source/kernel/gen_system/GEN_DataCache.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef __GEN_DATACACHE_H -#define __GEN_DATACACHE_H - -#include "STR_HashedString.h" -#include "GEN_Map.h" - -template <class T> -class GEN_DataCache -{ - GEN_Map<STR_HashedString,T*> m_dataCache; - virtual T* LoadData(const STR_String& name)=0; - virtual void FreeCacheObjects()=0; - -public: - GEN_DataCache() {}; - virtual ~GEN_DataCache() {}; - - T* GetData(const STR_String& paramname) - { - T* result=NULL; - - T** resultptr = m_dataCache[paramname]; - if (resultptr) - { - result = *resultptr; - } - - else - { - result = LoadData(paramname); - if (result) - { - m_dataCache.insert(paramname,result); - } - } - - return result; - } - - virtual void ClearCache() - { - FreeCacheObjects(); - m_dataCache.clear(); - } -}; - -#endif //__GEN_DATACACHE_H - diff --git a/source/kernel/gen_system/GEN_Matrix4x4.cpp b/source/kernel/gen_system/GEN_Matrix4x4.cpp deleted file mode 100644 index 72926ce9c39..00000000000 --- a/source/kernel/gen_system/GEN_Matrix4x4.cpp +++ /dev/null @@ -1,202 +0,0 @@ -/** - * $Id$ - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -#include "GEN_Matrix4x4.h" - -GEN_Matrix4x4::GEN_Matrix4x4() -{ - Identity(); -} - - - -GEN_Matrix4x4::GEN_Matrix4x4(const float value[4][4]) -{ - for (int i=0;i<4;i++) - { - for (int j=0;j<4;j++) - m_V[i][j] = value[i][j]; - } -} - - - -GEN_Matrix4x4::GEN_Matrix4x4(const double value[16]) -{ - for (int i=0;i<16;i++) - m_Vflat[i] = value[i]; -} - - - -GEN_Matrix4x4::GEN_Matrix4x4(const GEN_Matrix4x4& other) -{ - SetMatrix(other); -} - - - -GEN_Matrix4x4::GEN_Matrix4x4(const MT_Point3& orig, - const MT_Vector3& dir, - const MT_Vector3 up) -{ - MT_Vector3 z = -(dir.normalized()); - MT_Vector3 x = (up.cross(z)).normalized(); - MT_Vector3 y = (z.cross(x)); - - m_V[0][0] = x.x(); - m_V[0][1] = y.x(); - m_V[0][2] = z.x(); - m_V[0][3] = 0.0f; - - m_V[1][0] = x.y(); - m_V[1][1] = y.y(); - m_V[1][2] = z.y(); - m_V[1][3] = 0.0f; - - m_V[2][0] = x.z(); - m_V[2][1] = y.z(); - m_V[2][2] = z.z(); - m_V[2][3] = 0.0f; - - m_V[3][0] = orig.x();//0.0f; - m_V[3][1] = orig.y();//0.0f; - m_V[3][2] = orig.z();//0.0f; - m_V[3][3] = 1.0f; - - //Translate(-orig); -} - - - -MT_Vector3 GEN_Matrix4x4::GetRight() const -{ - return MT_Vector3(m_V[0][0], m_V[0][1], m_V[0][2]); -} - - - -MT_Vector3 GEN_Matrix4x4::GetUp() const -{ - return MT_Vector3(m_V[1][0], m_V[1][1], m_V[1][2]); -} - - - -MT_Vector3 GEN_Matrix4x4::GetDir() const -{ - return MT_Vector3(m_V[2][0], m_V[2][1], m_V[2][2]); -} - - - -MT_Point3 GEN_Matrix4x4::GetPos() const -{ - return MT_Point3(m_V[3][0], m_V[3][1], m_V[3][2]); -} - - - -void GEN_Matrix4x4::Identity() -{ - for (int i=0; i<4; i++) - { - for (int j=0; j<4; j++) - m_V[i][j] = (i==j?1.0f:0.0f); - } -} - - - -void GEN_Matrix4x4::SetMatrix(const GEN_Matrix4x4& other) -{ - for (int i=0; i<16; i++) - m_Vflat[i] = other.m_Vflat[i]; -} - - - -double* GEN_Matrix4x4::getPointer() -{ - return &m_V[0][0]; -} - - - -const double* GEN_Matrix4x4::getPointer() const -{ - return &m_V[0][0]; -} - - - -void GEN_Matrix4x4::setElem(int pos,double newvalue) -{ - m_Vflat[pos] = newvalue; -} - - - - - -GEN_Matrix4x4 GEN_Matrix4x4::Perspective(MT_Scalar inLeft, -MT_Scalar inRight, -MT_Scalar inBottom, -MT_Scalar inTop, -MT_Scalar inNear, -MT_Scalar inFar) -{ - - GEN_Matrix4x4 mat; - - // Column 0 - mat(0, 0) = -(2.0*inNear) / (inRight-inLeft); - mat(1, 0) = 0; - mat(2, 0) = 0; - mat(3, 0) = 0; - - // Column 1 - mat(0, 1) = 0; - mat(1, 1) = (2.0*inNear) / (inTop-inBottom); - mat(2, 1) = 0; - mat(3, 1) = 0; - - // Column 2 - mat(0, 2) = (inRight+inLeft) / (inRight-inLeft); - mat(1, 2) = (inTop+inBottom) / (inTop-inBottom); - mat(2, 2) = -(inFar+inNear) / (inFar-inNear); - mat(3, 2) = -1; - - // Column 3 - mat(0, 3) = 0; - mat(1, 3) = 0; - mat(2, 3) = -(2.0*inFar*inNear) / (inFar-inNear); - mat(3, 3) = 0; - - return mat; -} diff --git a/source/kernel/gen_system/GEN_Matrix4x4.h b/source/kernel/gen_system/GEN_Matrix4x4.h deleted file mode 100644 index dede10fd459..00000000000 --- a/source/kernel/gen_system/GEN_Matrix4x4.h +++ /dev/null @@ -1,76 +0,0 @@ -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - */ -#ifndef GEN_MATRIX4X4 -#define GEN_MATRIX4X4 - -#include "MT_Point3.h" - -class GEN_Matrix4x4 -{ -public: - // creators. - GEN_Matrix4x4(); - GEN_Matrix4x4(const float value[4][4]); - GEN_Matrix4x4(const double value[16]); - GEN_Matrix4x4(const GEN_Matrix4x4 & other); - GEN_Matrix4x4(const MT_Point3& orig, - const MT_Vector3& dir, - const MT_Vector3 up); - - void Identity(); - void SetMatrix(const GEN_Matrix4x4 & other); - double* getPointer(); - const double* getPointer() const; - void setElem(int pos,double newvalue); - - - MT_Vector3 GetRight() const; - MT_Vector3 GetUp() const; - MT_Vector3 GetDir() const; - MT_Point3 GetPos() const; - void SetPos(const MT_Vector3 & v); - - double& operator () (int row,int col) { return m_V[col][row]; } - - static GEN_Matrix4x4 Perspective(MT_Scalar inLeft, - MT_Scalar inRight, - MT_Scalar inBottom, - MT_Scalar inTop, - MT_Scalar inNear, - MT_Scalar inFar); -protected: - union - { - double m_V[4][4]; - double m_Vflat[16]; - }; -}; - -#endif //GEN_MATRIX4X4 - diff --git a/source/kernel/gen_system/GEN_SmartPtr.h b/source/kernel/gen_system/GEN_SmartPtr.h deleted file mode 100644 index e1c378d6867..00000000000 --- a/source/kernel/gen_system/GEN_SmartPtr.h +++ /dev/null @@ -1,233 +0,0 @@ -#ifndef NAN_INCLUDED_GEN_SmartPtr_h -#define NAN_INCLUDED_GEN_SmartPtr_h - -/** - * $Id$ - * - * ***** BEGIN GPL LICENSE BLOCK ***** - * - * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. - * All rights reserved. - * - * The Original Code is: all of this file. - * - * Contributor(s): none yet. - * - * ***** END GPL LICENSE BLOCK ***** - * - * @author Laurence - */ - -#include <stdlib.h> // for NULL ! - -/** - * @section GEN_SmartPtr - * This class defines a smart pointer similar to that defined in - * the Standard Template Library but without the painful get() - * semantics to access the internal c style pointer. - * - * It is often useful to explicitely decalre ownership of memory - * allocated on the heap within class or function scope. This - * class helps you to encapsulate this ownership within a value - * type. When an instance of this class goes out of scope it - * makes sure that any memory associated with it's internal pointer - * is deleted. It can help to inform users of an aggregate class - * that it owns instances of it's members and these instances - * should not be shared. This is not reliably enforcable in C++ - * but this class attempts to make the 1-1 relationship clear. - * - * @section Example usage - * - * class foo { - * ...constructors accessors etc. - * int x[1000]; - * } - * - * class bar { - * public : - * static - * bar * - * New( - * ) { - * GEN_SmartPtr<foo> afoo = new foo(); - * GEN_SmartPtr<bar> that = new bar(); - * - * if (foo == NULL || that == NULL) return NULL; - * - * that->m_foo = afoo.Release(); - * return that.Release(); - * } - * - * ~bar() { - * // smart ptr takes care of deletion - * } - * private : - * GEN_SmartPtr<foo> m_foo; - * } - * - * You my also safely construct vectors of GEN_SmartPtrs and - * have the vector own stuff you put into it. - * - * e.g. - * { - * std::vector<GEN_SmartPtr<foo> > foo_vector; - * foo_vector.push_back( new foo()); - * foo_vector.push_back( new foo()); - * - * foo_vector[0]->bla(); - * } // foo_vector out of scope => heap memory freed for both foos - * - * @warning this class should only be used for objects created - * on the heap via the new function. It will not behave correctly - * if you pass ptrs to objects created with new[] nor with - * objects declared on the stack. Doing this is likely to crash - * the program or lead to memory leaks. - */ - -template - < class T > -class GEN_SmartPtr { - -public : - - /** - * Construction from reference - this class - * always assumes ownership from the rhs. - */ - - GEN_SmartPtr( - const GEN_SmartPtr &rhs - ){ - m_val = rhs.Release(); - } - - /** - * Construction from ptr - this class always - * assumes that it now owns the memory associated with the - * ptr. - */ - - GEN_SmartPtr( - T* val - ) : - m_val (val) - { - } - - /** - * Defalut constructor - */ - - GEN_SmartPtr( - ) : - m_val (NULL) - { - } - - /** - * Type conversion from this class to the type - * of a pointer to the template parameter. - * This means you can pass an instance of this class - * to a function expecting a ptr of type T. - */ - - operator T * () const { - return m_val; - } - - /** - * Return a reference to the internal ptr class. - * Use with care when you now that the internal ptr - * is not NULL! - */ - - T & - Ref( - ) const { - return *m_val; - } - - /** - * Assignment operator - ownership is transfered from rhs to lhs. - * There is an intenional side-effect of function of transferring - * ownership from the const parameter rhs. This is to insure - * the 1-1 relationship. - * The object associated with this instance is deleted if it - * is not the same as that contained in the rhs. - */ - - GEN_SmartPtr & operator=( - const GEN_SmartPtr &rhs - ) { - if (this->m_val != rhs.m_val) { - delete this->m_val; - } - - this->m_val = rhs.Release(); - return *this; - } - - /** - * Overload the operator -> so that it's possible to access - * all the normal methods of the internal ptr. - */ - - T * operator->() const { - return m_val; - } - - /** - * Caller takes ownership of the object - the object will not - * be deleted when the ptr goes out of scope. - */ - - T * - Release( - ) const { - T* temp = m_val; - (const_cast<GEN_SmartPtr *>(this))->m_val = NULL; - return temp; - } - - /** - * Force destruction of the internal object. - */ - - void - Delete( - ) { - delete (m_val); - m_val = NULL; - } - - /** - * Destructor - deletes object if it exists - */ - - ~GEN_SmartPtr( - ) { - delete (m_val); - } - -private : - - /// The ptr owned by this class. - T * m_val; -}; - -#endif - diff --git a/source/kernel/gen_system/SYS_SingletonSystem.cpp b/source/kernel/gen_system/SYS_SingletonSystem.cpp index 0b5cfe7273a..52bd3d87470 100644 --- a/source/kernel/gen_system/SYS_SingletonSystem.cpp +++ b/source/kernel/gen_system/SYS_SingletonSystem.cpp @@ -29,7 +29,7 @@ * Used by SYS_System */ #include "SYS_SingletonSystem.h" -#include "GEN_DataCache.h" +// #include "GEN_DataCache.h" SYS_SingletonSystem* SYS_SingletonSystem::_instance = 0; diff --git a/source/kernel/gen_system/SYS_SingletonSystem.h b/source/kernel/gen_system/SYS_SingletonSystem.h index 889838454e7..874f3fa9793 100644 --- a/source/kernel/gen_system/SYS_SingletonSystem.h +++ b/source/kernel/gen_system/SYS_SingletonSystem.h @@ -33,7 +33,6 @@ #include "GEN_Map.h" #include "STR_HashedString.h" -#include "GEN_DataCache.h" class SYS_SingletonSystem { |