1 /** 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * SPDX-License-Identifier: Apache-2.0. 4 */ 5 6 #include <aws/rekognition/model/OrientationCorrection.h> 7 #include <aws/core/utils/HashingUtils.h> 8 #include <aws/core/Globals.h> 9 #include <aws/core/utils/EnumParseOverflowContainer.h> 10 11 using namespace Aws::Utils; 12 13 14 namespace Aws 15 { 16 namespace Rekognition 17 { 18 namespace Model 19 { 20 namespace OrientationCorrectionMapper 21 { 22 23 static const int ROTATE_0_HASH = HashingUtils::HashString("ROTATE_0"); 24 static const int ROTATE_90_HASH = HashingUtils::HashString("ROTATE_90"); 25 static const int ROTATE_180_HASH = HashingUtils::HashString("ROTATE_180"); 26 static const int ROTATE_270_HASH = HashingUtils::HashString("ROTATE_270"); 27 28 GetOrientationCorrectionForName(const Aws::String & name)29 OrientationCorrection GetOrientationCorrectionForName(const Aws::String& name) 30 { 31 int hashCode = HashingUtils::HashString(name.c_str()); 32 if (hashCode == ROTATE_0_HASH) 33 { 34 return OrientationCorrection::ROTATE_0; 35 } 36 else if (hashCode == ROTATE_90_HASH) 37 { 38 return OrientationCorrection::ROTATE_90; 39 } 40 else if (hashCode == ROTATE_180_HASH) 41 { 42 return OrientationCorrection::ROTATE_180; 43 } 44 else if (hashCode == ROTATE_270_HASH) 45 { 46 return OrientationCorrection::ROTATE_270; 47 } 48 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 49 if(overflowContainer) 50 { 51 overflowContainer->StoreOverflow(hashCode, name); 52 return static_cast<OrientationCorrection>(hashCode); 53 } 54 55 return OrientationCorrection::NOT_SET; 56 } 57 GetNameForOrientationCorrection(OrientationCorrection enumValue)58 Aws::String GetNameForOrientationCorrection(OrientationCorrection enumValue) 59 { 60 switch(enumValue) 61 { 62 case OrientationCorrection::ROTATE_0: 63 return "ROTATE_0"; 64 case OrientationCorrection::ROTATE_90: 65 return "ROTATE_90"; 66 case OrientationCorrection::ROTATE_180: 67 return "ROTATE_180"; 68 case OrientationCorrection::ROTATE_270: 69 return "ROTATE_270"; 70 default: 71 EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); 72 if(overflowContainer) 73 { 74 return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); 75 } 76 77 return {}; 78 } 79 } 80 81 } // namespace OrientationCorrectionMapper 82 } // namespace Model 83 } // namespace Rekognition 84 } // namespace Aws 85