1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-19 13:40:49 +03:00

0025812: Replace dynamic loading mechanism of OCAF persistence with dynamic-link one

Fields to store cached instances of reader and writer drivers for each format are added in CDF_Application.
Method DefineFormat() is added in TDocStd_Application, allowing defining format completely by single call, including drivers to be used for persistence.
All OCAF driver packages provide static method DefineFormat() that defines standard OCAF persistence format supported by corresponding package; these methods are called in DRAW to enable all persistence by default.

DRAW commands (except TObj-specific ones) now use single instance of OCAF Application, returned by DDocStd::GetApplication(). Other instances are eliminated, as well as method DDocStd::Find(const Handle(TDocStd_Application)&).
Method MessageDriver() and relevant field are moved to TDocStd_Application from its descendants.

Method CDF_Application::ReaderFromFormat() is made virtual to allow its redefinition in descendants.
Creation of storage driver is moved from PCDM::StorageDriver() to new virtual method CDF_Application::WriterFromFormat().
The code loading driver as plugin is retained in both these methods for compatibility.

Test command OCC24925 is converted to use virtual methods instead of defining plugin resource.

Migration table for old OCAF types is hard-coded in Storage_Schema::CheckTypeMigration().

Removed obsolete and unused items:
- FWOSPlugin library (driver is created directly)
- Methods in classes CDM_Document dealing with unused parameters of format
- DRAW command OCC23010 for testing non-reproducible issue #23010
- Methods PCDM::StorageDriver(), PCDM::FindStorageDriver()
- Method Formats() from CDF_Application and descendants
- Methods LoadExtensions and SchemaName from PCDM_StorageDriver
- Method Plugin::AdditionalPluginMap()
- Method BinLDrivers_DocumentStorageDriver::SchemaName()
- Method CDF_Application::DefaultExtension(), Reader(), FindReader(), FindReaderFromFormat()
- Method CDF_Store::Check()
This commit is contained in:
abv
2016-06-20 06:53:14 +03:00
parent 8072aba1ae
commit 6fe96f8416
221 changed files with 1001 additions and 8896 deletions

View File

@@ -24,6 +24,9 @@
#include <Standard_GUID.hxx>
#include <Plugin_Macro.hxx>
#include <PCDM_StorageDriver.hxx>
#include <TDocStd_Application.hxx>
static Standard_GUID StdRetrievalDriver ("ad696001-5b34-11d1-b5ba-00a0c9064368");
//=======================================================================
@@ -47,6 +50,16 @@ Handle(Standard_Transient) StdDrivers::Factory (const Standard_GUID& aGUID)
return NULL;
}
//=======================================================================
//function : DefineFormat
//purpose :
//=======================================================================
void StdDrivers::DefineFormat (const Handle(TDocStd_Application)& theApp)
{
theApp->DefineFormat ("MDTV-Standard", "Standard OCAF Document", "std",
new StdDrivers_DocumentRetrievalDriver, 0);
}
//=======================================================================
//function : BindTypes
//purpose : Register types

View File

@@ -14,28 +14,26 @@
#ifndef _StdDrivers_HeaderFile
#define _StdDrivers_HeaderFile
#include <Standard.hxx>
#include <Standard_DefineAlloc.hxx>
#include <Standard_Handle.hxx>
class Standard_Transient;
class Standard_GUID;
class StdObjMgt_MapOfInstantiators;
class TDocStd_Application;
class StdDrivers
{
friend class StdDrivers_DocumentRetrievalDriver;
public:
//! Depending from the ID, returns a list of storage
//! or retrieval attribute drivers. Used for plugin
Standard_EXPORT static Handle(Standard_Transient) Factory (const Standard_GUID& aGUID);
//! Defines format "MDTV-Standard" and registers its retrieval driver
//! in the specified application
Standard_EXPORT static void DefineFormat (const Handle(TDocStd_Application)& theApp);
//! Register types.
Standard_EXPORT static void BindTypes (StdObjMgt_MapOfInstantiators& theMap);
DEFINE_STANDARD_ALLOC
};
#endif // _StdDrivers_HeaderFile