BuilderList.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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. #include <AzCore/std/string/string.h>
  10. #include <utilities/Builder.h>
  11. namespace AssetProcessor
  12. {
  13. //! Helper class that keeps track of the Builders and manages reserving a builder specifically for CreateJobs
  14. //! This class is not inherently thread-safe and must be locked before any access
  15. class BuilderList
  16. {
  17. public:
  18. BuilderList() = default;
  19. void AddBuilder(AZStd::shared_ptr<Builder> builder, BuilderPurpose purpose);
  20. AZStd::shared_ptr<Builder> Find(AZ::Uuid uuid);
  21. BuilderRef GetFirst(BuilderPurpose purpose);
  22. AZStd::string RemoveByConnectionId(AZ::u32 connId);
  23. void RemoveByUuid(AZ::Uuid uuid);
  24. void PumpIdleBuilders();
  25. AZ_DISABLE_COPY_MOVE(BuilderList);
  26. protected:
  27. AZStd::unordered_map<AZ::Uuid, AZStd::shared_ptr<Builder>> m_builders;
  28. AZStd::shared_ptr<Builder> m_createJobsBuilder; // Special builder reserved for create jobs to ensure CreateJobs never waits for process startup
  29. };
  30. } // namespace AssetProcessor