This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
pxz-hos-client-cpp-module/support/aws-sdk-cpp-master/aws-cpp-sdk-comprehendmedical/source/model/RxNormAttribute.cpp

184 lines
3.7 KiB
C++
Raw Normal View History

/**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/comprehendmedical/model/RxNormAttribute.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
namespace Aws
{
namespace ComprehendMedical
{
namespace Model
{
RxNormAttribute::RxNormAttribute() :
m_type(RxNormAttributeType::NOT_SET),
m_typeHasBeenSet(false),
m_score(0.0),
m_scoreHasBeenSet(false),
m_relationshipScore(0.0),
m_relationshipScoreHasBeenSet(false),
m_id(0),
m_idHasBeenSet(false),
m_beginOffset(0),
m_beginOffsetHasBeenSet(false),
m_endOffset(0),
m_endOffsetHasBeenSet(false),
m_textHasBeenSet(false),
m_traitsHasBeenSet(false)
{
}
RxNormAttribute::RxNormAttribute(JsonView jsonValue) :
m_type(RxNormAttributeType::NOT_SET),
m_typeHasBeenSet(false),
m_score(0.0),
m_scoreHasBeenSet(false),
m_relationshipScore(0.0),
m_relationshipScoreHasBeenSet(false),
m_id(0),
m_idHasBeenSet(false),
m_beginOffset(0),
m_beginOffsetHasBeenSet(false),
m_endOffset(0),
m_endOffsetHasBeenSet(false),
m_textHasBeenSet(false),
m_traitsHasBeenSet(false)
{
*this = jsonValue;
}
RxNormAttribute& RxNormAttribute::operator =(JsonView jsonValue)
{
if(jsonValue.ValueExists("Type"))
{
m_type = RxNormAttributeTypeMapper::GetRxNormAttributeTypeForName(jsonValue.GetString("Type"));
m_typeHasBeenSet = true;
}
if(jsonValue.ValueExists("Score"))
{
m_score = jsonValue.GetDouble("Score");
m_scoreHasBeenSet = true;
}
if(jsonValue.ValueExists("RelationshipScore"))
{
m_relationshipScore = jsonValue.GetDouble("RelationshipScore");
m_relationshipScoreHasBeenSet = true;
}
if(jsonValue.ValueExists("Id"))
{
m_id = jsonValue.GetInteger("Id");
m_idHasBeenSet = true;
}
if(jsonValue.ValueExists("BeginOffset"))
{
m_beginOffset = jsonValue.GetInteger("BeginOffset");
m_beginOffsetHasBeenSet = true;
}
if(jsonValue.ValueExists("EndOffset"))
{
m_endOffset = jsonValue.GetInteger("EndOffset");
m_endOffsetHasBeenSet = true;
}
if(jsonValue.ValueExists("Text"))
{
m_text = jsonValue.GetString("Text");
m_textHasBeenSet = true;
}
if(jsonValue.ValueExists("Traits"))
{
Array<JsonView> traitsJsonList = jsonValue.GetArray("Traits");
for(unsigned traitsIndex = 0; traitsIndex < traitsJsonList.GetLength(); ++traitsIndex)
{
m_traits.push_back(traitsJsonList[traitsIndex].AsObject());
}
m_traitsHasBeenSet = true;
}
return *this;
}
JsonValue RxNormAttribute::Jsonize() const
{
JsonValue payload;
if(m_typeHasBeenSet)
{
payload.WithString("Type", RxNormAttributeTypeMapper::GetNameForRxNormAttributeType(m_type));
}
if(m_scoreHasBeenSet)
{
payload.WithDouble("Score", m_score);
}
if(m_relationshipScoreHasBeenSet)
{
payload.WithDouble("RelationshipScore", m_relationshipScore);
}
if(m_idHasBeenSet)
{
payload.WithInteger("Id", m_id);
}
if(m_beginOffsetHasBeenSet)
{
payload.WithInteger("BeginOffset", m_beginOffset);
}
if(m_endOffsetHasBeenSet)
{
payload.WithInteger("EndOffset", m_endOffset);
}
if(m_textHasBeenSet)
{
payload.WithString("Text", m_text);
}
if(m_traitsHasBeenSet)
{
Array<JsonValue> traitsJsonList(m_traits.size());
for(unsigned traitsIndex = 0; traitsIndex < traitsJsonList.GetLength(); ++traitsIndex)
{
traitsJsonList[traitsIndex].AsObject(m_traits[traitsIndex].Jsonize());
}
payload.WithArray("Traits", std::move(traitsJsonList));
}
return payload;
}
} // namespace Model
} // namespace ComprehendMedical
} // namespace Aws