81 static Symbol getID() {
return "typed-id-test-dummy"; }
96 using DummyID = EntryID<DummyEntity>;
125 verifyRegistration();
126 verifyAssetFrontend();
127 verifyInstanceAccess();
128 verifyAutomaticCleanup();
136 uint type_cnt = TypedID::type_count(); 137 uint elm_cnt = TypedID::element_count();
139 PDum d1 = TypedID::get<DummyEntity> (
"top");
143 CHECK (type_cnt+1 == TypedID::type_count());
148 CHECK (elm_cnt+2 == TypedID::element_count());
150 DummyID idu = TypedID::getID<DummyEntity> (
"up");
152 CHECK (
"up" == idu.getSym());
158 verifyAssetFrontend()
161 PInv inventory = asset::Meta::create (Category (META,"typed-id-test-dummy")); 163 CHECK (0 == inventory->size());
172 CHECK (2 == inventory->size());
174 for_each (inventory->all(), show<BareEntryID> );
182 cout <<
"---" << o << endl;
187 verifyInstanceAccess()
190 PDum top (new DummyEntity ("top")); 193 CHECK (1 == top.use_count());
194 CHECK (1 == bot.use_count());
196 VERIFY_ERROR (MISSING_INSTANCE, TypedID::get<DummyEntity> (
"top"));
199 top->registerInstance (top);
200 TypedID::registerInstance<DummyEntity> (bot);
202 PDum d1 = TypedID::get<DummyEntity> (
"top");
206 CHECK (2 == top.use_count());
207 CHECK (1 == bot.use_count());
209 d1 = TypedID::get<DummyEntity> (
"bottom");
213 CHECK (1 == top.use_count());
214 CHECK (2 == bot.use_count());
216 for_each (TypedID::allInstances<DummyEntity>(), show<DummyEntity> );
222 verifyAutomaticCleanup()
229 CHECK (2 == TypedID::entry_count<DummyEntity>());
232 CHECK (1 == TypedID::entry_count<DummyEntity>());
233 CHECK (bea == *(TypedID::allInstances<DummyEntity>()));
236 CHECK (0 == TypedID::entry_count<DummyEntity>());
237 CHECK (! (TypedID::get<DummyEntity>(
"beauty")));
238 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.
Simple 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.