DescribeCameraStatisticsResult.cc 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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/reid/model/DescribeCameraStatisticsResult.h>
  17. #include <json/json.h>
  18. using namespace AlibabaCloud::Reid;
  19. using namespace AlibabaCloud::Reid::Model;
  20. DescribeCameraStatisticsResult::DescribeCameraStatisticsResult() :
  21. ServiceResult()
  22. {}
  23. DescribeCameraStatisticsResult::DescribeCameraStatisticsResult(const std::string &payload) :
  24. ServiceResult()
  25. {
  26. parse(payload);
  27. }
  28. DescribeCameraStatisticsResult::~DescribeCameraStatisticsResult()
  29. {}
  30. void DescribeCameraStatisticsResult::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 allPvStatisticResultsNode = value["PvStatisticResults"]["PvStatisticResult"];
  37. for (auto valuePvStatisticResultsPvStatisticResult : allPvStatisticResultsNode)
  38. {
  39. PvStatisticResult pvStatisticResultsObject;
  40. if(!valuePvStatisticResultsPvStatisticResult["ProcessCursor"].isNull())
  41. pvStatisticResultsObject.processCursor = std::stol(valuePvStatisticResultsPvStatisticResult["ProcessCursor"].asString());
  42. if(!valuePvStatisticResultsPvStatisticResult["IpcId"].isNull())
  43. pvStatisticResultsObject.ipcId = std::stol(valuePvStatisticResultsPvStatisticResult["IpcId"].asString());
  44. if(!valuePvStatisticResultsPvStatisticResult["PvCount"].isNull())
  45. pvStatisticResultsObject.pvCount = std::stol(valuePvStatisticResultsPvStatisticResult["PvCount"].asString());
  46. if(!valuePvStatisticResultsPvStatisticResult["LocationId"].isNull())
  47. pvStatisticResultsObject.locationId = std::stol(valuePvStatisticResultsPvStatisticResult["LocationId"].asString());
  48. if(!valuePvStatisticResultsPvStatisticResult["PvType"].isNull())
  49. pvStatisticResultsObject.pvType = valuePvStatisticResultsPvStatisticResult["PvType"].asString();
  50. auto allPvRectsNode = allPvStatisticResultsNode["PvRects"]["Rect"];
  51. for (auto allPvStatisticResultsNodePvRectsRect : allPvRectsNode)
  52. {
  53. PvStatisticResult::Rect pvRectsObject;
  54. if(!allPvStatisticResultsNodePvRectsRect["Right"].isNull())
  55. pvRectsObject.right = std::stof(allPvStatisticResultsNodePvRectsRect["Right"].asString());
  56. if(!allPvStatisticResultsNodePvRectsRect["Left"].isNull())
  57. pvRectsObject.left = std::stof(allPvStatisticResultsNodePvRectsRect["Left"].asString());
  58. if(!allPvStatisticResultsNodePvRectsRect["Top"].isNull())
  59. pvRectsObject.top = std::stof(allPvStatisticResultsNodePvRectsRect["Top"].asString());
  60. if(!allPvStatisticResultsNodePvRectsRect["Bottom"].isNull())
  61. pvRectsObject.bottom = std::stof(allPvStatisticResultsNodePvRectsRect["Bottom"].asString());
  62. pvStatisticResultsObject.pvRects.push_back(pvRectsObject);
  63. }
  64. pvStatisticResults_.push_back(pvStatisticResultsObject);
  65. }
  66. if(!value["ErrorCode"].isNull())
  67. errorCode_ = value["ErrorCode"].asString();
  68. if(!value["ErrorMessage"].isNull())
  69. errorMessage_ = value["ErrorMessage"].asString();
  70. if(!value["Message"].isNull())
  71. message_ = value["Message"].asString();
  72. if(!value["Code"].isNull())
  73. code_ = value["Code"].asString();
  74. if(!value["DynamicCode"].isNull())
  75. dynamicCode_ = value["DynamicCode"].asString();
  76. if(!value["Success"].isNull())
  77. success_ = value["Success"].asString() == "true";
  78. if(!value["DynamicMessage"].isNull())
  79. dynamicMessage_ = value["DynamicMessage"].asString();
  80. }
  81. std::vector<DescribeCameraStatisticsResult::PvStatisticResult> DescribeCameraStatisticsResult::getPvStatisticResults()const
  82. {
  83. return pvStatisticResults_;
  84. }
  85. std::string DescribeCameraStatisticsResult::getMessage()const
  86. {
  87. return message_;
  88. }
  89. std::string DescribeCameraStatisticsResult::getDynamicCode()const
  90. {
  91. return dynamicCode_;
  92. }
  93. std::string DescribeCameraStatisticsResult::getErrorCode()const
  94. {
  95. return errorCode_;
  96. }
  97. std::string DescribeCameraStatisticsResult::getDynamicMessage()const
  98. {
  99. return dynamicMessage_;
  100. }
  101. std::string DescribeCameraStatisticsResult::getErrorMessage()const
  102. {
  103. return errorMessage_;
  104. }
  105. std::string DescribeCameraStatisticsResult::getCode()const
  106. {
  107. return code_;
  108. }
  109. bool DescribeCameraStatisticsResult::getSuccess()const
  110. {
  111. return success_;
  112. }