|Anonymous | Login||2019-08-18 07:51 MSK|
|My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0024925||Community||[OCCT] OCCT:Application Framework||public||2014-05-14 20:05||2016-06-23 09:30|
|Product Version||[OCCT] 6.7.1|
|Target Version||[OCCT] 6.8.0||Fixed in Version||[OCCT] 6.8.0|
|Summary||0024925: Enabling OCAF persistence without setting environment variables|
|Description||Currently in order to enable OCAF persistence there must be a few variables defined and resource files supplied. These includes:|
- the Plugin file and the CSF_PluginDefaults variable.
- the <AppFormat> file and the CSF_<AppFormat>Defaults variable, where <AppFormat> is the value returned by Resources() method (re-)defined in the subclass of TDocStd_Application.
This creates inconvenience and fragility when redistributing the
OCC-based solutions: end-user applications and especially libraries.
The modifications below allow to remove this need by providing respective API. Current behavior is preserved. Moreover environment variables and external files will override API-based values.
Details are below:
1. Eliminated need in FWOSPlugin library and respective entrance in the Plugin file.
If the entry for plugin a148e300-5740-11d1-a904-080036aaa103 is not provided the driver will be defaulted to CDF_FWOSDriver (which has been moved from FWOSDriver package). FWOSPlugin is retained but is reduced in size (moving FWOSDriver_Driver into CDF). Possible next step is to remove FWOSPlugin altogether.
2. TDocStd_Application subclasses may define Resources() method to return an empty string, and instead directly set up the myResources resource manager which is now made protected in TDocStd_Application.
3. The Plugin::Load() method can now consult Plugin::AdditionalPluginMap() if it cannot find the plugin using the Plugin file. This global map can be populated from inside user's code.
Plugin::Load() now accepts an additional boolean parameter theVerbose to suppress errors sent to std::cout. The default value is true to preserve current behavior.
CDF_Session::LoadDriver() specifies false when trying to load the metadata driver.
|Steps To Reproduce||The test sample demonstrates how to enable XML persistence using the API-only approach.|
|Tags||No tags attached.|
|Test case number||bugs caf(015) bug24925|
|Attached Files||OCCXDETestLib_OCC_excerpt.cxx (3,965 bytes) 2014-05-14 20:09|
Roman Lygin (developer)
The fix has been pushed to git.
Integration requested for 6.8.0. The target version is set respectively.
To be tested.
|Could you please rebase CR24925 to current state of master.|
Roman Lygin (developer)
Rebased to the master of 06/17/14.
The remote branch renamed with CR24925_1.
test case bugs/caf/bug24925 using new command OCC24925 has been pushed to branch CR24925_1.
The test is based on attached file OCCXDETestLib_OCC_excerpt.cxx with following changes:
- Standard TKXml plugin is used instead of custom plugin.
- Test case corrupt CSF_PluginDefaults environment variable to prevent default Plugin file loading (containing TKXml definition).
Branch CR24925_1 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
Number of compiler warnings:
occt component :
Linux: 16 (16 on master)
Windows: 0 (0 on master)
MacOS: 200 (203 on master)
products component :
Linux: 11 (11 on master)
Windows: 2 (2 on master)
bugs caf(015) bug24925: OK
Testing on Linux:
Total MEMORY difference: 348470736 / 348657500
Total CPU difference: 50404.65000000001 / 51365.58000000003
Testing on Windows:
Total MEMORY difference: 376318216 / 376769996
Total CPU difference: 43594.78125 / 38728.28125
There are no differences in images found by testdiff.
could you please review new OCC24925 draw command.
The DRAW command looks OK to me.
@Roman: I have a few general comments / questions to the issue (sorry for being late):
a) The whole approach with plugins loaded via resource files is redundant: it should be easier to link directly to required libs. The overall refactoring is planned.
b) Instead of playing with your own resource managers, why not just set environment variables expected by OCAF programmatically?
Branch CR24925_1 from occt git-repository (and master from products git-repository) was rebased on current master, recompiled and retested.
Roman Lygin (developer)
Thanks for your comments.
a). Certainly, feel free to refactor the overall mechanism per your plan. The current modification is just a minor relief within the current paradigm. The plugin-based approach is flexible and has multiple advantages over direct linking, e.g. reduced list of required libraries, smaller memory footprint, etc.
For instance, for persistence-less OCAF-based applications direct linking with all persistence flavors would just be an overkill. Also without plugin-based approach enabling user-defined persistence becomes awkward to implement.
So unless I am missing something, the plugin-based architecture is rather to stay. I am open to discussion, of course.
b). The whole idea of this modification is to enable fully API based approach to overcome the need of having environment variable and resource files (although compatibility and prevailing of the current mechanism is preserved). For the library vendors (like CAD Exchanger) it is virtually impossible to reliably set environment variables - there is no control over the application vendor or end-user environment, it is impossible to even compute relative path of the resource file (e.g. Plugin) from the library the call is made from, using some temporary directory to generate temporary Plugin file is fragile, etc.
IMHO the long-term objective should be to enable all settings via API and optionally have environment variables as an extra option to redefine API-set values. For instance, the OpenMP library is a good example of this two-fold approach - the number of threads will be automatically computed upon library initialization, optionally using omp_set_num_threads() you can explicitly specify that value, the optional OMP_NUM_THREADS environment variable will redefine that.
Thus, it would be very convenient to have OCC-based libraries/applications running out of the box without a need to have any single env var set. Whatever is required must be precomputed on the fly, or set via optional API, or redefined via optional env vars.
Branch CR24925 has been deleted by inv.
Branch CR24925_1 has been deleted by inv.
Roman Lygin (developer)
|Verified in 6.8.0 beta.|
occt: master b6c0b841
Timestamp: 2014-07-10 10:47:20
Author: Roman Lygin
|0024925: Enabling OCAF persistence without setting environment variables
Add test case bugs/caf/bug24925
Merging with current master IR-2014-07-03
|mod - src/CDF/CDF.cdl|
|mod - src/CDF/CDF_Session.cxx|
|mod - src/FWOSDriver/FWOSDriver.cdl|
|mod - src/FWOSDriver/FWOSDriver_DriverFactory.cxx|
|mod - src/Plugin/Plugin.cdl|
|mod - src/Plugin/Plugin.cxx|
|mod - src/QABugs/QABugs_19.cxx|
|mod - src/TDocStd/TDocStd_Application.cdl|
|mod - src/TDocStd/TDocStd_Application.cxx|
|add - tests/bugs/caf/bug24925|
|2014-05-14 20:05||Roman Lygin||New Issue|
|2014-05-14 20:05||Roman Lygin||Assigned To||=> szy|
|2014-05-14 20:09||Roman Lygin||File Added: OCCXDETestLib_OCC_excerpt.cxx|
|2014-05-14 20:19||Roman Lygin||Note Added: 0029338|
|2014-05-14 20:19||Roman Lygin||Status||new => resolved|
|2014-05-14 23:49||Roman Lygin||Relationship added||related to 0009457|
|2014-06-09 17:55||szy||Note Added: 0029753|
|2014-06-09 17:55||szy||Assigned To||szy => mkv|
|2014-06-09 17:55||szy||Status||resolved => reviewed|
|2014-06-09 18:38||apn||Note Added: 0029755|
|2014-06-09 18:39||apn||Assigned To||mkv => Roman Lygin|
|2014-06-09 18:39||apn||Status||reviewed => assigned|
|2014-06-18 12:27||Roman Lygin||Note Added: 0029810|
|2014-06-18 12:27||Roman Lygin||Assigned To||Roman Lygin => apn|
|2014-06-18 12:27||Roman Lygin||Status||assigned => resolved|
|2014-06-18 12:31||apn||Status||resolved => reviewed|
|2014-06-18 14:00||mkv||Assigned To||apn => mkv|
|2014-06-23 11:14||mkv||Assigned To||mkv => apv|
|2014-06-25 12:36||kgv||Note Added: 0029878|
|2014-06-25 19:53||mkv||Note Added: 0029884|
|2014-06-25 19:54||mkv||Note Added: 0029885|
|2014-06-25 19:55||mkv||Test case number||=> bugs caf(015) bug24925|
|2014-06-25 19:55||mkv||Assigned To||apv => abv|
|2014-06-25 19:55||mkv||Status||reviewed => feedback|
|2014-07-07 09:49||abv||Note Added: 0029975|
|2014-07-07 09:49||abv||Assigned To||abv => mkv|
|2014-07-08 08:53||mkv||Note Added: 0029992|
|2014-07-08 08:53||mkv||Assigned To||mkv => bugmaster|
|2014-07-08 08:53||mkv||Status||feedback => tested|
|2014-07-08 10:08||Roman Lygin||Note Added: 0029994|
|2014-07-11 14:22||apn||Changeset attached||=> occt master b6c0b841|
|2014-07-11 14:22||apn||Assigned To||bugmaster => apn|
|2014-07-11 14:22||apn||Status||tested => verified|
|2014-07-11 14:22||apn||Resolution||open => fixed|
|2014-07-12 12:17||kgv||Relationship added||related to 0024895|
|2014-07-22 16:18||git||Note Added: 0030338|
|2014-07-22 16:18||git||Note Added: 0030339|
|2014-08-20 17:25||Pawel||Relationship added||parent of 0025173|
|2014-10-15 15:39||Roman Lygin||Note Added: 0033142|
|2014-11-11 12:44||aiv||Fixed in Version||=> 6.8.0|
|2014-11-11 12:59||aiv||Status||verified => closed|
|2016-04-25 21:59||abv||Relationship added||related to 0027401|
|2016-06-23 09:30||abv||Relationship added||related to 0025812|
|Copyright © 2000 - 2019 MantisBT Team|