|
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 ObjcetIndex_H_ 00022 #define ObjcetIndex_H_ 00023 // -------------------------------------------------------------------------- 00024 #include <ostream> 00025 #include <string> 00026 #include "UniSetTypes.h" 00027 // -------------------------------------------------------------------------- 00028 namespace uniset 00029 { 00030 class ObjectIndex 00031 { 00032 public: 00033 ObjectIndex() {}; 00034 virtual ~ObjectIndex() {}; 00035 00036 // info 00037 // \return nullptr if not found 00038 virtual const ObjectInfo* getObjectInfo( const uniset::ObjectId ) const noexcept = 0; 00039 virtual const ObjectInfo* getObjectInfo( const std::string& name ) const noexcept = 0; 00040 00041 static std::string getBaseName( const std::string& fname ) noexcept; 00042 00043 // object id 00044 00046 virtual ObjectId getIdByName(const std::string& name) const noexcept = 0; 00047 00049 virtual std::string getNameById( const uniset::ObjectId id ) const noexcept; 00050 00051 // node 00053 inline std::string getNodeName( const uniset::ObjectId id ) const noexcept 00054 { 00055 return getNameById(id); 00056 } 00057 00059 inline ObjectId getNodeId( const std::string& name ) const noexcept 00060 { 00061 return getIdByName(name); 00062 } 00063 00064 // src name 00066 virtual std::string getMapName( const uniset::ObjectId id ) const noexcept = 0; 00068 virtual std::string getTextName( const uniset::ObjectId id ) const noexcept = 0; 00069 00070 // 00071 virtual std::ostream& printMap(std::ostream& os) const noexcept = 0; 00072 00073 void initLocalNode( const uniset::ObjectId nodeid ) noexcept; 00074 00075 protected: 00076 std::string nmLocalNode = {""}; // поле для оптимизации получения LocalNode 00077 00078 private: 00079 00080 }; 00081 00082 00083 // ----------------------------------------------------------------------------------------- 00084 } // end of namespace 00085 // ----------------------------------------------------------------------------------------- 00086 #endif
1.7.6.1