33 #include <unordered_map> 54 TestB (
ID const& refID) : Mixin (refID) {}
56 bool operator== (
TestB const& o)
const {
return this->getID() == o.getID(); }
82 checkBasicProperties();
87 buildHashtable<TestDB, TestDB, TestB::UseEmbeddedHash>();
92 checkBasicProperties ()
101 CHECK (
sizeof (idDB1) ==
sizeof (idDA) );
105 CHECK (idDA == bb.getID() );
106 CHECK (idDB1 == idDB2 );
110 CHECK (d1.getID() != d2.getID());
113 CHECK (d1.getID() == d2.getID());
128 CHECK (idOrig == idCopy);
132 template<
class KEY,
class VAL,
class HashFunc>
136 typedef std::unordered_map<KEY, VAL, HashFunc> Hashtable;
140 VAL o1; KEY key1 (o1);
141 VAL o2; KEY key2 (o2);
142 VAL o3; KEY key3 (o3);
148 CHECK (!isSameObject (o1, tab[key1]));
149 CHECK (!isSameObject (o2, tab[key2]));
150 CHECK (!isSameObject (o3, tab[key3]));
152 CHECK (o1.getID() == tab[key1].getID());
153 CHECK (o2.getID() == tab[key2].getID());
154 CHECK (o3.getID() == tab[key3].getID());
156 CHECK (o1.getID() != tab[key2].getID());
157 CHECK (o1.getID() != tab[key3].getID());
158 CHECK (o2.getID() != tab[key3].getID());
Hash based ID, typed to a specific subclass of BA.
generic hash based ID, corresponding to the base class BA
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...
Implementation namespace for support and library code.
Simple test class runner.
trivial hash functor using the ID as hash
Tiny helper functions and shortcuts to be used everywhere Consider this header to be effectively incl...
void lumiera_uid_copy(lumiera_uid *dest, lumiera_uid *src)
Copy an luid.
A template for generating hash based ID tags carrying compile-time type info.
Hash implementation based on a lumiera unique object id (LUID) When invoking the default ctor...
unsigned char lumiera_uid[16]
storage for a Lumiera unique ID, based on a 128bit random number
bool isSameObject(A const &a, B const &b)
compare plain object identity, bypassing any custom comparison operators.