ListMotorAlgorithmResultsResult.cc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /*
  2. * Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #include <alibabacloud/vcs/model/ListMotorAlgorithmResultsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Vcs;
  19. using namespace AlibabaCloud::Vcs::Model;
  20. ListMotorAlgorithmResultsResult::ListMotorAlgorithmResultsResult() :
  21. ServiceResult()
  22. {}
  23. ListMotorAlgorithmResultsResult::ListMotorAlgorithmResultsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. ListMotorAlgorithmResultsResult::~ListMotorAlgorithmResultsResult()
  29. {}
  30. void ListMotorAlgorithmResultsResult::parse(const std::string &payload)
  31. {
  32. Json::Reader reader;
  33. Json::Value value;
  34. reader.parse(payload, value);
  35. setRequestId(value["RequestId"].asString());
  36. auto dataNode = value["Data"];
  37. if(!dataNode["PageNumber"].isNull())
  38. data_.pageNumber = std::stoi(dataNode["PageNumber"].asString());
  39. if(!dataNode["PageSize"].isNull())
  40. data_.pageSize = std::stoi(dataNode["PageSize"].asString());
  41. if(!dataNode["TotalCount"].isNull())
  42. data_.totalCount = std::stoi(dataNode["TotalCount"].asString());
  43. if(!dataNode["TotalPage"].isNull())
  44. data_.totalPage = std::stoi(dataNode["TotalPage"].asString());
  45. auto allRecordsNode = dataNode["Records"]["RecordsItem"];
  46. for (auto dataNodeRecordsRecordsItem : allRecordsNode)
  47. {
  48. Data::RecordsItem recordsItemObject;
  49. if(!dataNodeRecordsRecordsItem["CorpId"].isNull())
  50. recordsItemObject.corpId = dataNodeRecordsRecordsItem["CorpId"].asString();
  51. if(!dataNodeRecordsRecordsItem["DataSourceId"].isNull())
  52. recordsItemObject.dataSourceId = dataNodeRecordsRecordsItem["DataSourceId"].asString();
  53. if(!dataNodeRecordsRecordsItem["LeftTopX"].isNull())
  54. recordsItemObject.leftTopX = std::stof(dataNodeRecordsRecordsItem["LeftTopX"].asString());
  55. if(!dataNodeRecordsRecordsItem["LeftTopY"].isNull())
  56. recordsItemObject.leftTopY = std::stof(dataNodeRecordsRecordsItem["LeftTopY"].asString());
  57. if(!dataNodeRecordsRecordsItem["MotorId"].isNull())
  58. recordsItemObject.motorId = dataNodeRecordsRecordsItem["MotorId"].asString();
  59. if(!dataNodeRecordsRecordsItem["PicUrlPath"].isNull())
  60. recordsItemObject.picUrlPath = dataNodeRecordsRecordsItem["PicUrlPath"].asString();
  61. if(!dataNodeRecordsRecordsItem["PlateNumber"].isNull())
  62. recordsItemObject.plateNumber = dataNodeRecordsRecordsItem["PlateNumber"].asString();
  63. if(!dataNodeRecordsRecordsItem["RightBottomX"].isNull())
  64. recordsItemObject.rightBottomX = std::stof(dataNodeRecordsRecordsItem["RightBottomX"].asString());
  65. if(!dataNodeRecordsRecordsItem["RightBottomY"].isNull())
  66. recordsItemObject.rightBottomY = std::stof(dataNodeRecordsRecordsItem["RightBottomY"].asString());
  67. if(!dataNodeRecordsRecordsItem["ShotTime"].isNull())
  68. recordsItemObject.shotTime = dataNodeRecordsRecordsItem["ShotTime"].asString();
  69. if(!dataNodeRecordsRecordsItem["TargetPicUrlPath"].isNull())
  70. recordsItemObject.targetPicUrlPath = dataNodeRecordsRecordsItem["TargetPicUrlPath"].asString();
  71. if(!dataNodeRecordsRecordsItem["MotorStyle"].isNull())
  72. recordsItemObject.motorStyle = dataNodeRecordsRecordsItem["MotorStyle"].asString();
  73. if(!dataNodeRecordsRecordsItem["MotorModel"].isNull())
  74. recordsItemObject.motorModel = dataNodeRecordsRecordsItem["MotorModel"].asString();
  75. data_.records.push_back(recordsItemObject);
  76. }
  77. if(!value["Code"].isNull())
  78. code_ = value["Code"].asString();
  79. if(!value["Message"].isNull())
  80. message_ = value["Message"].asString();
  81. }
  82. std::string ListMotorAlgorithmResultsResult::getMessage()const
  83. {
  84. return message_;
  85. }
  86. ListMotorAlgorithmResultsResult::Data ListMotorAlgorithmResultsResult::getData()const
  87. {
  88. return data_;
  89. }
  90. std::string ListMotorAlgorithmResultsResult::getCode()const
  91. {
  92. return code_;
  93. }