MCPcopy Create free account
hub / github.com/Illation/ETEngine / Append

Method Append

Engine/source/EtFramework/ECS/ComponentPool.cpp:57–67  ·  view source on GitHub ↗

------------------------ ComponentPool::Append Add an component to the end of the buffer (without knowing its static type data)

Source from the content-addressed store, hash-verified

55// Add an component to the end of the buffer (without knowing its static type data)
56//
57void ComponentPool::Append(void const* const componentData)
58{
59 size_t const typeSize = ComponentRegistry::Instance().GetSize(m_ComponentType);
60 size_t const byteIdx = m_Buffer.size();
61
62 // add space in the buffer so we can create our new component
63 m_Buffer.resize(byteIdx + typeSize);
64
65 // call the copy constructor on the component in our new memory location
66 ComponentRegistry::Instance().GetCopyAssign(m_ComponentType)(componentData, static_cast<void*>(&m_Buffer[byteIdx]));
67}
68
69//------------------------
70// ComponentPool::Erase

Callers 2

AddEntityMethod · 0.80

Calls 2

GetCopyAssignMethod · 0.80
GetSizeMethod · 0.45

Tested by

no test coverage detected