Panda3D
Loading...
Searching...
No Matches
indexRemapper.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file indexRemapper.h
10 * @author drose
11 * @date 2000-08-05
12 */
13
14#ifndef INDEXREMAPPER_H
15#define INDEXREMAPPER_H
16
17#include "dtoolbase.h"
18
19#include <map>
20
21/**
22 * This class manages a mapping of integers to integers. It's used in this
23 * package to resequence some or all of the index numbers in the database to a
24 * different sequence.
25 *
26 * This class is just a wrapper around STL map. The only reason it exists is
27 * because Microsoft can't export STL map outside of the DLL.
28 */
29class EXPCL_INTERROGATEDB IndexRemapper {
30public:
31 IndexRemapper();
32 ~IndexRemapper();
33
34 void clear();
35 void add_mapping(int from, int to);
36
37 bool in_map(int from) const;
38 int map_from(int from) const;
39
40private:
41 std::map<int, int> _map_int;
42};
43
44#endif
bool in_map(int from) const
Returns true if the given 'from' integer has been assigned a mapping, false if it has not.
void add_mapping(int from, int to)
Adds a mapping from the integer 'from' to 'to'.
void clear()
Removes all mappings from the object.
int map_from(int from) const
Returns the integer that the given 'from' integer had been set to map to, or the same integer if noth...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.