-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHashTable.h
68 lines (58 loc) · 2.69 KB
/
HashTable.h
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef HASHTABLE_H
#define HASHTABLE_H
#include <vector>
#include "GLData.h"
#include <unordered_map>
//-----------------------------------------------------------------------------
/// @file GLData.h
/// @author Milto Miltiadou
/// @version 1.0
/// @date 04/05/15
/// @class HashTable
/// @brief a hashed table used for quickly finding vertices and sorting the
/// indices of an object
//-----------------------------------------------------------------------------
class HashTable
{
public:
//--------------------------------------------------------------------------
/// @brief default constructor
/// @param[in] i_glData the object that we are interested in a quick way of
/// searching the vertices and sorting the indices
//--------------------------------------------------------------------------
HashTable(GLData *i_glData);
HashTable();
void setGLData(GLData *i_glData);
//--------------------------------------------------------------------------
/// @brief method that returns the index of a given vertex
/// If the vertex does not exist then the vertex is added into the glData
/// @param[in] _vertex is a vertex of the object
/// @returns the index of the given vertex
//--------------------------------------------------------------------------
unsigned int getIndex(const gmtl::Vec3f &i_vertex);
//--------------------------------------------------------------------------
/// @brief default destructor
//--------------------------------------------------------------------------
~HashTable();
private:
//--------------------------------------------------------------------------
/// @brief method that converts a float number to string
/// @param[in] i_number number to be converted
/// @return the string
//--------------------------------------------------------------------------
std::string convert (float i_number);
//--------------------------------------------------------------------------
/// @brief the glData used to store the vertices inside. this is only a
/// pointer to the data, used to avoid copied the data afterwards
//--------------------------------------------------------------------------
GLData *m_glData;
//--------------------------------------------------------------------------
/// @brief the index of the next vertex to be added
//--------------------------------------------------------------------------
unsigned int m_currentIndex;
//--------------------------------------------------------------------------
/// @brief
//--------------------------------------------------------------------------
std::unordered_map<std::string,unsigned int> mymap;
};
#endif // HASHTABLE_H