XRFactory.cpp 936 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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 <AzCore/Interface/Interface.h>
  9. #include <XR/XRFactory.h>
  10. namespace XR
  11. {
  12. AZ::Crc32 Factory::GetPlatformService()
  13. {
  14. return AZ_CRC_CE("XRPlatformService");
  15. }
  16. void Factory::Register(Factory* instance)
  17. {
  18. AZ::Interface<Factory>::Register(instance);
  19. }
  20. void Factory::Unregister(Factory* instance)
  21. {
  22. AZ::Interface<Factory>::Unregister(instance);
  23. }
  24. bool Factory::IsReady()
  25. {
  26. return AZ::Interface<Factory>::Get() != nullptr;
  27. }
  28. Factory& Factory::Get()
  29. {
  30. Factory* factory = AZ::Interface<Factory>::Get();
  31. AZ_Assert(factory, "XR::Factory failed to create!!!");
  32. return *factory;
  33. }
  34. } // namespace XR