SceneManifest.inl 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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/Debug/Trace.h>
  9. namespace AZ
  10. {
  11. namespace SceneAPI
  12. {
  13. namespace Containers
  14. {
  15. bool SceneManifest::IsEmpty() const
  16. {
  17. // Any of the containers would do as they should be in-sync with each other, so pick one arbitrarily.
  18. AZ_Assert(m_values.empty() == m_storageLookup.empty(), "SceneManifest values and storage-lookup tables have gone out of lockstep.");
  19. return m_values.empty();
  20. }
  21. bool SceneManifest::AddEntry(const AZStd::shared_ptr<DataTypes::IManifestObject>& value)
  22. {
  23. return AddEntry(AZStd::shared_ptr<DataTypes::IManifestObject>(value));
  24. }
  25. bool SceneManifest::RemoveEntry(const AZStd::shared_ptr<DataTypes::IManifestObject>& value)
  26. {
  27. return RemoveEntry(value.get());
  28. }
  29. size_t SceneManifest::GetEntryCount() const
  30. {
  31. // Any of the containers would do as they should be in-sync with each other, so pick one randomly.
  32. AZ_Assert(m_values.size() == m_storageLookup.size(),
  33. "SceneManifest values and storage-lookup tables have gone out of lockstep. (%i vs. %i)",
  34. m_values.size(), m_storageLookup.size());
  35. return m_values.size();
  36. }
  37. AZStd::shared_ptr<DataTypes::IManifestObject> SceneManifest::GetValue(Index index)
  38. {
  39. return index < m_values.size() ? m_values[index] : AZStd::shared_ptr<DataTypes::IManifestObject>();
  40. }
  41. AZStd::shared_ptr<const DataTypes::IManifestObject> SceneManifest::GetValue(Index index) const
  42. {
  43. return index < m_values.size() ? m_values[index] : AZStd::shared_ptr<const DataTypes::IManifestObject>();
  44. }
  45. SceneManifest::Index SceneManifest::FindIndex(const AZStd::shared_ptr<DataTypes::IManifestObject>& value) const
  46. {
  47. return FindIndex(value.get());
  48. }
  49. SceneManifest::ValueStorageData SceneManifest::GetValueStorage()
  50. {
  51. return ValueStorageData(m_values.begin(), m_values.end());
  52. }
  53. SceneManifest::ValueStorageConstData SceneManifest::GetValueStorage() const
  54. {
  55. return ValueStorageConstData(
  56. Views::MakeConvertIterator(m_values.cbegin(), SceneManifestConstDataConverter),
  57. Views::MakeConvertIterator(m_values.cend(), SceneManifestConstDataConverter));
  58. }
  59. } // Containers
  60. } // SceneAPI
  61. } // AZ