mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-09 13:22:24 +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:
@@ -35,6 +35,7 @@ is
|
||||
imported VectorOfDocumentSection;
|
||||
|
||||
Factory (theGUID : GUID from Standard) returns Transient from Standard;
|
||||
---C++: return const &
|
||||
|
||||
AttributeDrivers (MsgDrv : MessageDriver from CDM)
|
||||
returns ADriverTable from BinMDF;
|
||||
|
@@ -32,7 +32,7 @@ static Standard_GUID BinLRetrievalDriver("13a56836-8269-11d5-aab2-0050044b1af1")
|
||||
//function : Factory
|
||||
//purpose : PLUGIN FACTORY
|
||||
//=======================================================================
|
||||
Handle(Standard_Transient) BinLDrivers::Factory(const Standard_GUID& theGUID)
|
||||
const Handle(Standard_Transient)& BinLDrivers::Factory(const Standard_GUID& theGUID)
|
||||
{
|
||||
if (theGUID == BinLStorageDriver)
|
||||
{
|
||||
@@ -55,7 +55,8 @@ Handle(Standard_Transient) BinLDrivers::Factory(const Standard_GUID& theGUID)
|
||||
}
|
||||
|
||||
Standard_Failure::Raise ("BinLDrivers : unknown GUID");
|
||||
return NULL;
|
||||
static Handle(Standard_Transient) aNullHandle;
|
||||
return aNullHandle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -89,7 +90,4 @@ TCollection_AsciiString BinLDrivers::StorageVersion()
|
||||
return aVersionStr;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
|
||||
#endif
|
||||
PLUGIN(BinLDrivers)
|
||||
|
Reference in New Issue
Block a user