AGX Dynamics 2.41.3.2
Loading...
Searching...
No Matches
hash.h
Go to the documentation of this file.
1/*
2Copyright 2007-2025. Algoryx Simulation AB.
3
4All AGX source code, intellectual property, documentation, sample code,
5tutorials, scene files and technical white papers, are copyrighted, proprietary
6and confidential material of Algoryx Simulation AB. You may not download, read,
7store, distribute, publish, copy or otherwise disseminate, use or expose this
8material unless having a written signed agreement with Algoryx Simulation AB, or having been
9advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10valid commercial license from Algoryx Simulation AB.
11
12Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13from using this software, unless otherwise stated in written agreements with
14Algoryx 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
23namespace agx
24{
25 // Hash wrapper, do not provide template specialization for this
26 template <typename T>
27 UInt32 hash( const T& key );
28
29 // Hash combinator
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
52}
53
54
55#endif /* AGX_HASH_H */
#define AGXCORE_EXPORT
The agx namespace contains the dynamics/math part of the AGX Dynamics API.
UInt32 hash(const T &key)
Definition: HashFunction.h:65
AGXCORE_EXPORT void splitHashKey(agx::UInt64 key, agx::UInt32 &id1, agx::UInt32 &id2)
Definition: HashFunction.h:51
uint32_t UInt32
Definition: Integer.h:32
uint64_t UInt64
Definition: Integer.h:33
AGXCORE_EXPORT agx::UInt64 buildHashKey(agx::UInt32 id1, agx::UInt32 id2)
Definition: HashFunction.h:41
bool hashKeyEqual(const T1 &key1, const T2 &key2)
Definition: HashFunction.h:77
AGXCORE_EXPORT bool hashKeyContains(agx::UInt64 key, agx::UInt32 id)
Definition: HashFunction.h:46
UInt32 operator()(const T &key) const
Definition: HashFunction.h:58