MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / register_creator

Method register_creator

include/geode/basic/factory.hpp:73–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71
72 template < typename DerivedClass >
73 static void register_creator( Key key )
74 {
75 static_assert( std::is_base_of_v< BaseClass, DerivedClass >,
76 "DerivedClass is not a subclass of BaseClass" );
77 static_assert( std::is_constructible_v< DerivedClass, Args... >,
78 "DerivedClass is not constructible with Args..." );
79 auto &store = get_store();
80 if( !store
81 .emplace( std::move( key ),
82 Creator( create_function_impl< DerivedClass > ) )
83 .second )
84 {
85 Logger::warn(
86 "Factory: Trying to register twice the same key" );
87 }
88 }
89
90 [[nodiscard]] static std::unique_ptr< BaseClass > create(
91 const Key &key, Args... args )

Callers

nothing calls this directly

Calls 2

warnFunction · 0.85
emplaceMethod · 0.80

Tested by

no test coverage detected