AGXDynamics
2.35.0.2
hash.h
Go to the documentation of this file.
1
/*
2
Copyright 2007-2022. Algoryx Simulation AB.
3
4
All AGX source code, intellectual property, documentation, sample code,
5
tutorials, scene files and technical white papers, are copyrighted, proprietary
6
and confidential material of Algoryx Simulation AB. You may not download, read,
7
store, distribute, publish, copy or otherwise disseminate, use or expose this
8
material unless having a written signed agreement with Algoryx Simulation AB, or having been
9
advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10
valid commercial license from Algoryx Simulation AB.
11
12
Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13
from using this software, unless otherwise stated in written agreements with
14
Algoryx Simulation AB.
15
*/
16
17
#ifndef AGX_HASH_H
18
#define AGX_HASH_H
19
20
#include <
agx/agxCore_export.h
>
21
#include <
agx/Integer.h
>
22
23
namespace
agx
24
{
25
// Hash wrapper, do not provide template specialization for this
26
template
<
typename
T>
27
AGXCORE_EXPORT
UInt32
hash
(
const
T& key );
28
29
// Hash combinator
30
UInt32
AGXCORE_EXPORT
hash
(
UInt32
h1,
UInt32
h2 );
31
32
33
// Implement template specializations for supported hashable types
34
// default implementation calls key.hash(), so the easiest way is to add a hash method to the class
35
// for native types template specializations is the only option
36
template
<
typename
T>
37
struct
HashFn
38
{
39
UInt32
operator()
(
const
T& key)
const
;
40
};
41
42
43
// Hash key comparison function
44
template
<
typename
T1,
typename
T2>
45
bool
hashKeyEqual
(
const
T1& key1,
const
T2& key2);
46
47
48
// Explicitly pack as agx::UInt64 instead of SymmetricPair<agx::UInt32> due to faster hashing
49
AGXCORE_EXPORT
agx::UInt64
buildHashKey
(
agx::UInt32
id1,
agx::UInt32
id2);
50
AGXCORE_EXPORT
bool
hashKeyContains
(
agx::UInt64
key,
agx::UInt32
id
);
51
AGXCORE_EXPORT
void
splitHashKey
(
agx::UInt64
key,
agx::UInt32
& id1,
agx::UInt32
& id2);
52
}
53
54
55
#endif
/* AGX_HASH_H */
agx::UInt64
uint64_t UInt64
Definition:
Integer.h:41
AGXCORE_EXPORT
#define AGXCORE_EXPORT
agx::HashFn
Definition:
hash.h:37
agx
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
Definition:
AddedMassInteraction.h:22
agx::buildHashKey
AGXCORE_EXPORT agx::UInt64 buildHashKey(agx::UInt32 id1, agx::UInt32 id2)
Definition:
HashFunction.h:41
Integer.h
agxCore_export.h
agx::hash
AGXCORE_EXPORT UInt32 hash(const T &key)
Definition:
HashFunction.h:65
agx::hashKeyContains
AGXCORE_EXPORT bool hashKeyContains(agx::UInt64 key, agx::UInt32 id)
Definition:
HashFunction.h:46
agx::splitHashKey
AGXCORE_EXPORT void splitHashKey(agx::UInt64 key, agx::UInt32 &id1, agx::UInt32 &id2)
Definition:
HashFunction.h:51
agx::HashFn::operator()
UInt32 operator()(const T &key) const
Definition:
HashFunction.h:58
agx::UInt32
uint32_t UInt32
Definition:
Integer.h:40
agx::hashKeyEqual
bool hashKeyEqual(const T1 &key1, const T2 &key2)
Definition:
HashFunction.h:77
include
agx
hash.h
Generated on Mon Jan 30 2023 15:44:12 for AGXDynamics by
1.8.17