MantisBT - Open CASCADE
View Issue Details
0031313Open CASCADE[OCCT] OCCT:Foundation Classespublic2020-01-23 11:172020-02-06 16:42
nds 
bugmaster 
normalfeature 
verifiedfixed 
 
[OCCT] 7.5.0* 
0031313: Foundation Classes - Dump improvement for classes
Continue implementing DumpJson methods introduced in 0030949.
Patch adds +432 KiB to 64-bit OCCT build with msvc14.
No tags attached.
parent of 0031322verified bugmaster Visualization, Select3D_SensitiveEntity - method NbSubElements() should be const 
parent of 0031326assigned nds Foundation Classes - Init from Json for base OCCT classes 
parent of 0031354new sshutina Visualization - Dump improvement for V3d, Graphic3d, Aspect 
child of 0030949closed bugmaster Foundation Classes - Dump improvement for OCCT classes 
Not all the children of this issue are yet resolved or closed.
png dump_presentation.png (35,278) 2020-01-24 10:09
https://tracker.dev.opencascade.org/
Issue History
2020-01-23 11:17ndsNew Issue
2020-01-23 11:17ndsAssigned To => abv
2020-01-23 11:18ndsAssigned Toabv => nds
2020-01-24 09:55gitNote Added: 0090037
2020-01-24 10:02ndsNote Added: 0090038
2020-01-24 10:02ndsAssigned Tonds => kgv
2020-01-24 10:02ndsStatusnew => resolved
2020-01-24 10:09ndsFile Added: dump_presentation.png
2020-01-24 10:10ndsNote Added: 0090039
2020-01-24 11:26kgvNote Added: 0090040
2020-01-24 14:40kgvNote Added: 0090045
2020-01-24 14:47kgvNote Added: 0090046
2020-01-24 14:51kgvAdditional Information Updatedbug_revision_view_page.php?rev_id=22473#r22473
2020-01-24 14:54kgvNote Added: 0090047
2020-01-24 14:54kgvAssigned Tokgv => nds
2020-01-24 14:54kgvStatusresolved => assigned
2020-01-24 14:57kgvNote Added: 0090048
2020-01-27 11:01gitNote Added: 0090072
2020-01-27 11:14ndsNote Added: 0090073
2020-01-27 16:48gitNote Added: 0090075
2020-01-28 07:36gitNote Added: 0090084
2020-01-28 10:12gitNote Added: 0090088
2020-01-28 10:19ndsRelationship addedparent of 0031322
2020-01-28 10:21ndsRelationship addedrelated to 0030949
2020-01-28 11:23gitNote Added: 0090090
2020-01-28 11:59gitNote Added: 0090093
2020-01-28 12:07gitNote Added: 0090094
2020-01-28 15:29gitNote Added: 0090100
2020-01-28 16:52gitNote Added: 0090102
2020-01-28 18:32ndsRelationship addedparent of 0031326
2020-01-29 10:57gitNote Added: 0090127
2020-01-29 12:10gitNote Added: 0090130
2020-01-29 12:13gitNote Added: 0090131
2020-01-29 12:38gitNote Added: 0090133
2020-01-29 12:40gitNote Added: 0090135
2020-01-29 12:41gitNote Added: 0090137
2020-01-29 16:46gitNote Added: 0090150
2020-01-29 17:36gitNote Added: 0090163
2020-01-29 21:40ndsNote Added: 0090172
2020-01-29 21:40ndsAssigned Tonds => kgv
2020-01-29 21:40ndsStatusassigned => resolved
2020-01-30 08:32ndsNote Edited: 0090172bug_revision_view_page.php?bugnote_id=90172#r22488
2020-01-30 08:44gitNote Added: 0090186
2020-01-30 08:44gitNote Added: 0090187
2020-01-30 11:45kgvNote Added: 0090197
2020-01-30 11:45kgvAssigned Tokgv => nds
2020-01-30 11:45kgvStatusresolved => assigned
2020-01-30 12:09kgvRelationship replacedchild of 0030949
2020-01-30 15:56ndsNote Added: 0090202
2020-01-30 16:01kgvNote Added: 0090204
2020-01-30 21:35gitNote Added: 0090216
2020-01-31 07:09gitNote Added: 0090220
2020-01-31 12:10ndsNote Added: 0090224
2020-01-31 12:10ndsAssigned Tonds => kgv
2020-01-31 12:10ndsStatusassigned => resolved
2020-01-31 12:44kgvAssigned Tokgv => bugmaster
2020-01-31 12:44kgvStatusresolved => reviewed
2020-01-31 13:04ndsNote Added: 0090226
2020-01-31 17:15bugmasterNote Added: 0090239
2020-01-31 17:15bugmasterStatusreviewed => tested
2020-02-01 21:28bugmasterChangeset attached => occt master bc73b006
2020-02-01 21:28bugmasterStatustested => verified
2020-02-01 21:28bugmasterResolutionopen => fixed
2020-02-01 21:47gitNote Added: 0090258
2020-02-01 21:47gitNote Added: 0090259
2020-02-01 21:47gitNote Added: 0090263
2020-02-01 21:47gitNote Added: 0090266
2020-02-01 21:47gitNote Added: 0090267
2020-02-06 16:42sshutinaRelationship addedparent of 0031354

