NeoPZ
TPZHash.h
Go to the documentation of this file.
1 /*
2  * File: Hash.h
3  * Author: quinelato
4  *
5  * Created on September 25, 2017, 12:23 PM
6  */
7 
8 #ifndef TPZHASH_H
9 #define TPZHASH_H
10 
11 #include "pzreal.h"
12 #include "MurmurHash3.h"
13 #include <string>
14 #include <cstdint>
15 #include <type_traits>
16 
17 int32_t Hash(std::string str);
18 
19 template <typename T>
20 typename std::enable_if<!std::is_pointer<T>::value && std::is_abstract<T>::value, int>::type ClassIdOrHash(){
21  return T::StaticClassId();
22 }
23 
24 template <typename T>
25 typename std::enable_if<!std::is_pointer<T>::value && !std::is_abstract<T>::value, int>::type ClassIdOrHash(){
26  return T().ClassId();
27 }
28 
29 template <typename T>
30 typename std::enable_if<std::is_pointer<T>::value, int>::type ClassIdOrHash(){
31  return Hash("pointer") ^ ClassIdOrHash<typename std::remove_pointer<T>::type>() << 1;
32 }
33 
34 //template <typename T>
35 //int ClassIdOrHash<typename std::enable_if<std::is_pointer<T>::value, T>::type>() {
36 // return Hash("pointer") ^ ClassIdOrHash<T>() << 1;
37 //}
38 
39 template <>
41 
42 template <>
43 int ClassIdOrHash<int>();
44 
45 template <>
47 
48 template <>
50 
51 template <>
53 
54 template <>
56 
57 template <>
59 
60 template <>
62 
63 template <>
64 int ClassIdOrHash<std::complex<float>>();
65 
66 template <>
67 int ClassIdOrHash<std::complex<double>>();
68 
69 template <>
70 int ClassIdOrHash<std::complex<long double>>();
71 
72 
73 #endif /* TPZHASH_H */
74 
int ClassIdOrHash< float >()
Definition: TPZHash.cpp:49
int ClassIdOrHash< long double >()
Definition: TPZHash.cpp:59
int ClassIdOrHash< double >()
Definition: TPZHash.cpp:54
std::enable_if<!std::is_pointer< T >::value &&std::is_abstract< T >::value, int >::type ClassIdOrHash()
Definition: TPZHash.h:20
int ClassIdOrHash< TPZFlopCounter >()
Definition: TPZHash.cpp:24
int ClassIdOrHash< uint64_t >()
Definition: TPZHash.cpp:44
int ClassIdOrHash< long long >()
Definition: TPZHash.cpp:39
int ClassIdOrHash< long int >()
Definition: TPZHash.cpp:34
int ClassIdOrHash< int >()
Definition: TPZHash.cpp:29
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10