0031920: Application Framework - speed up methods of getting label by entry and vice... IR-2021-05-21 WEEK-20
authorvro <vro@opencascade.com>
Thu, 13 May 2021 11:19:00 +0000 (14:19 +0300)
committerbugmaster <bugmaster@opencascade.com>
Sat, 22 May 2021 07:36:40 +0000 (10:36 +0300)
commit604aa3f4b3ce30a5f69fa10a783ac403c09c4293
tree9b4a6da5b0c5b68f1e3b2c301212a68aee50e646
parentf0ca3c819f4a5d0c53bea665fac9413ccc278254
0031920: Application Framework - speed up methods of getting label by entry and vice versa

            A table for fast access to the labels by entry is implemented in OCAF document. A method TDF_Data::SetAccessByEntries(true) fills-in a table for fast access to the labels. New labels, created later will be added to the table automatically. The method TDF_Tool::Label() will search the entry in the table and then, if not found, will call the old code. Disabling of usage of the table (by calling of TDF_Data::SetAccessByEntries(false)) cleans the internal table of entries - labels. By default, the table is not used.
            This improvement is useful for large documents with a lot of labels, and if the application uses entries to get labels. The application should call TDF_Data::SetAccessByEntries(true) for a document and then, the method TDF_Tool::Label() called inside OCAF and XCAF will use the fast access to the labels and speed-up the application.
            Also, the method TDF_Tool::Entry() is improved (by MPV).

            Modified files:
            - TDF_Data.hxx and cxx: the new methods SetAccessByEntries(bool), IsAccessByEntries() and GetLabel(entry) are implemented. No need to use the method GetLabel() directly. It is called in TDF_Tool::Label().
            - TDF_Label.cxx: adding of a newly created label to the table of entries - labels.
            - TDF_Tool.cxx: the method Entry() is accelerated (by MPV) and Label() is improved to call TDF_Data::GetLabel().
            - DDF_DataCommands.cxx: a new draw-command is added SetAccessByEntry, which sets or unsets usage of the table for fast access to the labels. Usage of the draw-command is illustrated in a new test "bugs caf bug31920".

            Tests:
            - bugs caf bug31920: a new simple test to check TDF_Tool::Label() when fast access to the labels is on.

            Doc:
            - dox\upgrade\upgrade.md is extended for new information
dox/upgrade/upgrade.md
src/DDF/DDF_DataCommands.cxx
src/TDF/TDF_Data.cxx
src/TDF/TDF_Data.hxx
src/TDF/TDF_Label.cxx
src/TDF/TDF_Tool.cxx
tests/bugs/caf/bug31920 [new file with mode: 0644]