Notes
(0090037)
git   
2020-01-24 09:55   
Branch CR31313 has been created by nds.

SHA-1: a62ac2e12316c9411aae04c9d2dee129da1aac16


Detailed log of new commits:

Author: nds
Date: Fri Jan 24 09:51:47 2020 +0300

    0030268: Inspectors - improvements in VInspector plugin
    
    # dump sentry does not append { ... } structure, only class name
    # dump for curve2d/surface2d/curve/surface brep structures
    # dump for primitive array parameters and buffer parameters
    # InitJson for primitive types
(0090038)
nds   
2020-01-24 10:02   
Dear Kirill,

could you please review modifications.

Please, pay attention on modifications in Standard_Dump:
- Standard_DumpSentry does not add "className": { ... },
only "className" : "<className>" into generated stream. In previous implementation, there were too much levels. Now, we only know about kind of the output class.

Also the patch has some initial code to parse json output for filling a variable.

Best regards, Natalia
(0090039)
nds   
2020-01-24 10:10   
On attached image, dump parsed by inspector (will be available after 0030268). Grey rows in property panes are the result of Standard_Dump current implementation.
(0090040)
kgv   
2020-01-24 11:26   
# dump sentry does not append { ... } structure, only class name
# dump for curve2d/surface2d/curve/surface brep structures
# dump for primitive array parameters and buffer parameters
# InitJson for primitive types

Git commit description is currently in form of temporary comments (e.g. to be removed by Bugmaster on integration).
Please reformat description in more common way, and probably extend (it looks incomplete for now).

+//=======================================================================
+//function : DumpJson
+//purpose  : 
+//=======================================================================

Please avoid trailing spacing in the patch.

+
+
+//=======================================================================

Please avoid more than 1 empty line in sequence.

+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth 
= -1) const;

tip: it is probably worth omitting "const" from second argument to shorten repeated lines.
(0090045)
kgv   
2020-01-24 14:40   
+  for (NCollection_Vector<Handle(SelectMgr_SensitiveEntity)>::Iterator anIterator (myEntities); 
anIterator.More(); anIterator.Next())
+  {
+    Handle(SelectMgr_SensitiveEntity) anEntity = anIterator.Value();
+    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, anEntity.get());
+  }
+
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myMode);
+  OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, mySelectionState

General remark (above is only one sample): does it look better when children / arrays (of variable length) are displayed in front of common class fields (numeric / members) in Inspector? For me, it sounds more natural to list static fields first, and then lists of variable length.

+  OCCT_DUMP_CLASS_BEGIN (theOStream, AIS_InteractiveContext);

tip: we can define dedicated macros for classes within Standard_Transient hierarchy, so that to use method get_type_name() defined by DEFINE_STANDARD_RTTI instead of one more copy of class name in code.

+  BRep_ListIteratorOfListOfPointRepresentation itr(myPoints);
+  while (itr.More())
+  {
+    Handle(BRep_PointRepresentation) aPointRepresentation = itr.Value();
+    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aPointRepresentation.get());
+
+    itr.Next();
+  }

tip: why "while" instead of more compact "for" in these cases?
+ for (BRep_ListIteratorOfListOfPointRepresentation itr(myPoints); itr.More(); itr.Next())
+ {
+ Handle(BRep_PointRepresentation) aPointRepresentation = itr.Value();
+ OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aPointRepresentation.get());
+ }

+  //! Inits the content of me into the stream
+  Standard_Boolean InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)


The method name looks confusing - it looks more like "InitFromJson()".

+    Handle(Graphic3d_Group) aGroup = anIterator.Value();
+    OCCT_DUMP_FIELD_VALUES_DUMPED (theOStream, theDepth, aGroup.get());

