UniSet 2.32.1
ObjectIndex_hashXML.h
1/*
2 * Copyright (c) 2020 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// --------------------------------------------------------------------------
17#ifndef ObjectIndex_hashXML_H_
18#define ObjectIndex_hashXML_H_
19// --------------------------------------------------------------------------
20#include <unordered_map>
21#include <string>
22#include "ObjectIndex.h"
23#include "UniXML.h"
24// --------------------------------------------------------------------------
25namespace uniset
26{
32 {
33 public:
34 ObjectIndex_hashXML( const std::string& xmlfile );
35 ObjectIndex_hashXML( const std::shared_ptr<UniXML>& xml );
36 virtual ~ObjectIndex_hashXML();
37
38 virtual const uniset::ObjectInfo* getObjectInfo( const uniset::ObjectId ) const noexcept override;
39 virtual const uniset::ObjectInfo* getObjectInfo( const std::string& name ) const noexcept override;
40 virtual uniset::ObjectId getIdByName( const std::string& name ) const noexcept override;
41 virtual std::string getMapName( const uniset::ObjectId id ) const noexcept override;
42 virtual std::string getTextName( const uniset::ObjectId id ) const noexcept override;
43
44 virtual std::ostream& printMap( std::ostream& os ) const noexcept override;
45 friend std::ostream& operator<<(std::ostream& os, ObjectIndex_hashXML& oi );
46
47 protected:
48 void build( const std::shared_ptr<UniXML>& xml );
49 void read_section( const std::shared_ptr<UniXML>& xml, const std::string& sec );
50 void read_nodes( const std::shared_ptr<UniXML>& xml, const std::string& sec );
51
52 private:
53 typedef std::unordered_map<uniset::ObjectId, uniset::ObjectInfo> MapObjects;
54 MapObjects omap;
55
56 typedef std::unordered_map<std::string, uniset::ObjectId> MapObjectKey;
57 MapObjectKey mok; // для обратного писка
58 };
59 // -------------------------------------------------------------------------
60} // end of uniset namespace
61// -----------------------------------------------------------------------------------------
62#endif
Definition ObjectIndex_hashXML.h:32
virtual std::string getTextName(const uniset::ObjectId id) const noexcept override
Definition ObjectIndex_hashXML.cc:77
virtual std::string getMapName(const uniset::ObjectId id) const noexcept override
Definition ObjectIndex_hashXML.cc:63
virtual uniset::ObjectId getIdByName(const std::string &name) const noexcept override
Definition ObjectIndex_hashXML.cc:49
Definition ObjectIndex.h:32
Definition Calibration.h:27
long ObjectId
Definition UniSetTypes_i.idl:30
Definition UniSetTypes.h:156