00001 /* This file is part of OMCSNetCPP 00002 00003 OMCSNetCPP is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as published by 00005 the Free Software Foundation; either version 2.1 of the License, or 00006 (at your option) any later version. 00007 00008 OMCSNetCPP is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU Lesser General Public License for more details. 00012 00013 You should have received a copy of the GNU Lesser General Public License 00014 along with OMCSNetCPP; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00016 */ 00017 00020 #ifndef _CONCEPT_MAP 00021 00022 #define _CONCEPT_MAP 00023 00024 #include <map> 00025 #include <string> 00026 00027 #include "semantic_id.h" 00028 00029 00030 class CSemanticConcept; 00031 class CTextIDMap; 00032 00034 class CConceptMap 00035 { 00036 public: 00038 bool Load(FILE *a_fp, 00039 CTextIDMap &a_idMap); 00040 00042 bool Save(FILE *a_fp); 00043 00045 CSemanticConcept *Lookup(const SemanticID a_id) 00046 { 00047 CSemanticConceptMap_i i; 00048 00049 i = m_conceptMap.find(a_id); 00050 00051 if (m_conceptMap.end() != i) 00052 { 00053 return (*i).second; 00054 } 00055 00056 return NULL; 00057 } 00058 00060 void Store(CSemanticConcept *a_concept); 00061 00063 u_int GetSize() const 00064 { 00065 return m_conceptMap.size(); 00066 } 00067 00069 CConceptMap() {} 00070 00072 ~CConceptMap() 00073 { 00074 CSemanticConceptMap_i i; 00075 00076 for (i = m_conceptMap.begin();i != m_conceptMap.end(); 00077 ++i) 00078 { 00079 delete (*i).second; 00080 } 00081 } 00082 00083 private: 00085 typedef std::map<SemanticID, CSemanticConcept *> 00086 CSemanticConceptMap; 00088 typedef CSemanticConceptMap::iterator 00089 CSemanticConceptMap_i; 00091 typedef CSemanticConceptMap::const_iterator 00092 CSemanticConceptMap_ci; 00093 00095 CSemanticConceptMap m_conceptMap; 00096 }; 00097 00098 #endif 00099
1.3.3