containerInformation.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #pragma once
  2. #include <string>
  3. #include <baseContainer.h>
  4. namespace pika
  5. {
  6. struct ContainerInformation
  7. {
  8. ContainerInformation() {};
  9. ContainerInformation(
  10. size_t containerStructBaseSize,
  11. const char *containerName,
  12. const ContainerStaticInfo& containerStaticInfo):
  13. containerStructBaseSize(containerStructBaseSize), containerName(containerName),
  14. containerStaticInfo(containerStaticInfo)
  15. {
  16. };
  17. bool operator==(const ContainerInformation &other)
  18. {
  19. if (this == &other) { return true; }
  20. return
  21. this->containerStructBaseSize == other.containerStructBaseSize &&
  22. this->containerName == other.containerName &&
  23. this->containerStaticInfo == other.containerStaticInfo;
  24. }
  25. bool operator!=(const ContainerInformation &other)
  26. {
  27. return !(*this == other);
  28. }
  29. size_t containerStructBaseSize = 0; //static memory
  30. std::string containerName = "";
  31. ContainerStaticInfo containerStaticInfo = {};
  32. size_t calculateMemoryRequirements()
  33. {
  34. size_t size = 0;
  35. size += containerStructBaseSize;
  36. pika::align64(size);
  37. size += containerStaticInfo.defaultHeapMemorySize;
  38. for (auto i : containerStaticInfo.bonusAllocators)
  39. {
  40. pika::align64(size);
  41. size += i;
  42. }
  43. return size;
  44. }
  45. };
  46. }