mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-29 14:00: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:
@@ -32,34 +32,6 @@
|
||||
#include <TCollection_ExtendedString.hxx>
|
||||
#include <UTL.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : StorageDriver
|
||||
//purpose : gets in the EuclidDesktop resource the plugin
|
||||
// identifier of the driver plugs the driver.
|
||||
//=======================================================================
|
||||
Handle(PCDM_StorageDriver) PCDM::StorageDriver(const Handle(CDM_Document)& aDocument) {
|
||||
|
||||
if(!PCDM::FindStorageDriver(aDocument)) {
|
||||
Standard_SStream aMsg; aMsg << "could not find the storage driver plugin resource for the format: " << aDocument->StorageFormat()<<(char) 0;
|
||||
Standard_NoSuchObject::Raise(aMsg);
|
||||
}
|
||||
//return Handle(PCDM_StorageDriver)::DownCast(Plugin::Load(aDocument->StoragePlugin()));
|
||||
Handle(PCDM_StorageDriver) DRIVER =
|
||||
Handle(PCDM_StorageDriver)::DownCast(Plugin::Load(aDocument->StoragePlugin()));
|
||||
if (!DRIVER.IsNull()) DRIVER->SetFormat(aDocument->StorageFormat());
|
||||
return DRIVER;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FindStorageDriver
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean PCDM::FindStorageDriver(const Handle(CDM_Document)& aDocument) {
|
||||
|
||||
return aDocument->FindStoragePlugin();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : FileDriverType
|
||||
//purpose :
|
||||
|
@@ -34,12 +34,6 @@ class TCollection_AsciiString;
|
||||
class PCDM
|
||||
{
|
||||
public:
|
||||
Standard_EXPORT static Standard_Boolean FindStorageDriver (const Handle(CDM_Document)& aDocument);
|
||||
|
||||
//! gets in the EuclidDesktop resource the plugin
|
||||
//! identifier of the driver plugs the driver.
|
||||
Standard_EXPORT static Handle(PCDM_StorageDriver) StorageDriver (const Handle(CDM_Document)& aDocument);
|
||||
|
||||
Standard_EXPORT static PCDM_TypeOfFileDriver FileDriverType (const TCollection_AsciiString& aFileName, PCDM_BaseDriverPointer& aBaseDriver);
|
||||
|
||||
Standard_EXPORT static PCDM_TypeOfFileDriver FileDriverType (Standard_IStream& theIStream, PCDM_BaseDriverPointer& theBaseDriver);
|
||||
|
@@ -46,11 +46,6 @@ void PCDM_StorageDriver::Write(const Handle(CDM_Document)& aDocument, const TCol
|
||||
{
|
||||
Handle(Storage_Schema) theSchema = new Storage_Schema;
|
||||
|
||||
TColStd_SequenceOfExtendedString theExtensions;
|
||||
aDocument->Extensions(theExtensions);
|
||||
LoadExtensions(theSchema,theExtensions);
|
||||
|
||||
|
||||
Handle(Storage_Data) theData = new Storage_Data;
|
||||
|
||||
static Standard_Boolean Failure;
|
||||
@@ -114,9 +109,6 @@ void PCDM_StorageDriver::Write (const Handle(CDM_Document)& /*aDocument*/, Stand
|
||||
{
|
||||
|
||||
}
|
||||
//void PCDM_StorageDriver::LoadExtensions(const Handle(Storage_Schema)& aSchema, const TColStd_SequenceOfExtendedString& Extensions) {}
|
||||
void PCDM_StorageDriver::LoadExtensions(const Handle(Storage_Schema)& , const TColStd_SequenceOfExtendedString& ) {}
|
||||
|
||||
|
||||
//Handle(PCDM_Document) PCDM_StorageDriver::Make(const Handle(CDM_Document)& aDocument) {
|
||||
Handle(PCDM_Document) PCDM_StorageDriver::Make(const Handle(CDM_Document)& ) {
|
||||
|
@@ -64,10 +64,6 @@ public:
|
||||
//! by the previous Make method.
|
||||
Standard_EXPORT virtual void Make (const Handle(CDM_Document)& aDocument, PCDM_SequenceOfDocument& Documents);
|
||||
|
||||
Standard_EXPORT virtual TCollection_ExtendedString SchemaName() const = 0;
|
||||
|
||||
Standard_EXPORT virtual void LoadExtensions (const Handle(Storage_Schema)& aSchema, const TColStd_SequenceOfExtendedString& Extensions);
|
||||
|
||||
//! Warning! raises DriverError if an error occurs during inside the
|
||||
//! Make method.
|
||||
//! stores the content of the Document into a new file.
|
||||
|
Reference in New Issue
Block a user