| 13 | { |
| 14 | |
| 15 | void JsonPrinter::PrintJsonChildObject(const JsonChildObject& object, size_t& id) |
| 16 | { |
| 17 | if (object.GetType() == JsonObjectType::Event) |
| 18 | { |
| 19 | // Increase the Id for new events. This ensures a new event has a unique ID and any measurements belonging |
| 20 | // to the event have the same id. This id is appended to the name during the call to PrintLabel() below. |
| 21 | id++; |
| 22 | } |
| 23 | |
| 24 | if (object.GetType() != JsonObjectType::ExecObjectDesc) |
| 25 | { |
| 26 | PrintLabel(object.m_Label, id); |
| 27 | if (object.m_Guid.has_value()) |
| 28 | { |
| 29 | PrintGuid(object.m_Guid.value()); |
| 30 | } |
| 31 | PrintType(object.m_Type); |
| 32 | } |
| 33 | |
| 34 | if (!object.m_Measurements.empty() || !object.m_Children.empty()) |
| 35 | { |
| 36 | PrintSeparator(); |
| 37 | PrintNewLine(); |
| 38 | } |
| 39 | if (object.GetType() == JsonObjectType::Measurement) |
| 40 | { |
| 41 | PrintMeasurementsList(object.m_Measurements); |
| 42 | PrintSeparator(); |
| 43 | PrintNewLine(); |
| 44 | PrintUnit(object.m_Unit); |
| 45 | } |
| 46 | else if (object.GetType() == JsonObjectType::ExecObjectDesc) |
| 47 | { |
| 48 | // Add details opening |
| 49 | DecrementNumberOfTabs(); |
| 50 | PrintTabs(); |
| 51 | m_OutputStream << std::quoted("Graph") << ":["; |
| 52 | PrintNewLine(); |
| 53 | |
| 54 | // Fill details body |
| 55 | for (std::string stringLine : object.m_LayerDetailsList) |
| 56 | { |
| 57 | PrintTabs(); |
| 58 | m_OutputStream << stringLine; |
| 59 | PrintNewLine(); |
| 60 | } |
| 61 | |
| 62 | // Close out details |
| 63 | PrintTabs(); |
| 64 | object.IsDetailsOnlyEnabled() ? m_OutputStream << "]" : m_OutputStream << "],"; |
| 65 | |
| 66 | PrintNewLine(); |
| 67 | IncrementNumberOfTabs(); |
| 68 | } |
| 69 | if (!object.m_Children.empty()) |
| 70 | { |
| 71 | for (unsigned int childIndex = 0; childIndex < object.m_Children.size(); ++childIndex) |
| 72 | { |