DebugOutput.inl 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. #pragma once
  9. namespace AZ::SceneAPI::Utilities
  10. {
  11. template<typename T>
  12. void DebugOutput::Write(const char* name, const AZStd::vector<T>& data)
  13. {
  14. AZStd::size_t hash = AZStd::hash_range(data.begin(), data.end());
  15. AZ::u64 dataSize(static_cast<AZ::u64>(data.size()));
  16. m_output += AZStd::string::format("\t%s: Count %llu. Hash: %zu\n", name, dataSize, hash);
  17. AddToNode(AZStd::string::format("%s - Count", name).c_str(), dataSize);
  18. AddToNode(AZStd::string::format("%s - Hash", name).c_str(), static_cast<AZ::u64>(hash));
  19. }
  20. template<typename T>
  21. void DebugOutput::Write(const char* name, const AZStd::vector<AZStd::vector<T>>& data)
  22. {
  23. AZStd::size_t hash = 0;
  24. AZ::u64 dataSize(static_cast<AZ::u64>(data.size()));
  25. for (auto&& vector : data)
  26. {
  27. AZStd::hash_combine(hash, AZStd::hash_range(vector.begin(), vector.end()));
  28. }
  29. m_output += AZStd::string::format("\t%s: Count %llu. Hash: %zu\n", name, dataSize, hash);
  30. AddToNode(AZStd::string::format("%s - Count", name).c_str(), dataSize);
  31. AddToNode(AZStd::string::format("%s - Hash", name).c_str(), static_cast<AZ::u64>(hash));
  32. }
  33. } // namespace AZ::SceneAPI::Utilities