ServiceJobConfig.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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 <Framework/HttpRequestJobConfig.h>
  10. namespace AWSCore
  11. {
  12. /// Provides configuration needed by service jobs.
  13. class IServiceJobConfig
  14. : public virtual IHttpRequestJobConfig
  15. {
  16. };
  17. // warning C4250: 'AWSCore::ServiceJobConfig' : inherits 'AWSCore::AwsApiJobConfig::AWSCore::AwsApiJobConfig::GetJobContext' via dominance
  18. // Thanks to http://stackoverflow.com/questions/11965596/diamond-inheritance-scenario-compiles-fine-in-g-but-produces-warnings-errors for the explanation
  19. // This is the expected and desired behavior. The warning is superfluous.
  20. AZ_PUSH_DISABLE_WARNING(4250, "-Wunknown-warning-option")
  21. /// Provides service job configuration using settings properties.
  22. class ServiceJobConfig
  23. : public HttpRequestJobConfig
  24. , public virtual IServiceJobConfig
  25. {
  26. public:
  27. AZ_CLASS_ALLOCATOR(ServiceJobConfig, AZ::SystemAllocator);
  28. using InitializerFunction = AZStd::function<void(ServiceJobConfig& config)>;
  29. /// Initialize an ServiceJobConfig object.
  30. ///
  31. /// \param defaultConfig - the config object that provides values when
  32. /// no override has been set in this object. The default is nullptr, which
  33. /// will cause a default value to be used.
  34. ///
  35. /// \param initializer - a function called to initialize this object.
  36. /// This simplifies the initialization of static instances. The default
  37. /// value is nullptr, in which case no initializer will be called.
  38. ServiceJobConfig(AwsApiJobConfig* defaultConfig = nullptr, InitializerFunction initializer = nullptr)
  39. : HttpRequestJobConfig{ defaultConfig }
  40. {
  41. if (initializer)
  42. {
  43. initializer(*this);
  44. }
  45. }
  46. void ApplySettings() override;
  47. };
  48. AZ_POP_DISABLE_WARNING
  49. } // namespace AWSCore