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

0024023: Revamp the OCCT Handle -- plugin

Definition of PLUGINFACTORY function changed to return Standard_Transient* instead of Handle(Standard_Transient), which cannot be returned by C-style function.
Default implementation of PLUGINFACTORY() instantiated by macro PLUGIN() is corrected accordingly.
Methods Factory() in persistence packages are made returning const & to handle; this is to reflect the fact that returned handle should point to existing object (usually statically allocated) rather than new one.
This commit is contained in:
abv
2015-06-29 09:17:43 +03:00
parent 83eaf3e892
commit ce8b059af3
20 changed files with 35 additions and 53 deletions

View File

@@ -30,7 +30,7 @@
static Standard_GUID BinStorageDriver ("f78ff4a2-a779-11d5-aab4-0050044b1af1");
static Standard_GUID BinRetrievalDriver("f78ff4a3-a779-11d5-aab4-0050044b1af1");
Handle(Standard_Transient) BinTObjDrivers::Factory(const Standard_GUID& aGUID)
const Handle(Standard_Transient)& BinTObjDrivers::Factory(const Standard_GUID& aGUID)
{
if(aGUID == BinStorageDriver)
{
@@ -69,7 +69,4 @@ void BinTObjDrivers::AddDrivers (const Handle(BinMDF_ADriverTable)& aDriverTable
aDriverTable -> AddDriver (new BinTObjDrivers_IntSparseArrayDriver (aMsgDrv));
}
#ifdef _MSC_VER
#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
#endif
PLUGIN(BinTObjDrivers)

View File

@@ -30,7 +30,7 @@ class BinTObjDrivers
public:
// ---------- PUBLIC METHODS ----------
Standard_EXPORT static Handle(Standard_Transient) Factory
Standard_EXPORT static const Handle(Standard_Transient)& Factory
(const Standard_GUID& aGUID);
// Returns a driver corresponding to <aGUID>. Used for plugin.