You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
5.9 KiB

1 year ago
  1. /**
  2. * @file FSDKError.h
  3. * @brief Common SDK error codes.
  4. * @copyright VisionLabs LLC
  5. * @date 25.06.2014
  6. * */
  7. #pragma once
  8. #include <fsdk/Types/Result.h>
  9. namespace fsdk {
  10. /**
  11. * @brief Common SDK error codes.
  12. * */
  13. enum class FSDKError : uint32_t {
  14. Ok, //!< Ok.
  15. Internal, //!< Internal error.
  16. InvalidInput, //!< Invalid input.
  17. InvalidImage, //!< Invalid image.
  18. InvalidRect, //!< Invalid rectangle.
  19. InvalidImageFormat, //!< Invalid image format.
  20. InvalidImageSize, //!< Invalid image size.
  21. InvalidDetection, //!< Invalid detection.
  22. InvalidLandmarks5, //!< Invalid landmarks 5.
  23. InvalidLandmarks68, //!< Invalid landmarks 68.
  24. InvalidTransformation, //!< Invalid transformation.
  25. InvalidDescriptor, //!< Invalid descriptor.
  26. InvalidDescriptorBatch, //!< Invalid descriptor batch.
  27. InvalidSettingsProvider, //!< Invalid settings provider.
  28. InvalidDescriptorId, //!< Invalid descriptor id
  29. InvalidPath, //!< Invalid path to object
  30. InvalidSerializedObject, //!< Invalid serialized object
  31. ModuleNotInitialized, //!< Module is not initialized.
  32. ModuleNotReady, //!< Module is not ready.
  33. LicenseError, //!< Licensing issue (expired license or unavailable feature).
  34. BufferIsNull, //!< Buffer is null.
  35. BufferIsFull, //!< Buffer is full.
  36. BufferIsEmpty, //!< Buffer is empty.
  37. InvalidBufferSize, //!< Invalid buffer size.
  38. InvalidSpanSize, //!< Invalid span size.
  39. InvalidBatch, //!< Invalid batch.
  40. IncompatibleDescriptors, //!< Matching attempt with incompatible descriptors.
  41. EnableJustInBetaMode, //!< Attempt to create feature while betaMode is turned off
  42. FiltredAggregationError, //!< Cant aggregate descriptors - all images'a GSs are less the threashold
  43. BatchedInternalError, //!< Something gone wrong in batched query. See batch with error codes to each input image for details.
  44. UnsupportedFunctionality, // !< was requested unsupported functionality for this type of descroptor or for this model version
  45. HighMemoryUsage, // !< Operation required a lot of memory. Batch size if too big for example.
  46. IncompatibleModelVersions, //!< Incompatible model versions.
  47. ModelNotLoaded, //!< Model not loaded.
  48. InvalidConfig, //!< Invalid config
  49. LicenseIsNotActivated, //!< License is not activated.
  50. FeatureNotAvailable, //!< Requested Feature not available.
  51. FeatureExpired, //!< Feature expired
  52. FingerprintError, //!< Failed to get device fingerprint.
  53. ValidationFailed, //!< Failed validation.
  54. NotImplemented, //!< Not implemented error.
  55. };
  56. /**
  57. * @brief Specialized for FSDKError.
  58. * */
  59. template<>
  60. struct ErrorTraits<FSDKError> {
  61. static bool isOk(FSDKError error) noexcept {
  62. return error == FSDKError::Ok;
  63. }
  64. static const char* toString (FSDKError error) noexcept {
  65. switch(error) {
  66. case FSDKError::Ok: return "Ok";
  67. case FSDKError::Internal: return "Internal error";
  68. case FSDKError::InvalidInput: return "Invalid input";
  69. case FSDKError::InvalidImage: return "Invalid image";
  70. case FSDKError::InvalidRect: return "Invalid rectangle";
  71. case FSDKError::InvalidImageFormat: return "Invalid image format";
  72. case FSDKError::InvalidImageSize: return "Invalid image size";
  73. case FSDKError::InvalidDetection: return "Invalid detection";
  74. case FSDKError::InvalidLandmarks5: return "Invalid landmarks 5";
  75. case FSDKError::InvalidLandmarks68: return "Invalid landmarks 68";
  76. case FSDKError::InvalidTransformation: return "Invalid transformation.";
  77. case FSDKError::InvalidDescriptor: return "Invalid descriptor";
  78. case FSDKError::InvalidDescriptorBatch: return "Invalid descriptor batch.";
  79. case FSDKError::InvalidSettingsProvider: return "Invalid settings provider..";
  80. case FSDKError::InvalidDescriptorId: return "Invalid descriptor id.";
  81. case FSDKError::InvalidPath: return "Invalid path.";
  82. case FSDKError::InvalidSerializedObject: return "Invalid serialized object.";
  83. case FSDKError::ModuleNotInitialized: return "Module is not initialized";
  84. case FSDKError::ModuleNotReady: return "Module is not ready";
  85. case FSDKError::LicenseError: return "Licensing issue";
  86. case FSDKError::BufferIsNull: return "Buffer is null";
  87. case FSDKError::BufferIsFull: return "Buffer is full";
  88. case FSDKError::BufferIsEmpty: return "Buffer is empty";
  89. case FSDKError::InvalidBufferSize: return "Invalid buffer size";
  90. case FSDKError::InvalidSpanSize: return "Invalid span size";
  91. case FSDKError::InvalidBatch: return "Invalid Batch";
  92. case FSDKError::IncompatibleDescriptors: return "Descriptors are incompatible";
  93. case FSDKError::EnableJustInBetaMode: return "Attempt to create feature while betaMode is turned off";
  94. case FSDKError::FiltredAggregationError: return "Cant aggregate descriptors - all images'a GSs are less the threashold";
  95. case FSDKError::BatchedInternalError: return "Something gone wrong in batched query";
  96. case FSDKError::UnsupportedFunctionality: return "Was requested unsupported functionality";
  97. case FSDKError::HighMemoryUsage: return "Operation required a lot of memory";
  98. case FSDKError::IncompatibleModelVersions: return "Incompatible model versions";
  99. case FSDKError::ModelNotLoaded: return "Model not loaded";
  100. case FSDKError::InvalidConfig: return "Invalid config";
  101. case FSDKError::LicenseIsNotActivated: return "License is not activated!";
  102. case FSDKError::FeatureNotAvailable: return "Requested Feature not available.";
  103. case FSDKError::FeatureExpired: return "Feature is expired.";
  104. case FSDKError::FingerprintError: return "Failed to get device fingerprint.";
  105. case FSDKError::ValidationFailed: return "Failed validation.";
  106. case FSDKError::NotImplemented: return "Not implemented.";
  107. default: return "Unknown error";
  108. }
  109. }
  110. };
  111. }