MCPcopy Create free account
hub / github.com/apple/coremltools / init_instance

Method init_instance

deps/pybind11/include/pybind11/pybind11.h:1955–1962  ·  view source on GitHub ↗

Performs instance initialization including constructing a holder and registering the known instance. Should be called as soon as the `type` value_ptr is set for an instance. Takes an optional pointer to an existing holder to use; if not specified and the instance is `.owned`, a new holder will be constructed to manage the value pointer.

Source from the content-addressed store, hash-verified

1953 /// an optional pointer to an existing holder to use; if not specified and the instance is
1954 /// `.owned`, a new holder will be constructed to manage the value pointer.
1955 static void init_instance(detail::instance *inst, const void *holder_ptr) {
1956 auto v_h = inst->get_value_and_holder(detail::get_type_info(typeid(type)));
1957 if (!v_h.instance_registered()) {
1958 register_instance(inst, v_h.value_ptr(), v_h.type);
1959 v_h.set_instance_registered();
1960 }
1961 init_holder(inst, v_h, (const holder_type *) holder_ptr, v_h.value_ptr<type>());
1962 }
1963
1964 /// Deallocates an instance; via holder, if constructed; otherwise via operator delete.
1965 static void dealloc(detail::value_and_holder &v_h) {

Callers 3

dispatcherMethod · 0.80
constructFunction · 0.80
castMethod · 0.80

Calls 5

get_type_infoFunction · 0.85
register_instanceFunction · 0.85
get_value_and_holderMethod · 0.80
instance_registeredMethod · 0.80

Tested by

no test coverage detected