00001 #pragma once 00002 00003 #include <vector> 00004 00005 #ifdef WIN32 00006 #if defined _USRDLL 00007 #define DllExport _declspec(dllexport) 00008 #else 00009 #define DllExport _declspec(dllimport) 00010 #endif 00011 #else 00012 #define DllExport 00013 #endif 00014 00038 template <typename T> 00039 class DllExport vector2d 00040 { 00041 private: 00042 00043 std::vector< std::vector<T> > m_data; 00044 00045 public: 00046 vector2d() {}; 00047 00048 vector2d(int i_x1, int i_x2) 00049 { 00050 for (int i = 0; i < i_x1; i++) 00051 { 00052 m_data.push_back(std::vector<T> (i_x2)); 00053 } 00054 } 00055 00056 inline std::vector<T> & operator[] (int i) { return m_data[i]; } 00057 inline const std::vector<T> & operator[] (int i) const { return m_data[i]; } 00058 00059 00060 void resize(int i_x1, int i_x2) 00061 { 00062 m_data.resize(i_x1); 00063 00064 for (int i = 0; i < i_x1; i++) 00065 { 00066 m_data[i].resize(i_x2); 00067 } 00068 } 00069 }; 00070 00071 00072 template <typename T> 00073 class DllExport vector3d 00074 { 00075 private: 00076 00077 std::vector< vector2d<T> > m_data; 00078 00079 public: 00080 vector3d() {}; 00081 00082 vector3d(int i_x1, int i_x2, int i_x3) 00083 { 00084 for (int i = 0; i < i_x1; i++) 00085 { 00086 m_data.push_back(vector2d<T> (i_x2, i_x3)); 00087 } 00088 } 00089 00090 inline vector2d<T> & operator[] (int i) { return m_data[i]; } 00091 inline const vector2d<T> & operator[] (int i) const { return m_data[i]; } 00092 00093 00094 void resize(int i_x1, int i_x2, int i_x3) 00095 { 00096 int i, j; 00097 m_data.resize(i_x1); 00098 00099 for (i = 0; i < i_x1; i++) 00100 { 00101 m_data[i].resize(i_x2); 00102 00103 for (j = 0; j < i_x2; j++) 00104 { 00105 m_data[i][j].resize(i_x3); 00106 } 00107 } 00108 } 00109 };