DescribeCameraStatisticsResult.cc 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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. if(!valuePvStatisticResultsPvStatisticResult["MaxDataTime"].isNull())
  51. pvStatisticResultsObject.maxDataTime = std::stol(valuePvStatisticResultsPvStatisticResult["MaxDataTime"].asString());
  52. auto allPvRectsNode = allPvStatisticResultsNode["PvRects"]["Rect"];
  53. for (auto allPvStatisticResultsNodePvRectsRect : allPvRectsNode)
  54. {
  55. PvStatisticResult::Rect pvRectsObject;
  56. if(!allPvStatisticResultsNodePvRectsRect["Right"].isNull())
  57. pvRectsObject.right = std::stof(allPvStatisticResultsNodePvRectsRect["Right"].asString());
  58. if(!allPvStatisticResultsNodePvRectsRect["Left"].isNull())
  59. pvRectsObject.left = std::stof(allPvStatisticResultsNodePvRectsRect["Left"].asString());
  60. if(!allPvStatisticResultsNodePvRectsRect["Top"].isNull())
  61. pvRectsObject.top = std::stof(allPvStatisticResultsNodePvRectsRect["Top"].asString());
  62. if(!allPvStatisticResultsNodePvRectsRect["Bottom"].isNull())
  63. pvRectsObject.bottom = std::stof(allPvStatisticResultsNodePvRectsRect["Bottom"].asString());
  64. pvStatisticResultsObject.pvRects.push_back(pvRectsObject);
  65. }
  66. pvStatisticResults_.push_back(pvStatisticResultsObject);
  67. }
  68. if(!value["ErrorCode"].isNull())
  69. errorCode_ = value["ErrorCode"].asString();
  70. if(!value["ErrorMessage"].isNull())
  71. errorMessage_ = value["ErrorMessage"].asString();
  72. if(!value["Message"].isNull())
  73. message_ = value["Message"].asString();
  74. if(!value["Code"].isNull())
  75. code_ = value["Code"].asString();
  76. if(!value["DynamicCode"].isNull())
  77. dynamicCode_ = value["DynamicCode"].asString();
  78. if(!value["Success"].isNull())
  79. success_ = value["Success"].asString() == "true";
  80. if(!value["DynamicMessage"].isNull())
  81. dynamicMessage_ = value["DynamicMessage"].asString();
  82. }
  83. std::vector<DescribeCameraStatisticsResult::PvStatisticResult> DescribeCameraStatisticsResult::getPvStatisticResults()const
  84. {
  85. return pvStatisticResults_;
  86. }
  87. std::string DescribeCameraStatisticsResult::getMessage()const
  88. {
  89. return message_;
  90. }
  91. std::string DescribeCameraStatisticsResult::getDynamicCode()const
  92. {
  93. return dynamicCode_;
  94. }
  95. std::string DescribeCameraStatisticsResult::getErrorCode()const
  96. {
  97. return errorCode_;
  98. }
  99. std::string DescribeCameraStatisticsResult::getDynamicMessage()const
  100. {
  101. return dynamicMessage_;
  102. }
  103. std::string DescribeCameraStatisticsResult::getErrorMessage()const
  104. {
  105. return errorMessage_;
  106. }
  107. std::string DescribeCameraStatisticsResult::getCode()const
  108. {
  109. return code_;
  110. }
  111. bool DescribeCameraStatisticsResult::getSuccess()const
  112. {
  113. return success_;
  114. }