Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute enum hashes at compile time #2701

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ template<> AWS_MIGRATIONHUB_API ThrottlingException MigrationHubError::GetModele
namespace MigrationHubErrorMapper
{

static const int DRY_RUN_OPERATION_HASH = HashingUtils::HashString("DryRunOperation");
static const int UNAUTHORIZED_OPERATION_HASH = HashingUtils::HashString("UnauthorizedOperation");
static const int POLICY_ERROR_HASH = HashingUtils::HashString("PolicyErrorException");
static const int INVALID_INPUT_HASH = HashingUtils::HashString("InvalidInputException");
static const int HOME_REGION_NOT_SET_HASH = HashingUtils::HashString("HomeRegionNotSetException");
static constexpr uint32_t DRY_RUN_OPERATION_HASH = ConstExprHashingUtils::HashString("DryRunOperation");
static constexpr uint32_t UNAUTHORIZED_OPERATION_HASH = ConstExprHashingUtils::HashString("UnauthorizedOperation");
static constexpr uint32_t POLICY_ERROR_HASH = ConstExprHashingUtils::HashString("PolicyErrorException");
static constexpr uint32_t INVALID_INPUT_HASH = ConstExprHashingUtils::HashString("InvalidInputException");
static constexpr uint32_t HOME_REGION_NOT_SET_HASH = ConstExprHashingUtils::HashString("HomeRegionNotSetException");


AWSError<CoreErrors> GetErrorForName(const char* errorName)
{
int hashCode = HashingUtils::HashString(errorName);
uint32_t hashCode = HashingUtils::HashString(errorName);

if (hashCode == DRY_RUN_OPERATION_HASH)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace Aws
namespace ApplicationStatusMapper
{

static const int NOT_STARTED_HASH = HashingUtils::HashString("NOT_STARTED");
static const int IN_PROGRESS_HASH = HashingUtils::HashString("IN_PROGRESS");
static const int COMPLETED_HASH = HashingUtils::HashString("COMPLETED");
static constexpr uint32_t NOT_STARTED_HASH = ConstExprHashingUtils::HashString("NOT_STARTED");
static constexpr uint32_t IN_PROGRESS_HASH = ConstExprHashingUtils::HashString("IN_PROGRESS");
static constexpr uint32_t COMPLETED_HASH = ConstExprHashingUtils::HashString("COMPLETED");


ApplicationStatus GetApplicationStatusForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == NOT_STARTED_HASH)
{
return ApplicationStatus::NOT_STARTED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ namespace Aws
namespace ResourceAttributeTypeMapper
{

static const int IPV4_ADDRESS_HASH = HashingUtils::HashString("IPV4_ADDRESS");
static const int IPV6_ADDRESS_HASH = HashingUtils::HashString("IPV6_ADDRESS");
static const int MAC_ADDRESS_HASH = HashingUtils::HashString("MAC_ADDRESS");
static const int FQDN_HASH = HashingUtils::HashString("FQDN");
static const int VM_MANAGER_ID_HASH = HashingUtils::HashString("VM_MANAGER_ID");
static const int VM_MANAGED_OBJECT_REFERENCE_HASH = HashingUtils::HashString("VM_MANAGED_OBJECT_REFERENCE");
static const int VM_NAME_HASH = HashingUtils::HashString("VM_NAME");
static const int VM_PATH_HASH = HashingUtils::HashString("VM_PATH");
static const int BIOS_ID_HASH = HashingUtils::HashString("BIOS_ID");
static const int MOTHERBOARD_SERIAL_NUMBER_HASH = HashingUtils::HashString("MOTHERBOARD_SERIAL_NUMBER");
static constexpr uint32_t IPV4_ADDRESS_HASH = ConstExprHashingUtils::HashString("IPV4_ADDRESS");
static constexpr uint32_t IPV6_ADDRESS_HASH = ConstExprHashingUtils::HashString("IPV6_ADDRESS");
static constexpr uint32_t MAC_ADDRESS_HASH = ConstExprHashingUtils::HashString("MAC_ADDRESS");
static constexpr uint32_t FQDN_HASH = ConstExprHashingUtils::HashString("FQDN");
static constexpr uint32_t VM_MANAGER_ID_HASH = ConstExprHashingUtils::HashString("VM_MANAGER_ID");
static constexpr uint32_t VM_MANAGED_OBJECT_REFERENCE_HASH = ConstExprHashingUtils::HashString("VM_MANAGED_OBJECT_REFERENCE");
static constexpr uint32_t VM_NAME_HASH = ConstExprHashingUtils::HashString("VM_NAME");
static constexpr uint32_t VM_PATH_HASH = ConstExprHashingUtils::HashString("VM_PATH");
static constexpr uint32_t BIOS_ID_HASH = ConstExprHashingUtils::HashString("BIOS_ID");
static constexpr uint32_t MOTHERBOARD_SERIAL_NUMBER_HASH = ConstExprHashingUtils::HashString("MOTHERBOARD_SERIAL_NUMBER");


ResourceAttributeType GetResourceAttributeTypeForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == IPV4_ADDRESS_HASH)
{
return ResourceAttributeType::IPV4_ADDRESS;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ namespace Aws
namespace StatusMapper
{

static const int NOT_STARTED_HASH = HashingUtils::HashString("NOT_STARTED");
static const int IN_PROGRESS_HASH = HashingUtils::HashString("IN_PROGRESS");
static const int FAILED_HASH = HashingUtils::HashString("FAILED");
static const int COMPLETED_HASH = HashingUtils::HashString("COMPLETED");
static constexpr uint32_t NOT_STARTED_HASH = ConstExprHashingUtils::HashString("NOT_STARTED");
static constexpr uint32_t IN_PROGRESS_HASH = ConstExprHashingUtils::HashString("IN_PROGRESS");
static constexpr uint32_t FAILED_HASH = ConstExprHashingUtils::HashString("FAILED");
static constexpr uint32_t COMPLETED_HASH = ConstExprHashingUtils::HashString("COMPLETED");


Status GetStatusForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == NOT_STARTED_HASH)
{
return Status::NOT_STARTED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ template<> AWS_ACCESSANALYZER_API ValidationException AccessAnalyzerError::GetMo
namespace AccessAnalyzerErrorMapper
{

static const int CONFLICT_HASH = HashingUtils::HashString("ConflictException");
static const int SERVICE_QUOTA_EXCEEDED_HASH = HashingUtils::HashString("ServiceQuotaExceededException");
static const int INTERNAL_SERVER_HASH = HashingUtils::HashString("InternalServerException");
static constexpr uint32_t CONFLICT_HASH = ConstExprHashingUtils::HashString("ConflictException");
static constexpr uint32_t SERVICE_QUOTA_EXCEEDED_HASH = ConstExprHashingUtils::HashString("ServiceQuotaExceededException");
static constexpr uint32_t INTERNAL_SERVER_HASH = ConstExprHashingUtils::HashString("InternalServerException");


AWSError<CoreErrors> GetErrorForName(const char* errorName)
{
int hashCode = HashingUtils::HashString(errorName);
uint32_t hashCode = HashingUtils::HashString(errorName);

if (hashCode == CONFLICT_HASH)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace Aws
namespace AccessPreviewStatusMapper
{

static const int COMPLETED_HASH = HashingUtils::HashString("COMPLETED");
static const int CREATING_HASH = HashingUtils::HashString("CREATING");
static const int FAILED_HASH = HashingUtils::HashString("FAILED");
static constexpr uint32_t COMPLETED_HASH = ConstExprHashingUtils::HashString("COMPLETED");
static constexpr uint32_t CREATING_HASH = ConstExprHashingUtils::HashString("CREATING");
static constexpr uint32_t FAILED_HASH = ConstExprHashingUtils::HashString("FAILED");


AccessPreviewStatus GetAccessPreviewStatusForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == COMPLETED_HASH)
{
return AccessPreviewStatus::COMPLETED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ namespace Aws
namespace AccessPreviewStatusReasonCodeMapper
{

static const int INTERNAL_ERROR_HASH = HashingUtils::HashString("INTERNAL_ERROR");
static const int INVALID_CONFIGURATION_HASH = HashingUtils::HashString("INVALID_CONFIGURATION");
static constexpr uint32_t INTERNAL_ERROR_HASH = ConstExprHashingUtils::HashString("INTERNAL_ERROR");
static constexpr uint32_t INVALID_CONFIGURATION_HASH = ConstExprHashingUtils::HashString("INVALID_CONFIGURATION");


AccessPreviewStatusReasonCode GetAccessPreviewStatusReasonCodeForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == INTERNAL_ERROR_HASH)
{
return AccessPreviewStatusReasonCode::INTERNAL_ERROR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ namespace Aws
namespace AclPermissionMapper
{

static const int READ_HASH = HashingUtils::HashString("READ");
static const int WRITE_HASH = HashingUtils::HashString("WRITE");
static const int READ_ACP_HASH = HashingUtils::HashString("READ_ACP");
static const int WRITE_ACP_HASH = HashingUtils::HashString("WRITE_ACP");
static const int FULL_CONTROL_HASH = HashingUtils::HashString("FULL_CONTROL");
static constexpr uint32_t READ_HASH = ConstExprHashingUtils::HashString("READ");
static constexpr uint32_t WRITE_HASH = ConstExprHashingUtils::HashString("WRITE");
static constexpr uint32_t READ_ACP_HASH = ConstExprHashingUtils::HashString("READ_ACP");
static constexpr uint32_t WRITE_ACP_HASH = ConstExprHashingUtils::HashString("WRITE_ACP");
static constexpr uint32_t FULL_CONTROL_HASH = ConstExprHashingUtils::HashString("FULL_CONTROL");


AclPermission GetAclPermissionForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == READ_HASH)
{
return AclPermission::READ;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ namespace Aws
namespace AnalyzerStatusMapper
{

static const int ACTIVE_HASH = HashingUtils::HashString("ACTIVE");
static const int CREATING_HASH = HashingUtils::HashString("CREATING");
static const int DISABLED_HASH = HashingUtils::HashString("DISABLED");
static const int FAILED_HASH = HashingUtils::HashString("FAILED");
static constexpr uint32_t ACTIVE_HASH = ConstExprHashingUtils::HashString("ACTIVE");
static constexpr uint32_t CREATING_HASH = ConstExprHashingUtils::HashString("CREATING");
static constexpr uint32_t DISABLED_HASH = ConstExprHashingUtils::HashString("DISABLED");
static constexpr uint32_t FAILED_HASH = ConstExprHashingUtils::HashString("FAILED");


AnalyzerStatus GetAnalyzerStatusForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == ACTIVE_HASH)
{
return AnalyzerStatus::ACTIVE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace Aws
namespace FindingChangeTypeMapper
{

static const int CHANGED_HASH = HashingUtils::HashString("CHANGED");
static const int NEW__HASH = HashingUtils::HashString("NEW");
static const int UNCHANGED_HASH = HashingUtils::HashString("UNCHANGED");
static constexpr uint32_t CHANGED_HASH = ConstExprHashingUtils::HashString("CHANGED");
static constexpr uint32_t NEW__HASH = ConstExprHashingUtils::HashString("NEW");
static constexpr uint32_t UNCHANGED_HASH = ConstExprHashingUtils::HashString("UNCHANGED");


FindingChangeType GetFindingChangeTypeForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == CHANGED_HASH)
{
return FindingChangeType::CHANGED;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ namespace Aws
namespace FindingSourceTypeMapper
{

static const int POLICY_HASH = HashingUtils::HashString("POLICY");
static const int BUCKET_ACL_HASH = HashingUtils::HashString("BUCKET_ACL");
static const int S3_ACCESS_POINT_HASH = HashingUtils::HashString("S3_ACCESS_POINT");
static const int S3_ACCESS_POINT_ACCOUNT_HASH = HashingUtils::HashString("S3_ACCESS_POINT_ACCOUNT");
static constexpr uint32_t POLICY_HASH = ConstExprHashingUtils::HashString("POLICY");
static constexpr uint32_t BUCKET_ACL_HASH = ConstExprHashingUtils::HashString("BUCKET_ACL");
static constexpr uint32_t S3_ACCESS_POINT_HASH = ConstExprHashingUtils::HashString("S3_ACCESS_POINT");
static constexpr uint32_t S3_ACCESS_POINT_ACCOUNT_HASH = ConstExprHashingUtils::HashString("S3_ACCESS_POINT_ACCOUNT");


FindingSourceType GetFindingSourceTypeForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == POLICY_HASH)
{
return FindingSourceType::POLICY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ namespace Aws
namespace FindingStatusMapper
{

static const int ACTIVE_HASH = HashingUtils::HashString("ACTIVE");
static const int ARCHIVED_HASH = HashingUtils::HashString("ARCHIVED");
static const int RESOLVED_HASH = HashingUtils::HashString("RESOLVED");
static constexpr uint32_t ACTIVE_HASH = ConstExprHashingUtils::HashString("ACTIVE");
static constexpr uint32_t ARCHIVED_HASH = ConstExprHashingUtils::HashString("ARCHIVED");
static constexpr uint32_t RESOLVED_HASH = ConstExprHashingUtils::HashString("RESOLVED");


FindingStatus GetFindingStatusForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == ACTIVE_HASH)
{
return FindingStatus::ACTIVE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ namespace Aws
namespace FindingStatusUpdateMapper
{

static const int ACTIVE_HASH = HashingUtils::HashString("ACTIVE");
static const int ARCHIVED_HASH = HashingUtils::HashString("ARCHIVED");
static constexpr uint32_t ACTIVE_HASH = ConstExprHashingUtils::HashString("ACTIVE");
static constexpr uint32_t ARCHIVED_HASH = ConstExprHashingUtils::HashString("ARCHIVED");


FindingStatusUpdate GetFindingStatusUpdateForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == ACTIVE_HASH)
{
return FindingStatusUpdate::ACTIVE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ namespace Aws
namespace JobErrorCodeMapper
{

static const int AUTHORIZATION_ERROR_HASH = HashingUtils::HashString("AUTHORIZATION_ERROR");
static const int RESOURCE_NOT_FOUND_ERROR_HASH = HashingUtils::HashString("RESOURCE_NOT_FOUND_ERROR");
static const int SERVICE_QUOTA_EXCEEDED_ERROR_HASH = HashingUtils::HashString("SERVICE_QUOTA_EXCEEDED_ERROR");
static const int SERVICE_ERROR_HASH = HashingUtils::HashString("SERVICE_ERROR");
static constexpr uint32_t AUTHORIZATION_ERROR_HASH = ConstExprHashingUtils::HashString("AUTHORIZATION_ERROR");
static constexpr uint32_t RESOURCE_NOT_FOUND_ERROR_HASH = ConstExprHashingUtils::HashString("RESOURCE_NOT_FOUND_ERROR");
static constexpr uint32_t SERVICE_QUOTA_EXCEEDED_ERROR_HASH = ConstExprHashingUtils::HashString("SERVICE_QUOTA_EXCEEDED_ERROR");
static constexpr uint32_t SERVICE_ERROR_HASH = ConstExprHashingUtils::HashString("SERVICE_ERROR");


JobErrorCode GetJobErrorCodeForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == AUTHORIZATION_ERROR_HASH)
{
return JobErrorCode::AUTHORIZATION_ERROR;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ namespace Aws
namespace JobStatusMapper
{

static const int IN_PROGRESS_HASH = HashingUtils::HashString("IN_PROGRESS");
static const int SUCCEEDED_HASH = HashingUtils::HashString("SUCCEEDED");
static const int FAILED_HASH = HashingUtils::HashString("FAILED");
static const int CANCELED_HASH = HashingUtils::HashString("CANCELED");
static constexpr uint32_t IN_PROGRESS_HASH = ConstExprHashingUtils::HashString("IN_PROGRESS");
static constexpr uint32_t SUCCEEDED_HASH = ConstExprHashingUtils::HashString("SUCCEEDED");
static constexpr uint32_t FAILED_HASH = ConstExprHashingUtils::HashString("FAILED");
static constexpr uint32_t CANCELED_HASH = ConstExprHashingUtils::HashString("CANCELED");


JobStatus GetJobStatusForName(const Aws::String& name)
{
int hashCode = HashingUtils::HashString(name.c_str());
uint32_t hashCode = HashingUtils::HashString(name.c_str());
if (hashCode == IN_PROGRESS_HASH)
{
return JobStatus::IN_PROGRESS;
Expand Down
Loading