78 lines
2.0 KiB
C++
78 lines
2.0 KiB
C++
|
|
/**
|
|||
|
|
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|||
|
|
* SPDX-License-Identifier: Apache-2.0.
|
|||
|
|
*/
|
|||
|
|
|
|||
|
|
#include <aws/connect/model/Statistic.h>
|
|||
|
|
#include <aws/core/utils/HashingUtils.h>
|
|||
|
|
#include <aws/core/Globals.h>
|
|||
|
|
#include <aws/core/utils/EnumParseOverflowContainer.h>
|
|||
|
|
|
|||
|
|
using namespace Aws::Utils;
|
|||
|
|
|
|||
|
|
|
|||
|
|
namespace Aws
|
|||
|
|
{
|
|||
|
|
namespace Connect
|
|||
|
|
{
|
|||
|
|
namespace Model
|
|||
|
|
{
|
|||
|
|
namespace StatisticMapper
|
|||
|
|
{
|
|||
|
|
|
|||
|
|
static const int SUM_HASH = HashingUtils::HashString("SUM");
|
|||
|
|
static const int MAX_HASH = HashingUtils::HashString("MAX");
|
|||
|
|
static const int AVG_HASH = HashingUtils::HashString("AVG");
|
|||
|
|
|
|||
|
|
|
|||
|
|
Statistic GetStatisticForName(const Aws::String& name)
|
|||
|
|
{
|
|||
|
|
int hashCode = HashingUtils::HashString(name.c_str());
|
|||
|
|
if (hashCode == SUM_HASH)
|
|||
|
|
{
|
|||
|
|
return Statistic::SUM;
|
|||
|
|
}
|
|||
|
|
else if (hashCode == MAX_HASH)
|
|||
|
|
{
|
|||
|
|
return Statistic::MAX;
|
|||
|
|
}
|
|||
|
|
else if (hashCode == AVG_HASH)
|
|||
|
|
{
|
|||
|
|
return Statistic::AVG;
|
|||
|
|
}
|
|||
|
|
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
|
|||
|
|
if(overflowContainer)
|
|||
|
|
{
|
|||
|
|
overflowContainer->StoreOverflow(hashCode, name);
|
|||
|
|
return static_cast<Statistic>(hashCode);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return Statistic::NOT_SET;
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Aws::String GetNameForStatistic(Statistic enumValue)
|
|||
|
|
{
|
|||
|
|
switch(enumValue)
|
|||
|
|
{
|
|||
|
|
case Statistic::SUM:
|
|||
|
|
return "SUM";
|
|||
|
|
case Statistic::MAX:
|
|||
|
|
return "MAX";
|
|||
|
|
case Statistic::AVG:
|
|||
|
|
return "AVG";
|
|||
|
|
default:
|
|||
|
|
EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
|
|||
|
|
if(overflowContainer)
|
|||
|
|
{
|
|||
|
|
return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return {};
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
} // namespace StatisticMapper
|
|||
|
|
} // namespace Model
|
|||
|
|
} // namespace Connect
|
|||
|
|
} // namespace Aws
|