const Handle(Graphic3d_Group)&

+  const Standard_Integer aNbPriorities = myArray.Length();
+  for (Standard_Integer aPriorityIter = 0; aPriorityIter < aNbPriorities; ++aPriorityIter)
+  {
+    const Graphic3d_IndexedMapOfStructure& aStructures = myArray (aPriorityIter);

for (Graphic3d_ArrayOfIndexedMapOfStructure::Iterator aMapIter (myArray); aMapIter.More(); aMapIter.Next())

+void Graphic3d_MaterialAspect::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) 
const
+{

myPBRMaterial is missing.

+void Graphic3d_ClipPlane::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) 
const
+{

myNextInChain is missing.

--- a/src/Graphic3d/Graphic3d_Structure.hxx
+++ b/src/Graphic3d/Graphic3d_Structure.hxx
@@ -432,6 +432,9 @@ public:
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = 
-1) const;

Probably virtual, as there are several sub-classes (PrsMgr_Presentation, Prs3d_PresentationShadow).

--- a/src/Graphic3d/Graphic3d_ZLayerSettings.hxx
+++ b/src/Graphic3d/Graphic3d_ZLayerSettings.hxx
@@ -19,6 +19,7 @@
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = 
-1) const
+  {

Redundant Standard_EXPORT.

+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myToRenderInDepthPrepass);
+
+  }

Redundant empty line.

--- a/src/NCollection/NCollection_Buffer.hxx
+++ b/src/NCollection/NCollection_Buffer.hxx
+  //! Dumps the content of me into the stream
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth 
= -1) const
+  {

...
--- a/src/NCollection/NCollection_Vec3.hxx
+++ b/src/NCollection/NCollection_Vec3.hxx
...
--- a/src/NCollection/NCollection_Vec4.hxx
+++ b/src/NCollection/NCollection_Vec4.hxx
+  //! Dumps the content of me into the stream
+  Standard_EXPORT void DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth = 
-1) const
+  {

Redundant Standard_EXPORT.

+void OpenGl_Context::DumpJsonOpenGl (Standard_OStream& theOStream, const Standard_Integer)

DumpJsonOpenGlState?

+//! After, this matrices should be applyed using ApplyModelWorldMatrix, ApplyWorldViewMatrix,

these

+  static Standard_EXPORT void DumpJsonOpenGl (Standard_OStream& theOStream, const Standard_Integer 
theDepth = -1);

Wrong Standard_EXPORT placement.

+  //! Dumps the content of openGL into the stream

OpenGL state.

+void OpenGl_VertexBuffer::DumpJson (Standard_OStream& theOStream, const Standard_Integer theDepth) 
const
+{

Consider adding GetTarget() propery.

+    Handle(Graphic3d_Layer) aLayerId = aLayersIt.Value();
...
+    Handle(OpenGl_VertexBuffer) aVertexBuffer = aCrdsIt.Value();
...
+    Handle(PrsMgr_Presentation) aPresentation = anIterator.Value();
...
+    Handle(PrsMgr_PresentableObject) aChildObject = anIterator.Value();
...
+    Handle(Select3D_SensitiveEntity) anEntity = anIterator.Value();
...
+    Handle(SelectMgr_Selection) aSelection = anIterator.Value();

const Handle(Graphic3d_Layer)&
const Handle(OpenGl_VertexBuffer)&

+    OCCT_DUMP_FIELD_VALUES_NUMERICAL (theOStream, "myCurrent", 16,
+      myCurrent.GetValue (0, 0),  myCurrent.GetValue (0, 1), myCurrent.GetValue (0, 2),  myCurrent.GetValue 
(0, 3),

Cannot be dump of NCollection_Mat4 reused here?

+  if (!myNormals.IsNull())
+    OCCT_DUMP_FIELD_VALUE_NUMERICAL (theOStream, myNormals->Size());

Well, this will be awkard number ;).
Anyway, it should be after myUVNodes->Size(), not myTriangles.Size(), as it is per-vertex attribute.

-  Standard_EXPORT virtual Standard_Integer NbSubElements() Standard_OVERRIDE;
+  Standard_EXPORT virtual Standard_Integer NbSubElements() const Standard_OVERRIDE

Irrelevant API-nreaking changes are mixed in the patch.
It would be better moving these "const" amendments into dedicated patch.
These changes require also to be mentioned in upgrade guide.

+  //Graphic3d_WorldViewProjState                               myLastViewState; //!< Last view-projection 
state used for construction of BVH

Artefact.
(0090046)
kgv   
2020-01-24 14:47   
+Standard_Boolean  gp_Trsf::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)

...
+void  gp_Ax3::DumpJson (Standard_OStream& theOStream, const Standard_Integer) const
...
+Standard_Boolean  gp_Ax3::InitJson (const Standard_SStream& theSStream, Standard_Integer& theStreamPos)


Redundant space.

+#define OCCT_INIT_FIELD_VALUES_DUMPED(theSStream, theStreamPos, theField) \

Could you consider moving new InitJson mechanism to dedicated patch?
It covers small sub-set of classes, so it should be feasible.
(0090047)
kgv   
2020-01-24 14:54   
+  else if (TCollection_AsciiString (aName).EndsWith ("()"))

as aName is now TCollection_AsciiString, making TCollection_AsciiString (aName) looks redundant.
(0090048)
kgv   
2020-01-24 14:57   
New msvc14 compiler warning:
2>  Bnd_B3d_0.cxx
2>c:\occt_vc14_ex2\inc\../src/BVH/BVH_Box.hxx(217): warning C4800: 'Standard_Integer': forcing value 
to bool 'true' or 'false' (performance warning) (compiling source file ..\..\..\src\BVH\BVH.cxx)
2>  c:\occt_vc14_ex2\inc\../src/BVH/BVH_Box.hxx(212): note: while compiling class template member 
function 'Standard_Boolean BVH_Box<Standard_ShortReal,4>::InitJson(const Standard_SStream &,Standard_Integer 
&)' (compiling source file ..\..\..\src\BVH\BVH.cxx)
2>  ..\..\..\src\BVH\BVH.cxx(44): note: see reference to class template instantiation 'BVH_Box<Standard_ShortReal,4>' 
being compiled
(0090072)
git   
2020-01-27 11:01   
Branch CR31313_1 has been created by nds.

