24 #include <unordered_map> 45 TestB (
ID const& refID) : Mixin (refID) {}
47 bool operator== (
TestB const& o)
const {
return this->getID() == o.getID(); }
73 checkBasicProperties();
78 buildHashtable<TestDB, TestDB, TestB::UseEmbeddedHash>();
83 checkBasicProperties ()
92 CHECK (
sizeof (idDB1) ==
sizeof (idDA) );
96 CHECK (idDA == bb.getID() );
97 CHECK (idDB1 == idDB2 );
101 CHECK (d1.getID() != d2.getID());
104 CHECK (d1.getID() == d2.getID());
119 CHECK (idOrig == idCopy);
123 template<
class KEY,
class VAL,
class HashFunc>
127 typedef std::unordered_map<KEY, VAL, HashFunc> Hashtable;
131 VAL o1; KEY key1 (o1);
132 VAL o2; KEY key2 (o2);
133 VAL o3; KEY key3 (o3);
139 CHECK (!isSameObject (o1, tab[key1]));
140 CHECK (!isSameObject (o2, tab[key2]));
141 CHECK (!isSameObject (o3, tab[key3]));
143 CHECK (o1.getID() == tab[key1].getID());
144 CHECK (o2.getID() == tab[key2].getID());
145 CHECK (o3.getID() == tab[key3].getID());
147 CHECK (o1.getID() != tab[key2].getID());
148 CHECK (o1.getID() != tab[key3].getID());
149 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.
Simplistic 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, based directly on the referee's memory identities. ...