RCCommon.h 1.8 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. #ifndef ASSETPROCESSOR_RCCOMMON_H
  9. #define ASSETPROCESSOR_RCCOMMON_H
  10. #include <AzCore/std/functional.h>
  11. #include <QString>
  12. #include <AssetManager/SourceAssetReference.h>
  13. namespace AssetProcessor
  14. {
  15. //! Identifies a queued job uniquely. Not a case sensitive compare
  16. class QueueElementID
  17. {
  18. public:
  19. QueueElementID() = default;
  20. QueueElementID(SourceAssetReference sourceAssetReference, QString platform, QString jobDescriptor);
  21. SourceAssetReference GetSourceAssetReference() const;
  22. QString GetPlatform() const;
  23. QString GetJobDescriptor() const;
  24. void SetSourceAssetReference(SourceAssetReference sourceAssetReference);
  25. void SetPlatform(QString platform);
  26. void SetJobDescriptor(QString jobDescriptor);
  27. bool operator==(const QueueElementID& other) const;
  28. bool operator<(const QueueElementID& other) const;
  29. bool operator!=(const QueueElementID& other) const;
  30. protected:
  31. SourceAssetReference m_sourceAssetReference;
  32. QString m_platform;
  33. QString m_jobDescriptor;
  34. };
  35. uint qHash(const AssetProcessor::QueueElementID& key, uint seed = 0);
  36. } // namespace AssetProcessor
  37. namespace AZStd {
  38. // Implement the hash for QueueElementID, so it can be used as the key of AZStd::unordered_map
  39. template <>
  40. struct hash<AssetProcessor::QueueElementID>
  41. {
  42. inline size_t operator()(const AssetProcessor::QueueElementID& key) const
  43. {
  44. return AssetProcessor::qHash(key);
  45. }
  46. };
  47. } // namespace AZStd
  48. #endif //ASSETPROCESSOR_RCQUEUESORTMODEL_H