45 #ifndef LIB_HASH_INDEXED_H 46 #define LIB_HASH_INDEXED_H 80 Plain (TY
const& something)
81 : hash_(hash_value (something))
84 operator HashVal()
const {
return hash_; }
107 LUID get()
const {
return const_cast<LUID> (&luid_);}
112 inline HashVal hash_value (
Plain const& plainHash) {
return plainHash; }
113 inline HashVal hash_value (
LuidH const& luid_Hash) {
return luid_Hash; }
125 template<
class BA,
class IMP>
135 ID (BA
const& ref) : IMP (ref.getID()) {}
136 ID (IMP
const& ir) : IMP (ir) {}
146 Id (T
const& ref) :
ID (ref) {}
152 :
public std::unary_function<BA, HashVal>
154 HashVal operator() (BA
const& obj)
const {
return obj.getID(); }
159 :
public std::unary_function<ID, HashVal>
161 HashVal operator() (
ID const&
id)
const {
return id; }
177 return reinterpret_cast<Id<T> const&
> (getID());
183 this->id_ = ref.getID();
enables use of BA objects as keys within std::unordered_map
size_t lumiera_uid_hash(const lumiera_uid *luid)
Generate a hash sum over an luid.
Hash based ID, typed to a specific subclass of BA.
generic hash based ID, corresponding to the base class BA
lumiera_uid * LUID
a Lumiera UID
simple Hash implementation directly incorporating the hash value.
A Mixin to add a private ID type to the target class, together with storage to hold an instance of th...
bool operator==(PtrDerefIter< I1 > const &il, PtrDerefIter< I2 > const &ir)
Supporting equality comparisons...
LUID get() const
for passing to C APIs
Implementation namespace for support and library code.
Lumiera unique object identifier.
void lumiera_uid_gen(lumiera_uid *luid)
Generate a new luid.
trivial hash functor using the ID as hash
Helper to use a single extension point for specialised hash functions.
int lumiera_uid_eq(const lumiera_uid *luida, const lumiera_uid *luidb)
Test 2 luid's for equality.
Lumiera error handling (C++ interface).
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor...
Hash value types and utilities.
size_t HashVal
a STL compatible hash value
unsigned char lumiera_uid[16]
storage for a Lumiera unique ID, based on a 128bit random number
Id< T > const & recastID() const
redefining of the specific type info of the Id is allowed, as all share the same implementation ...