00001 #ifndef GMATRIX_LIST_H 00002 #define GMATRIX_LIST_H 00003 00004 #include <map> 00005 #include "gmathcore/GObject.h" 00006 #include "gmathcore/GMatrix.h" 00007 #include "io/GError_Output.h" 00008 00009 namespace GMathLib{ 00010 namespace Util{ 00011 00017 class GMatrixList_Manager : public GObject 00018 { 00019 public: 00020 typedef std::map<int, GMatrix*> GMatrixList; 00021 00025 GMatrixList_Manager(); 00026 00031 ~GMatrixList_Manager(); 00032 00044 void Register_Matrix(int id, GMatrix& mx); 00045 00055 GMatrix* Create_Register_Matrix(int id, int row, int column); 00056 00062 void Delete_Matrix(int id); 00063 00070 inline GMatrix* Get_Matrix(int id){ 00071 GMatrixList::iterator itr = matrix_list.find(id); 00072 00073 if(itr == matrix_list.end()){ 00074 std::ostringstream oss; 00075 oss << id; 00076 std::string errorinfo = "Specified id '" + oss.str() +"' is not found in registered IDs."; 00077 IO::GError_Output::Puts(Class_Name() + "::Get_Matrix", errorinfo); 00078 00079 } 00080 00081 return itr->second; 00082 } 00083 00088 GMatrixList Get_List() const{return matrix_list;} 00089 private: 00096 bool register_matrix(int id, GMatrix* p_matrix); 00097 00098 GMatrixList matrix_list; 00099 00100 }; 00101 00102 } 00103 } 00104 #endif