54 #ifndef LIB_HASH_INDEXED_H 55 #define LIB_HASH_INDEXED_H 89 Plain (TY
const& something)
90 : hash_(hash_value (something))
93 operator HashVal()
const {
return hash_; }
116 LUID get()
const {
return const_cast<LUID> (&luid_);}
121 inline HashVal hash_value (
Plain const& plainHash) {
return plainHash; }
122 inline HashVal hash_value (
LuidH const& luid_Hash) {
return luid_Hash; }
134 template<
class BA,
class IMP>
144 ID (BA
const& ref) : IMP (ref.getID()) {}
145 ID (IMP
const& ir) : IMP (ir) {}
155 Id (T
const& ref) :
ID (ref) {}
161 :
public std::unary_function<BA, HashVal>
163 HashVal operator() (BA
const& obj)
const {
return obj.getID(); }
168 :
public std::unary_function<ID, HashVal>
170 HashVal operator() (
ID const&
id)
const {
return id; }
186 return reinterpret_cast<Id<T> const&
> (getID());
192 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 ...