blob: d33a20e1f30e87920fb04e8809514f2e2113df40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#pragma once
#include "../base/assert.hpp"
#include "../std/vector.hpp"
#include "../std/map.hpp"
#include "../std/iostream.hpp"
class IndexAndTypeMapping
{
vector<uint32_t> m_types;
typedef map<uint32_t, uint32_t> MapT;
MapT m_map;
void Add(uint32_t ind, uint32_t type);
public:
void Load(istream & s);
uint32_t GetType(uint32_t ind) const
{
ASSERT_LESS ( ind, m_types.size(), () );
return m_types[ind];
}
uint32_t GetIndex(uint32_t t) const
{
MapT::const_iterator i = m_map.find(t);
ASSERT ( i != m_map.end(), () );
return i->second;
}
};
|