KiCad PCB EDA Suite
|
#include <unordered_map>
#include <wx/string.h>
Go to the source code of this file.
Classes | |
struct | iequal_to |
Equality test for "const char*" type used in very specialized KEYWORD_MAP below. More... | |
struct | fnv_1a |
Very fast and efficient hash function for "const char*" type, used in specialized KEYWORD_MAP below. More... | |
Macros | |
#define | DECL_HASH_FOR_SWIG(TypeName, KeyType, ValueType) typedef std::unordered_map<KeyType, ValueType> TypeName; |
Declare a std::unordered_map but no swig template. | |
Typedefs | |
typedef std::unordered_map< const char *, int, fnv_1a, iequal_to > | KEYWORD_MAP |
A hashtable made of a const char* and an int. | |
#define DECL_HASH_FOR_SWIG | ( | TypeName, | |
KeyType, | |||
ValueType | |||
) | typedef std::unordered_map<KeyType, ValueType> TypeName; |
Declare a std::unordered_map but no swig template.
Definition at line 73 of file hashtables.h.
typedef std::unordered_map< const char*, int, fnv_1a, iequal_to > KEYWORD_MAP |
A hashtable made of a const char* and an int.
This type assumes use with type KEYWORD that is created by CMake and that table creates constant storage for C strings (and pointers to those C strings). Here we are only interested in the C strings themselves and only the pointers are duplicated within the hashtable. If the strings were not constant and fixed, this type would not work. Also note that normally a hashtable (i.e. unordered_map) using a const char* key would simply compare the 32 bit or 64 bit pointers themselves, rather than the C strings which they are known to point to in this context. I force the latter behavior by supplying both "hash" and "equality" overloads to the hashtable (unordered_map) template.
Definition at line 95 of file hashtables.h.