UniSet  2.7.0
ObjectIndex.h
1 /*
2  * Copyright (c) 2015 Pavel Vainerman.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, version 2.1.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Lesser Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 // --------------------------------------------------------------------------
20 // --------------------------------------------------------------------------
21 #ifndef ObjcetIndex_H_
22 #define ObjcetIndex_H_
23 // --------------------------------------------------------------------------
24 #include <ostream>
25 #include <string>
26 #include "UniSetTypes.h"
27 // --------------------------------------------------------------------------
28 namespace uniset
29 {
32  {
33  public:
34  ObjectIndex() {}
35  virtual ~ObjectIndex() {}
36 
37  // info
38  // \return nullptr if not found
39  virtual const ObjectInfo* getObjectInfo( const uniset::ObjectId ) const noexcept = 0;
40  virtual const ObjectInfo* getObjectInfo( const std::string& name ) const noexcept = 0;
41 
42  static std::string getBaseName( const std::string& fname ) noexcept;
43 
44  // object id
45 
47  virtual ObjectId getIdByName(const std::string& name) const noexcept = 0;
48 
50  virtual std::string getNameById( const uniset::ObjectId id ) const noexcept;
51 
52  // node
54  std::string getNodeName( const uniset::ObjectId id ) const noexcept;
55 
57  ObjectId getNodeId( const std::string& name ) const noexcept;
58 
59  // src name
61  virtual std::string getMapName( const uniset::ObjectId id ) const noexcept = 0;
63  virtual std::string getTextName( const uniset::ObjectId id ) const noexcept = 0;
64 
65  //
66  virtual std::ostream& printMap(std::ostream& os) const noexcept = 0;
67 
68  void initLocalNode( const uniset::ObjectId nodeid ) noexcept;
69 
70  protected:
71  std::string nmLocalNode = {""}; // поле для оптимизации получения LocalNode
72 
73  private:
74 
75  };
76 
77 
78  // -----------------------------------------------------------------------------------------
79 } // end of namespace
80 // -----------------------------------------------------------------------------------------
81 #endif
Definition: CallbackTimer.h:29
virtual std::string getNameById(const uniset::ObjectId id) const noexcept
Definition: ObjectIndex.cc:32
Definition: ObjectIndex.h:31
virtual std::string getTextName(const uniset::ObjectId id) const noexcept=0
virtual std::string getMapName(const uniset::ObjectId id) const noexcept=0
ObjectId getNodeId(const std::string &name) const noexcept
Definition: ObjectIndex.cc:42
virtual ObjectId getIdByName(const std::string &name) const noexcept=0
Definition: UniSetTypes.h:153
std::string getNodeName(const uniset::ObjectId id) const noexcept
Definition: ObjectIndex.cc:37
long ObjectId
Definition: UniSetTypes_i.idl:30