MCPcopy Create free account
hub / github.com/baidu/babylon / create_instance

Method create_instance

src/babylon/application_context.cpp:139–161  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137}
138
139Any ApplicationContext::ComponentHolder::create_instance(
140 ApplicationContext& context, const Any& option) noexcept {
141 auto instance = create_instance();
142 if (instance) {
143 auto ret = autowire(instance, context);
144 if (ret != 0) {
145 BABYLON_LOG(WARNING) << "autowire failed for component of type "
146 << _type_id->type_id;
147 instance.clear();
148 } else {
149 ret = initialize(instance, context, option);
150 if (ret != 0) {
151 BABYLON_LOG(WARNING)
152 << "initialize failed for component of type " << _type_id->type_id;
153 instance.clear();
154 }
155 }
156 } else {
157 BABYLON_LOG(WARNING) << "create instance failed for component of type "
158 << _type_id->type_id;
159 }
160 return instance;
161}
162
163void ApplicationContext::ComponentHolder::create_singleton(
164 ApplicationContext& context) noexcept {

Callers

nothing calls this directly

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected