|
UniSet
2.6.0
|
00001 /* 00002 * Copyright (c) 2015 Pavel Vainerman. 00003 * 00004 * This program is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU Lesser General Public License as 00006 * published by the Free Software Foundation, version 2.1. 00007 * 00008 * This program is distributed in the hope that it will be useful, but 00009 * WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Lesser Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public License 00014 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00015 */ 00016 // -------------------------------------------------------------------------- 00020 // -------------------------------------------------------------------------- 00021 #ifndef ObjectIndex_Array_H_ 00022 #define ObjectIndex_Array_H_ 00023 // -------------------------------------------------------------------------- 00024 #include <string> 00025 #include <unordered_map> 00026 #include <ostream> 00027 #include "UniSetTypes.h" 00028 #include "Exceptions.h" 00029 #include "ObjectIndex.h" 00030 // -------------------------------------------------------------------------- 00031 namespace uniset 00032 { 00038 class ObjectIndex_Array: 00039 public ObjectIndex 00040 { 00041 public: 00042 ObjectIndex_Array(const ObjectInfo* objectInfo); 00043 virtual ~ObjectIndex_Array(); 00044 00045 virtual const ObjectInfo* getObjectInfo( const ObjectId ) const noexcept override; 00046 virtual const ObjectInfo* getObjectInfo( const std::string& name ) const noexcept override; 00047 virtual ObjectId getIdByName( const std::string& name ) const noexcept override; 00048 virtual std::string getMapName( const ObjectId id ) const noexcept override; 00049 virtual std::string getTextName( const ObjectId id ) const noexcept override; 00050 00051 virtual std::ostream& printMap(std::ostream& os) const noexcept override; 00052 friend std::ostream& operator<<(std::ostream& os, ObjectIndex_Array& oi ); 00053 00054 private: 00055 00056 size_t numOfObject; 00057 typedef std::unordered_map<std::string, ObjectId> MapObjectKey; 00058 MapObjectKey::iterator MapObjectKeyIterator; 00059 MapObjectKey mok; 00060 const ObjectInfo* objectInfo; 00061 size_t maxId; 00062 }; 00063 // ----------------------------------------------------------------------------------------- 00064 } // end of namespace 00065 // ----------------------------------------------------------------------------------------- 00066 #endif
1.7.6.1