JobDiagnosticTracker.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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 "JobDiagnosticTracker.h"
  9. namespace AssetProcessor
  10. {
  11. bool JobDiagnosticInfo::operator==(const JobDiagnosticInfo& rhs) const
  12. {
  13. return m_errorCount == rhs.m_errorCount
  14. && m_warningCount == rhs.m_warningCount;
  15. }
  16. bool JobDiagnosticInfo::operator!=(const JobDiagnosticInfo& rhs) const
  17. {
  18. return !operator==(rhs);
  19. }
  20. //////////////////////////////////////////////////////////////////////////
  21. JobDiagnosticTracker::JobDiagnosticTracker()
  22. {
  23. BusConnect();
  24. }
  25. JobDiagnosticTracker::~JobDiagnosticTracker()
  26. {
  27. BusDisconnect();
  28. }
  29. JobDiagnosticInfo AssetProcessor::JobDiagnosticTracker::GetDiagnosticInfo(AZ::u64 jobRunKey) const
  30. {
  31. auto jobIter = m_jobInfo.find(jobRunKey);
  32. if(jobIter != m_jobInfo.end())
  33. {
  34. return jobIter->second;
  35. }
  36. return {};
  37. }
  38. void JobDiagnosticTracker::RecordDiagnosticInfo(AZ::u64 jobRunKey, JobDiagnosticInfo info)
  39. {
  40. if (info != JobDiagnosticInfo{})
  41. {
  42. // Only store non-empty entries
  43. m_jobInfo[jobRunKey] = info;
  44. }
  45. }
  46. WarningLevel JobDiagnosticTracker::GetWarningLevel() const
  47. {
  48. return m_warningLevel;
  49. }
  50. void JobDiagnosticTracker::SetWarningLevel(WarningLevel level)
  51. {
  52. m_warningLevel = level;
  53. }
  54. }