Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages
sparse3d.h
00001 /* 00002 Sparse 3-D matrix. 00003 Copyright (C) 1998-2001 by Jorrit Tyberghein 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Library General Public 00007 License as published by the Free Software Foundation; either 00008 version 2 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Library General Public License for more details. 00014 00015 You should have received a copy of the GNU Library General Public 00016 License along with this library; if not, write to the Free 00017 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 */ 00019 00020 #ifndef __CS_SPARSE3D_H__ 00021 #define __CS_SPARSE3D_H__ 00022 00023 #include "csextern.h" 00024 00029 class CS_CSUTIL_EXPORT csSparse3D 00030 { 00031 public: 00033 csSparse3D () { } 00035 virtual ~csSparse3D () { } 00036 00038 virtual void Clear () = 0; 00039 00041 virtual void Set (int x, int y, int z, void* obj) = 0; 00042 00044 virtual void* Get (int x, int y, int z) = 0; 00045 00047 virtual void Del (int x, int y, int z) = 0; 00048 }; 00049 00063 class CS_CSUTIL_EXPORT csWideSparse3D : public csSparse3D 00064 { 00065 private: 00067 struct SparseCell 00068 { 00069 int z; 00070 void* obj; 00071 SparseCell* next, * prev; 00072 }; 00074 struct HdY 00075 { 00076 HdY () { first_z = 0; } 00077 int y; 00078 HdY* next, * prev; 00079 SparseCell* first_z; 00080 }; 00082 struct HdX 00083 { 00084 HdX () { first_y = 0; } 00085 int x; 00086 HdX* next, * prev; 00087 HdY* first_y; 00088 }; 00089 00091 HdX* first_x; 00093 HdX* get_header_x (int x); 00095 HdY* get_header_y (HdX* y_list, int y); 00097 SparseCell* get_cell_z (HdY* z_list, int z); 00098 00099 public: 00101 csWideSparse3D (); 00103 virtual ~csWideSparse3D (); 00104 00106 virtual void Clear (); 00107 00109 virtual void Set (int x, int y, int z, void* obj); 00110 00112 virtual void* Get (int x, int y, int z); 00113 00115 virtual void Del (int x, int y, int z); 00116 }; 00117 00118 #endif // __CS_SPARSE3D_H__
Generated for Crystal Space by doxygen 1.3.9.1