/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include #include #include #include #include #include #include using namespace Aws::LocationService::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; CalculateRouteMatrixResult::CalculateRouteMatrixResult() { } CalculateRouteMatrixResult::CalculateRouteMatrixResult(const Aws::AmazonWebServiceResult& result) { *this = result; } CalculateRouteMatrixResult& CalculateRouteMatrixResult::operator =(const Aws::AmazonWebServiceResult& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("RouteMatrix")) { Aws::Utils::Array routeMatrixJsonList = jsonValue.GetArray("RouteMatrix"); for(unsigned routeMatrixIndex = 0; routeMatrixIndex < routeMatrixJsonList.GetLength(); ++routeMatrixIndex) { Aws::Utils::Array routeMatrixRowJsonList = routeMatrixJsonList[routeMatrixIndex].AsArray(); Aws::Vector routeMatrixRowList; routeMatrixRowList.reserve((size_t)routeMatrixRowJsonList.GetLength()); for(unsigned routeMatrixRowIndex = 0; routeMatrixRowIndex < routeMatrixRowJsonList.GetLength(); ++routeMatrixRowIndex) { routeMatrixRowList.push_back(routeMatrixRowJsonList[routeMatrixRowIndex].AsObject()); } m_routeMatrix.push_back(std::move(routeMatrixRowList)); } } if(jsonValue.ValueExists("SnappedDeparturePositions")) { Aws::Utils::Array snappedDeparturePositionsJsonList = jsonValue.GetArray("SnappedDeparturePositions"); for(unsigned snappedDeparturePositionsIndex = 0; snappedDeparturePositionsIndex < snappedDeparturePositionsJsonList.GetLength(); ++snappedDeparturePositionsIndex) { Aws::Utils::Array positionJsonList = snappedDeparturePositionsJsonList[snappedDeparturePositionsIndex].AsArray(); Aws::Vector positionList; positionList.reserve((size_t)positionJsonList.GetLength()); for(unsigned positionIndex = 0; positionIndex < positionJsonList.GetLength(); ++positionIndex) { positionList.push_back(positionJsonList[positionIndex].AsDouble()); } m_snappedDeparturePositions.push_back(std::move(positionList)); } } if(jsonValue.ValueExists("SnappedDestinationPositions")) { Aws::Utils::Array snappedDestinationPositionsJsonList = jsonValue.GetArray("SnappedDestinationPositions"); for(unsigned snappedDestinationPositionsIndex = 0; snappedDestinationPositionsIndex < snappedDestinationPositionsJsonList.GetLength(); ++snappedDestinationPositionsIndex) { Aws::Utils::Array positionJsonList = snappedDestinationPositionsJsonList[snappedDestinationPositionsIndex].AsArray(); Aws::Vector positionList; positionList.reserve((size_t)positionJsonList.GetLength()); for(unsigned positionIndex = 0; positionIndex < positionJsonList.GetLength(); ++positionIndex) { positionList.push_back(positionJsonList[positionIndex].AsDouble()); } m_snappedDestinationPositions.push_back(std::move(positionList)); } } if(jsonValue.ValueExists("Summary")) { m_summary = jsonValue.GetObject("Summary"); } const auto& headers = result.GetHeaderValueCollection(); const auto& requestIdIter = headers.find("x-amzn-requestid"); if(requestIdIter != headers.end()) { m_requestId = requestIdIter->second; } return *this; }