13 l->debug(
"SomeComponent() at {:p}", (
void*)
this);
16 l->debug(
"~SomeComponent()");
18 virtual void chirp() = 0;
25 l->debug(
"SomeConcrete() at {:p}", (
void*)
this);
28 l->debug(
"~SomeConcrete()");
31 l->info(
"SomeConcrete::chirp() at {:p}", (
void*)
this);
45 make_SomeConcrete_factory();
47 auto ins = WireCell::Factory::lookup<ISomeComponent>(
"SomeConcrete");
48 AssertMsg(ins,
"Failed to lookup 'SomeConcrete' with interface 'ISomeComponent'");
49 info(
"Got SomeConcrete @ {:p}", (
void*)ins.get());
50 info(
"Got bogus @ {:p}", (
void*)std::shared_ptr<ISomeComponent>().
get());
55 auto should_fail = WireCell::Factory::lookup<ISomeComponent>(
"NothingNamedThis");
59 info(
"^^^ Successfully failed to lookup a nonexistent component");
63 info(
"Should not hear anything from this failed find_tn");
64 std::shared_ptr<ISomeComponent>
ptr 65 = WireCell::Factory::find_maybe_tn<ISomeComponent>(
"SomeConcrete:doesnotexist");
66 AssertMsg(ptr==
nullptr,
"Got non null for nonexistent named component");
67 info(
"Success. Next, 'find' should be successful");
68 std::shared_ptr<ISomeComponent> ptr2
69 = WireCell::Factory::find_maybe_tn<ISomeComponent>(
"SomeConcrete");
70 debug(
"Got ptr2 @ {:p}", (
void*)ptr2.get());
71 AssertMsg(ptr2 !=
nullptr,
"Got null for existing component");
void info(const char *fmt, const Args &...args)
void log(const char *argv0)
virtual ~ISomeComponent()
void warn(const char *fmt, const Args &...args)
logptr_t logger(std::string name)
std::shared_ptr< spdlog::logger > logptr_t
int main(int argc, char *argv[])
void debug(const char *fmt, const Args &...args)
#define WIRECELL_FACTORY(NAME, CONCRETE,...)