/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include using namespace Aws::Utils; namespace Aws { namespace ComputeOptimizer { namespace Model { namespace MetricNameMapper { static const int Cpu_HASH = HashingUtils::HashString("Cpu"); static const int Memory_HASH = HashingUtils::HashString("Memory"); MetricName GetMetricNameForName(const Aws::String& name) { int hashCode = HashingUtils::HashString(name.c_str()); if (hashCode == Cpu_HASH) { return MetricName::Cpu; } else if (hashCode == Memory_HASH) { return MetricName::Memory; } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { overflowContainer->StoreOverflow(hashCode, name); return static_cast(hashCode); } return MetricName::NOT_SET; } Aws::String GetNameForMetricName(MetricName enumValue) { switch(enumValue) { case MetricName::Cpu: return "Cpu"; case MetricName::Memory: return "Memory"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { return overflowContainer->RetrieveOverflow(static_cast(enumValue)); } return {}; } } } // namespace MetricNameMapper } // namespace Model } // namespace ComputeOptimizer } // namespace Aws