MCPcopy Create free account
hub / github.com/SakuraEngine/SakuraEngine / clone_group

Method clone_group

modules/engine/runtime/src/ecs/archetype.cpp:255–274  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255sugoi_group_t* sugoi_storage_t::clone_group(sugoi_group_t* srcG)
256{
257 if(auto g = try_get_group(srcG->type))
258 return g;
259 sugoi_group_t& proto = *new (groupPool.allocate()) sugoi_group_t();
260 std::memcpy(&proto, srcG, sizeof(sugoi_group_t));
261 char* buffer = (char*)(&proto + 1);
262 proto.type = sugoi::clone(srcG->type, buffer);
263 proto.archetype = clone_archetype(srcG->archetype);
264 if (srcG->dead)
265 {
266 proto.dead = clone_group(srcG->dead);
267 }
268 if (srcG->cloned)
269 {
270 proto.cloned = clone_group(srcG->cloned);
271 }
272 groups.insert({ proto.type, &proto });
273 return &proto;
274}
275
276sugoi::archetype_t* sugoi_storage_t::try_get_archetype(const sugoi_type_set_t& type) const
277{

Callers 1

cloneMethod · 0.80

Calls 4

memcpyFunction · 0.85
cloneFunction · 0.70
allocateMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected