RCCommon.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. protected:
  30. SourceAssetReference m_sourceAssetReference;
  31. QString m_platform;
  32. QString m_jobDescriptor;
  33. };
  34. uint qHash(const AssetProcessor::QueueElementID& key, uint seed = 0);
  35. } // namespace AssetProcessor
  36. namespace AZStd {
  37. // Implement the hash for QueueElementID, so it can be used as the key of AZStd::unordered_map
  38. template <>
  39. struct hash<AssetProcessor::QueueElementID>
  40. {
  41. inline size_t operator()(const AssetProcessor::QueueElementID& key) const
  42. {
  43. return AssetProcessor::qHash(key);
  44. }
  45. };
  46. } // namespace AZStd
  47. #endif //ASSETPROCESSOR_RCQUEUESORTMODEL_H