mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +03:00
0031945: Foundation Classes - unique names of alerts of message report in DumpJson
- add OCCT_DUMP_FIELD_VALUE_NUMERICAL_INC and OCCT_DUMP_FIELD_VALUES_DUMPED_INC - to increment key Value; - add OCCT_DUMP_STREAM_VALUE_DUMPED - to give stream as a parameter of the DumpJson; - correct Message_Report, Message_CompositeAlerts to increment keys; - correct Message_AttributeMeter to have in result start and stop values united in value block: [start stop]. It's better for parsing; - correct result of Message::MetricToString output for updated in 29451 Message_MetricType enum; - correct Standard_Dump::AddValuesSeparator to avoid adding ',' in additional case; - correct Standard_Dump::FormatJson to add opening/closing brace for the whole result (for valid parsing); - correct Standard_Dump::FormatJson to ignore '\n' in value.
This commit is contained in:
@@ -25,9 +25,10 @@
|
||||
|
||||
namespace
|
||||
{
|
||||
static Standard_CString Message_Table_PrintMetricTypeEnum[11] =
|
||||
static Standard_CString Message_Table_PrintMetricTypeEnum[13] =
|
||||
{
|
||||
"NONE", "UserTimeCPU", "SystemTimeInfo", "WallClock", "MemPrivate", "MemVirtual",
|
||||
"NONE", "ThreadCPUUserTime", "ThreadCPUSystemTime", "ProcessCPUUserTime", "ProcessCPUSystemTime",
|
||||
"WallClock", "MemPrivate", "MemVirtual",
|
||||
"MemWorkingSet", "MemWorkingSetPeak", "MemSwapUsage", "MemSwapUsagePeak", "MemHeapUsage"
|
||||
};
|
||||
}
|
||||
|
@@ -255,13 +255,7 @@ void Message_AttributeMeter::DumpJson (Standard_OStream& theOStream,
|
||||
for (NCollection_IndexedDataMap<Message_MetricType, StartToStopValue>::Iterator anIterator (myMetrics);
|
||||
anIterator.More(); anIterator.Next())
|
||||
{
|
||||
Message_MetricType aMetricType = anIterator.Key();
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aMetricType)
|
||||
|
||||
Standard_Real aStartValue = anIterator.Value().first;
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aStartValue)
|
||||
|
||||
Standard_Real aStopValue = anIterator.Value().second;
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aStopValue)
|
||||
OCCT_DUMP_VECTOR_CLASS (theOStream, Message::MetricToString (anIterator.Key()),
|
||||
2, anIterator.Value().first, anIterator.Value().second)
|
||||
}
|
||||
}
|
||||
|
@@ -47,6 +47,5 @@ void Message_AttributeStream::DumpJson (Standard_OStream& theOStream,
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
OCCT_DUMP_BASE_CLASS (theOStream, theDepth, Message_Attribute)
|
||||
|
||||
TCollection_AsciiString aStream = Standard_Dump::Text (myStream);
|
||||
OCCT_DUMP_FIELD_VALUE_STRING (theOStream, aStream)
|
||||
OCCT_DUMP_STREAM_VALUE_DUMPED (theOStream, myStream)
|
||||
}
|
||||
|
@@ -169,15 +169,16 @@ void Message_CompositeAlerts::DumpJson (Standard_OStream& theOStream,
|
||||
{
|
||||
OCCT_DUMP_TRANSIENT_CLASS_BEGIN (theOStream)
|
||||
|
||||
Standard_Integer anInc = 1;
|
||||
for (unsigned int i = 0; i < sizeof(myAlerts)/sizeof(myAlerts[0]); ++i)
|
||||
{
|
||||
Message_Gravity aGravity = (Message_Gravity)i;
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, aGravity)
|
||||
if (myAlerts[i].IsEmpty())
|
||||
continue;
|
||||
|
||||
for (Message_ListOfAlert::Iterator anIt (myAlerts[i]); anIt.More(); anIt.Next())
|
||||
for (Message_ListOfAlert::Iterator anIt (myAlerts[i]); anIt.More(); anIt.Next(), anInc++)
|
||||
{
|
||||
const Handle(Message_Alert)& anAlert = anIt.Value();
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anAlert.get())
|
||||
OCCT_DUMP_FIELD_VALUES_DUMPED_INC (theOStream, theDepth, anAlert.get(), anInc)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -489,10 +489,11 @@ void Message_Report::DumpJson (Standard_OStream& theOStream, Standard_Integer th
|
||||
Standard_Integer anAlertLevels = myAlertLevels.Size();
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, anAlertLevels)
|
||||
|
||||
Standard_Integer anInc = 1;
|
||||
for (NCollection_IndexedMap<Message_MetricType>::Iterator anIterator (myActiveMetrics); anIterator.More(); anIterator.Next())
|
||||
{
|
||||
Message_MetricType anActiveMetric = anIterator.Value();
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, anActiveMetric)
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL_INC (theOStream, anActiveMetric, anInc++)
|
||||
}
|
||||
|
||||
OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myLimit)
|
||||
|
Reference in New Issue
Block a user