72 static Symbol getID() {
return "typed-id-test-dummy"; }
87 using DummyID = EntryID<DummyEntity>;
116 verifyRegistration();
117 verifyAssetFrontend();
118 verifyInstanceAccess();
119 verifyAutomaticCleanup();
127 uint type_cnt = TypedID::type_count(); 128 uint elm_cnt = TypedID::element_count();
130 PDum d1 = TypedID::get<DummyEntity> (
"top");
134 CHECK (type_cnt+1 == TypedID::type_count());
139 CHECK (elm_cnt+2 == TypedID::element_count());
141 DummyID idu = TypedID::getID<DummyEntity> (
"up");
143 CHECK (
"up" == idu.getSym());
149 verifyAssetFrontend()
152 PInv inventory = asset::Meta::create (Category (META,"typed-id-test-dummy")); 154 CHECK (0 == inventory->size());
163 CHECK (2 == inventory->size());
165 for_each (inventory->all(), show<BareEntryID> );
173 cout <<
"---" << o << endl;
178 verifyInstanceAccess()
181 PDum top (new DummyEntity ("top")); 184 CHECK (1 == top.use_count());
185 CHECK (1 == bot.use_count());
187 VERIFY_ERROR (MISSING_INSTANCE, TypedID::get<DummyEntity> (
"top"));
190 top->registerInstance (top);
191 TypedID::registerInstance<DummyEntity> (bot);
193 PDum d1 = TypedID::get<DummyEntity> (
"top");
197 CHECK (2 == top.use_count());
198 CHECK (1 == bot.use_count());
200 d1 = TypedID::get<DummyEntity> (
"bottom");
204 CHECK (1 == top.use_count());
205 CHECK (2 == bot.use_count());
207 for_each (TypedID::allInstances<DummyEntity>(), show<DummyEntity> );
213 verifyAutomaticCleanup()
220 CHECK (2 == TypedID::entry_count<DummyEntity>());
223 CHECK (1 == TypedID::entry_count<DummyEntity>());
224 CHECK (bea == *(TypedID::allInstances<DummyEntity>()));
227 CHECK (0 == TypedID::entry_count<DummyEntity>());
228 CHECK (! (TypedID::get<DummyEntity>(
"beauty")));
229 CHECK (isnil (TypedID::allInstances<DummyEntity>()));
Adapter for using this type as a primary type within Lumiera's Steam-Layer.
Steam-Layer Interface: Asset Lookup and Organisation.
Exposing an ID registration cluster as a Meta Asset.
typed symbolic and hash ID for asset-like position accounting.
#define VERIFY_ERROR(ERROR_ID, ERRONEOUS_STATEMENT)
Macro to verify that a statement indeed raises an exception.
Frontend for a registration service to associate object identities, symbolic identifiers and types...
Customised refcounting smart pointer.
Steam-Layer implementation namespace root.
Namespace of Session and user visible high-level objects.
static lib::Depend< AssetManager > instance
get at the system-wide asset manager instance.
Implementation namespace for support and library code.
Token or Atom with distinct identity.
Marker types to indicate a literal string and a Symbol.
Simplistic test class runner.
void for_each(CON const &elements, FUN function, P1 &&bind1, ARGS &&...args)
Accept binding for arbitrary function arguments.
A collection of frequently used helper functions to support unit testing.
Lumiera public interface.
Bare symbolic and hash ID used for accounting of asset like entries.
Customised refcounting smart pointer template, built upon std::shared_ptr, but forwarding type relati...
Perform operations "for each element" of a collection.