containers.cpp 588 B

123456789101112131415161718192021222324
  1. #include <containers.h>
  2. #include <logs/assert.h>
  3. #define PIKA_MAKE_CONTAINER_GET(x) if (std::strcmp(name, #x ) == 0) \
  4. { \
  5. if (sizeof(x) != memoryArena->containerStructMemory.size) { return nullptr; } \
  6. return new(memoryArena->containerStructMemory.block) x (); \
  7. } \
  8. else
  9. //this should not allocate memory
  10. Container *getContainer(const char *name, pika::memory::MemoryArena *memoryArena)
  11. {
  12. PIKA_MAKE_CONTAINER_GET(Gameplay)
  13. PIKA_MAKE_CONTAINER_GET(ImmageViewer)
  14. {
  15. //"invalid container name: "
  16. return nullptr;
  17. }
  18. }