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 void SetVal(T val) 00071 { 00072 for (int i = 0; i < m_data.size(); i++) 00073 { 00074 for (int j = 0; j < m_data[i].size(); j++) 00075 { 00076 m_data[i][j] = val; 00077 } 00078 } 00079 } 00080 }; 00081 00082 00083 template <typename T> 00084 class DllExport vector3d 00085 { 00086 private: 00087 00088 std::vector< vector2d<T> > m_data; 00089 00090 public: 00091 vector3d() {}; 00092 00093 vector3d(int i_x1, int i_x2, int i_x3) 00094 { 00095 for (int i = 0; i < i_x1; i++) 00096 { 00097 m_data.push_back(vector2d<T> (i_x2, i_x3)); 00098 } 00099 } 00100 00101 inline vector2d<T> & operator[] (int i) { return m_data[i]; } 00102 inline const vector2d<T> & operator[] (int i) const { return m_data[i]; } 00103 00104 00105 void resize(int i_x1, int i_x2, int i_x3) 00106 { 00107 int i; 00108 m_data.resize(i_x1); 00109 00110 for (i = 0; i < i_x1; i++) 00111 { 00112 m_data[i].resize(i_x2, i_x3); 00113 } 00114 } 00115 00116 void SetVal(T val) 00117 { 00118 for (int i = 0; i < m_data.size(); i++) 00119 { 00120 m_data[i].SetVal(val); 00121 } 00122 } 00123 };