SHA-1: e72c1449bc8bd307a137efc319cfd227f21c856a


Detailed log of new commits:

Author: nds
Date: Fri Jan 24 09:51:47 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
(0090073)
nds   
2020-01-27 11:14   
<< General remark (above is only one sample): does it look better when children / arrays (of variable length) are displayed in front of common class fields (numeric / members) in Inspector? For me, it sounds more natural to list static fields first, and then lists of variable length. >>
The intention is to have order of fields covered in DumpJson is the same as the the order of fields in header (declaration).
(0090075)
git   
2020-01-27 16:48   
Branch CR31313_1 has been updated by nds.

SHA-1: fc6635be51d45d0c772bd03ab9d77d02f1da5ba2


Detailed log of new commits:

Author: nds
Date: Mon Jan 27 16:43:30 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # dumpJson for OCAF attributes
    
    (cherry picked from commit 527e41def08b3206903dd25f9abcc5b276882294)

(0090084)
git   
2020-01-28 07:36   
Branch CR31313_2 has been created by nds.

SHA-1: 04d9654a9ecaa1af4a2d10ea0cebed80dccdfaab


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 07:32:54 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # dump modifications
    # InitFromJson
    # NbSubElements is const
(0090088)
git   
2020-01-28 10:12   
Branch CR31313_3 has been created by nds.

SHA-1: 25667d7eb0c8a0b286caeaf2eb4565fd8c60630d


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 09:53:30 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # dump modifications
(0090090)
git   
2020-01-28 11:23   
Branch CR31313_3 has been updated by nds.

SHA-1: 762befdfd0108d82a27f59e869a440fa6568fd52


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 11:20:18 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # warnings correction on Mac
    
    Provide DumpJson for some geometrical and visualization instances;
    Change depth parameter of DumpJson not constant;
    Introduce a new macro for transient objects: OCCT_DUMP_TRANSIENT_CLASS_BEGIN to used for Standard_Transent, for others use OCCT_DUMP_CLASS_BEGIN;
    OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN are not sentry. These macros add "className": <className> into output stream.

(0090093)
git   
2020-01-28 11:59   
Branch CR31313_3 has been updated by nds.

SHA-1: c9e2bea42158531b3c10647686a90a3a514a3403


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 11:55:58 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # test case 30949 correction

(0090094)
git   
2020-01-28 12:07   
Branch CR31313_4 has been created by nds.

