CompressionModuleInterface.cpp 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #include "CompressionModuleInterface.h"
  9. #include <AzCore/Memory/Memory.h>
  10. #include <Clients/CompressionSystemComponent.h>
  11. #include <Clients/DecompressionRegistrarImpl.h>
  12. #include <Compression/CompressionTypeIds.h>
  13. #include <Compression/DecompressionInterfaceAPI.h>
  14. namespace Compression
  15. {
  16. AZ_TYPE_INFO_WITH_NAME_IMPL(CompressionModuleInterface,
  17. "CompressionModuleInterface", CompressionModuleInterfaceTypeId);
  18. AZ_RTTI_NO_TYPE_INFO_IMPL(CompressionModuleInterface, AZ::Module);
  19. AZ_CLASS_ALLOCATOR_IMPL(CompressionModuleInterface, AZ::SystemAllocator);
  20. CompressionModuleInterface::CompressionModuleInterface()
  21. {
  22. m_descriptors.insert(m_descriptors.end(), {
  23. CompressionSystemComponent::CreateDescriptor(),
  24. });
  25. // Create and register the Decompression Registrar
  26. m_decompressionRegistrarInterface = AZStd::make_unique<DecompressionRegistrarImpl>();
  27. if (DecompressionRegistrar::Get() == nullptr)
  28. {
  29. DecompressionRegistrar::Register(m_decompressionRegistrarInterface.get());
  30. }
  31. }
  32. CompressionModuleInterface::~CompressionModuleInterface()
  33. {
  34. if (DecompressionRegistrar::Get() == m_decompressionRegistrarInterface.get())
  35. {
  36. DecompressionRegistrar::Unregister(m_decompressionRegistrarInterface.get());
  37. }
  38. }
  39. AZ::ComponentTypeList CompressionModuleInterface::GetRequiredSystemComponents() const
  40. {
  41. return AZ::ComponentTypeList{
  42. azrtti_typeid<CompressionSystemComponent>(),
  43. };
  44. }
  45. } // namespace Compression