ProcessingResult.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 <SceneAPI/SceneCore/Events/ProcessingResult.h>
  9. namespace AZ
  10. {
  11. namespace SceneAPI
  12. {
  13. namespace Events
  14. {
  15. ProcessingResultCombiner::ProcessingResultCombiner()
  16. : m_value(ProcessingResult::Ignored)
  17. {
  18. }
  19. void ProcessingResultCombiner::operator=(ProcessingResult rhs)
  20. {
  21. Combine(rhs);
  22. }
  23. void ProcessingResultCombiner::operator+=(ProcessingResult rhs)
  24. {
  25. Combine(rhs);
  26. }
  27. void ProcessingResultCombiner::Combine(ProcessingResult rhs)
  28. {
  29. switch (rhs)
  30. {
  31. case ProcessingResult::Ignored:
  32. return;
  33. case ProcessingResult::Success:
  34. m_value = m_value != ProcessingResult::Failure ? rhs : ProcessingResult::Failure;
  35. return;
  36. case ProcessingResult::Failure:
  37. m_value = ProcessingResult::Failure;
  38. return;
  39. }
  40. }
  41. ProcessingResult ProcessingResultCombiner::GetResult() const
  42. {
  43. return m_value;
  44. }
  45. } // Events
  46. } // SceneAPI
  47. } // AZ