SHA-1: abb64c0563d2a6c2bebc15e2a906a524bd102263


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 12:03:38 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    Provide DumpJson for geometrical and visualization classes;
    Change depth parameter of DumpJson (constant is not obligate here)
    Introduce a new macro for transient objects to be called as the first row in DumpJson: OCCT_DUMP_TRANSIENT_CLASS_BEGIN. We need not put the class name in the macro, using get_type_name of Standard_Transient for it.
    OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN implementation has changed. It is not a sentry.anActiveLightIter.
    These macros add "className": <className> into output stream instead of creating a new hierarchy level.
(0090100)
git   
2020-01-28 15:29   
Branch CR31313_4 has been updated by nds.

SHA-1: c3f9ea044011bd7144f341b52f102b405c8770c9


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 15:26:08 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # warnings on Debian, Mac correction

(0090102)
git   
2020-01-28 16:52   
Branch CR31313_4 has been updated by nds.

SHA-1: f9ef7742a2e7f9f6cf9167554c4fb7318742eb50


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 16:49:02 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # warnings on Debian correction

(0090127)
git   
2020-01-29 10:57   
Branch CR31313_5 has been created by nds.

SHA-1: e64dac47c3507d895e42feb3998f3c9097d2ea7b


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 12:03:38 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    - Provide DumpJson for geometrical, ocaf and visualization classes;
    - Change depth parameter of DumpJson (constant is not obligate here)
    - Introduce a new macro for transient objects to be called as the first row in DumpJson: OCCT_DUMP_TRANSIENT_CLASS_BEGIN. We need not put the class name in the macro, using get_type_name of Standard_Transient for it.
    - change implementation of OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN. It is not an sentry more and it does not create a new hierarchy level. It appends a new row into the output stream: "className": <className>
    - OCCT_DUMP_* does not require semicolon
(0090130)
git   
2020-01-29 12:10   
Branch CR31313_5 has been updated by nds.

SHA-1: 2d63e81694ae3b521407119e6a748e0e7fda1dc6


Detailed log of new commits:

Author: nds
Date: Wed Jan 29 12:07:03 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # compilation correction on Debian

(0090131)
git   
2020-01-29 12:13   
Branch CR31313_5 has been updated by nds.

SHA-1: b500a45a14d5cc85708966f5f16363f63e68a364


Detailed log of new commits:

Author: nds
Date: Wed Jan 29 12:09:44 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    # warning correction on VC14

(0090133)
git   
2020-01-29 12:38   
Branch CR31313_3 has been deleted by nds.

SHA-1: c9e2bea42158531b3c10647686a90a3a514a3403
(0090135)
git   
2020-01-29 12:40   
Branch CR31313_2 has been deleted by nds.

SHA-1: 04d9654a9ecaa1af4a2d10ea0cebed80dccdfaab
(0090137)
git   
2020-01-29 12:41   
Branch CR31313_1 has been deleted by nds.

SHA-1: fc6635be51d45d0c772bd03ab9d77d02f1da5ba2
(0090150)
git   
2020-01-29 16:46   
Branch CR31313_6 has been created by nds.

SHA-1: c7f8c183d7701ed9e556a0bdf862de7db3ec4c3b


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 12:03:38 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    - Provide DumpJson for geometrical, ocaf and visualization classes;
    - Change depth parameter of DumpJson (constant is not obligate here)
    - Introduce a new macro for transient objects to be called as the first row in DumpJson: OCCT_DUMP_TRANSIENT_CLASS_BEGIN. We need not put the class name in the macro, using get_type_name of Standard_Transient for it.
    - change implementation of OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN. It is not an sentry more and it does not create a new hierarchy level. It appends a new row into the output stream: "className": <className>
    - OCCT_DUMP_* does not require semicolon
(0090163)
git   
2020-01-29 17:36   
Branch CR31313_7 has been created by nds.

SHA-1: b5feb171ce0a5ed7897b3b8c5cb3f5ce04dae60e


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 12:03:38 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    - Provide DumpJson for geometrical, ocaf and visualization classes;
    - Change depth parameter of DumpJson (constant is not obligate here)
    - Introduce a new macro for transient objects to be called as the first row in DumpJson: OCCT_DUMP_TRANSIENT_CLASS_BEGIN. We need not put the class name in the macro, using get_type_name of Standard_Transient for it.
    - change implementation of OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN. It is not an sentry more and it does not create a new hierarchy level. It appends a new row into the output stream: "className": <className>
    - OCCT_DUMP_* does not require semicolon
(0090172)
nds   
2020-01-29 21:40   
(edited on: 2020-01-30 08:32)
Dear Kirill,

could you please review the issue again. Your remarks are corrected, DumpJson for some OCAF attributes are implemented additionally.

Jenkins job is http://jenkins-test-12.nnov.opencascade.com/view/CR31313-master-NDS/. [^]

Thank you in advance, Natalia

(0090186)
git   
2020-01-30 08:44   
Branch CR31313_6 has been deleted by nds.

SHA-1: c7f8c183d7701ed9e556a0bdf862de7db3ec4c3b
(0090187)
git   
2020-01-30 08:44   
Branch CR31313_5 has been deleted by nds.

SHA-1: b500a45a14d5cc85708966f5f16363f63e68a364
(0090197)
kgv   
2020-01-30 11:45   
Please rebase patch on top of CR31322_2 for 0031322.

+TCollection_AsciiString Standard_Dump::DumpFieldToName (const TCollection_AsciiString theField)

const TCollection_AsciiString& theField

+  if (::LowerCase (aName.Value(1)) == 'a' && aName.Value (2) == 'n')
+  else if (::LowerCase (aName.Value(1)) == 'm' && aName.Value (2) == 'y')

This is unlikely, but it will raise an exception for a class fields "a" and "m".
And class fields "a", "an" and "my" will be dumped with empty name.
Probably protection should be added?

+// ----------------------------------------------------------------------------
+// SplitJson
+// ----------------------------------------------------------------------------
+Standard_Boolean Standard_Dump::SplitJson (const TCollection_AsciiString& theStreamStr,

Inconsistent topping for new methods in the file.

+      case Standard_JsonKey_Quote:
+      {
+        aProcessed = splitKeyToValue (theStreamStr, aNextIndex, aNextIndex, theKeyToValues);
+      }
+      break;

Please prefer 'break' put into brackets.

+        Standard_Integer aClosePos = nextClosePosition (theStreamStr, aStartIndex, Standard_JsonKey_OpenChild, 
Standard_JsonKey_CloseChild);
+        if (!aClosePos)
+          return Standard_False;
...
+  if (!aCloseIndex)
...
+    if (!aCloseKeyPos)
...
+      if (!aDepthKey)

Please prefer "aClosePos == 0" comparison for non-boolean values.

+  Standard_JsonKey aKey;

It is preferred initializing variables of primitive type, even if next call is expected to do that.

+    case Standard_JsonKey_SeparatorValueToValue: return ", ";
+    default: break;

It is better omitting 'default' case in switches, where all enumeration values are expected to be handled.

-//! - OCCT_DUMP_FIELD_VALUES_STRING. Use it for unlimited list of fields of TCollection_AsciiString 
types.
+//! - OCCT_DUMP_FIELD_VALUES_STRING. Use it for unlimited list of fields of TCollection_AsciiString 
types.F

Misprint.

+
+

Please keep single line.

+  Standard_DumpValue (const TCollection_AsciiString& theValue, const Standard_Integer& theStartPos)


Standard_Integer

+  Standard_DumpValue() {}

Consider initializing myStartPosition to 0.

+  //! \param theStream stream value
+  //! \param theKeyToValues [out] container of split values

Mixed Doyxgen styles (@ used in this file).

+  //! The one level stream example: <class_name>key_1\value_1\key_2\value_2</class_name>


Please check that this doesn't generate new Doxygen generator warnings.

--- a/src/TDataStd/TDataStd_Integer.cxx
+++ b/src/TDataStd/TDataStd_Integer.cxx
+#include <Standard_Dump.hxx>
...
--- a/src/TDataStd/TDataStd_IntegerArray.cxx
+++ b/src/TDataStd/TDataStd_IntegerArray.cxx 
+#include <Standard_Dump.hxx>
...
--- a/src/TDataStd/TDataStd_IntegerList.cxx
+++ b/src/TDataStd/TDataStd_IntegerList.cxx
...
--- a/src/TDataStd/TDataStd_Name.cxx
+++ b/src/TDataStd/TDataStd_Name.cxx
...
--- a/src/TDataStd/TDataStd_NoteBook.cxx
+++ b/src/TDataStd/TDataStd_NoteBook.cxx
...
--- a/src/TDataStd/TDataStd_Real.cxx
+++ b/src/TDataStd/TDataStd_Real.cxx
...
--- a/src/TDataStd/TDataStd_RealArray.cxx
+++ b/src/TDataStd/TDataStd_RealArray.cxx
...
--- a/src/TDataStd/TDataStd_RealList.cxx
+++ b/src/TDataStd/TDataStd_RealList.cxx
...
--- a/src/TDataStd/TDataStd_ReferenceArray.cxx
+++ b/src/TDataStd/TDataStd_ReferenceArray.cxx
...
--- a/src/TDataStd/TDataStd_ReferenceList.cxx
+++ b/src/TDataStd/TDataStd_ReferenceList.cxx
...
--- a/src/TDataStd/TDataStd_Relation.cxx
+++ b/src/TDataStd/TDataStd_Relation.cxx
...
--- a/src/TDataStd/TDataStd_Tick.cxx
+++ b/src/TDataStd/TDataStd_Tick.cxx
...
--- a/src/TDataStd/TDataStd_UAttribute.cxx
+++ b/src/TDataStd/TDataStd_UAttribute.cxx
...
--- a/src/TDataStd/TDataStd_Variable.cxx
+++ b/src/TDataStd/TDataStd_Variable.cxx
...
--- a/src/TDocStd/TDocStd_Application.cxx
+++ b/src/TDocStd/TDocStd_Application.cxx
...
--- a/src/TDocStd/TDocStd_Document.cxx
+++ b/src/TDocStd/TDocStd_Document.cxx
...
--- a/src/TDocStd/TDocStd_Owner.cxx
+++ b/src/TDocStd/TDocStd_Owner.cxx
...
--- a/src/XCAFDoc/XCAFDoc_Area.cxx
+++ b/src/XCAFDoc/XCAFDoc_Area.cxx
...
--- a/src/XCAFDoc/XCAFDoc_AssemblyItemId.cxx
+++ b/src/XCAFDoc/XCAFDoc_AssemblyItemId.cxx
...
--- a/src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx
+++ b/src/XCAFDoc/XCAFDoc_AssemblyItemRef.cxx
...
--- a/src/XCAFDoc/XCAFDoc_Color.cxx
+++ b/src/XCAFDoc/XCAFDoc_Color.cxx
...
--- a/src/XCAFDoc/XCAFDoc_ColorTool.cxx
+++ b/src/XCAFDoc/XCAFDoc_ColorTool.cxx
...
--- a/src/XCAFDoc/XCAFDoc_DimTol.cxx
+++ b/src/XCAFDoc/XCAFDoc_DimTol.cxx
...
--- a/src/XCAFDoc/XCAFDoc_GraphNode.cxx
+++ b/src/XCAFDoc/XCAFDoc_GraphNode.cxx
...
--- a/src/XCAFDoc/XCAFDoc_Material.cxx
+++ b/src/XCAFDoc/XCAFDoc_Material.cxx
...
--- a/src/XCAFDoc/XCAFDoc_Volume.cxx
+++ b/src/XCAFDoc/XCAFDoc_Volume.cxx
...

Please include class header first.

+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth 
= -1) const
+  {
+    OCCT_DUMP_CLASS_BEGIN (theOStream, XCAFDoc_VisMaterialCommon)
...
+  Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth 
= -1) const
+  {
+    OCCT_DUMP_CLASS_BEGIN (theOStream, XCAFDoc_VisMaterialPBR)

Unexpected Standard_EXPORT for inline methods.
Please remove "virtual" as these are plain structures with no virtual methods.
In addition, it seems "#include <Standard_Dump.hxx>" is missing in these files.

+void  gp_Ax3::DumpJson (Standard_OStream& theOStream, Standard_Integer) const

Double space.

+  OCCT_DUMP_FIELD_VALUE_GUID (theOStream, myID);

Semicolon.

+#define OCCT_DUMP_FIELD_VALUE_GUID(theOStream, theField) \
+{ \
+  TCollection_AsciiString aName = Standard_Dump::DumpFieldToName (#theField); \
+  Standard_Dump::AddValuesSeparator (theOStream); \
+  char aStr[256]; \
+  theField.ToCString (aStr); 

Why 256 instead of Standard_GUID_SIZE (which is 36)?
(0090202)
nds   
2020-01-30 15:56   
<<--- a/src/XCAFDoc/XCAFDoc_Material.cxx
+++ b/src/XCAFDoc/XCAFDoc_Material.cxx
...
--- a/src/XCAFDoc/XCAFDoc_Volume.cxx
+++ b/src/XCAFDoc/XCAFDoc_Volume.cxx
...
Please include class header first >>

Only TDataStd, TDocStd and XCAFDoc? Or all touched? TDF, TNaming?
(0090204)
kgv   
2020-01-30 16:01   
> Only TDataStd, TDocStd and XCAFDoc? Or all touched? TDF, TNaming?
In most cases, the issue existed before, but putting "#include <Standard_Dump.hxx>" in front makes it "worse".
So I propose fixing it in all touched files, where "Standard_Dump.hxx" was put not at the end of inclusion list.
(0090216)
git   
2020-01-30 21:35   
Branch CR31313_8 has been created by nds.

SHA-1: 41bd153a433fcd52b89f8686bb8aed15bbcad323


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 12:03:38 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    - Provide DumpJson for geometrical, ocaf and visualization classes;
    - Change depth parameter of DumpJson (constant is not obligate here)
    - Introduce a new macro for transient objects to be called as the first row in DumpJson: OCCT_DUMP_TRANSIENT_CLASS_BEGIN. We need not put the class name in the macro, using get_type_name of Standard_Transient for it.
    - change implementation of OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN. It is not an sentry more and it does not create a new hierarchy level. It appends a new row into the output stream: "className": <className>
    - OCCT_DUMP_* does not require semicolon
    - class header is included first in source files of TDataStd, TDocStd, TCAFDoc
(0090220)
git   
2020-01-31 07:09   
Branch CR31313_9 has been created by nds.

SHA-1: 3b1a0f62690b5e924308da7d3faf7aa883357377


Detailed log of new commits:

Author: nds
Date: Tue Jan 28 12:03:38 2020 +0300

    0031313: Foundation Classes - Dump improvement for classes
    
    - Provide DumpJson for geometrical, ocaf and visualization classes;
    - Change depth parameter of DumpJson (constant is not obligate here)
    - Introduce a new macro for transient objects to be called as the first row in DumpJson: OCCT_DUMP_TRANSIENT_CLASS_BEGIN. We need not put the class name in the macro, using get_type_name of Standard_Transient for it.
    - change implementation of OCCT_DUMP_CLASS_BEGIN and OCCT_DUMP_TRANSIENT_CLASS_BEGIN. It is not an sentry more and it does not create a new hierarchy level. It appends a new row into the output stream: "className": <className>
    - OCCT_DUMP_* does not require semicolon
    - class header is included first in source files of TDataStd, TDocStd, TCAFDoc
(0090224)
nds   
2020-01-31 12:10   
Dear Kirill

remarks are corrected, please check it on CR31313_9.
Jenkins job is: http://jenkins-test-12.nnov.opencascade.com/view/CR31313_9-master-NDS/ [^]

Thank you in advance, Natalia
(0090226)
nds   
2020-01-31 13:04   
Dear Igor,

could you please check doxygen warnings on this build as we agreed yesterday.
Mentioned in remarks from Kirill above. It's a comment in Standard_Dump.hxx:
 "<class_name>key_1\value_1\key_2\value_2</class_name>")

Please, phone if something is wrong.
Thank you in advance, Natalia
(0090239)
bugmaster   
2020-01-31 17:15   
Combination -
OCCT branch : CR31313_9
master SHA - 3b1a0f62690b5e924308da7d3faf7aa883357377
fe4497f3246e6bc1ced97ac331c148f0809ded15
Products branch : WEEK-5 SHA - 0711565f1ee16ea2d6b8b6df75aff21091d0b26d
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Debian80-64:
OCCT
Total CPU difference: 16997.770000000015 / 17032.770000000073 [-0.21%]
Products
Total CPU difference: 12139.050000000114 / 12148.700000000104 [-0.08%]
Windows-64-VC14:
OCCT
Total CPU difference: 18456.078125 / 18461.609375 [-0.03%]
Products
Total CPU difference: 14176.84375 / 14126.28125 [+0.36%]


Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention
(0090258)
git   
2020-02-01 21:47   
Branch CR31313_9 has been deleted by inv.

SHA-1: 3b1a0f62690b5e924308da7d3faf7aa883357377
(0090259)
git   
2020-02-01 21:47   
Branch CR31313_8 has been deleted by inv.

SHA-1: 41bd153a433fcd52b89f8686bb8aed15bbcad323
(0090263)
git   
2020-02-01 21:47   
Branch CR31313_7 has been deleted by inv.

SHA-1: b5feb171ce0a5ed7897b3b8c5cb3f5ce04dae60e
(0090266)
git   
2020-02-01 21:47   
Branch CR31313_4 has been deleted by inv.

SHA-1: f9ef7742a2e7f9f6cf9167554c4fb7318742eb50
(0090267)
git   
2020-02-01 21:47   
Branch CR31313 has been deleted by inv.

SHA-1: a62ac2e12316c9411aae04c9d2dee129da1aac16