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:
@@ -33,6 +33,7 @@ is
|
||||
class DocumentRetrievalDriver;
|
||||
|
||||
Factory (theGUID : GUID from Standard) returns Transient from Standard;
|
||||
---C++: return const &
|
||||
|
||||
AttributeDrivers (MsgDrv : MessageDriver from CDM)
|
||||
returns ADriverTable from BinMDF;
|
||||
|
@@ -34,7 +34,7 @@ static Standard_GUID BinRetrievalDriver("03a56836-8269-11d5-aab2-0050044b1af1");
|
||||
//function : Factory
|
||||
//purpose : PLUGIN FACTORY
|
||||
//=======================================================================
|
||||
Handle(Standard_Transient) BinDrivers::Factory(const Standard_GUID& theGUID)
|
||||
const Handle(Standard_Transient)& BinDrivers::Factory(const Standard_GUID& theGUID)
|
||||
{
|
||||
if (theGUID == BinStorageDriver)
|
||||
{
|
||||
@@ -57,7 +57,8 @@ Handle(Standard_Transient) BinDrivers::Factory(const Standard_GUID& theGUID)
|
||||
}
|
||||
|
||||
Standard_Failure::Raise ("BinDrivers : unknown GUID");
|
||||
return NULL;
|
||||
static Handle(Standard_Transient) aNullHandle;
|
||||
return aNullHandle;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
@@ -90,7 +91,4 @@ TCollection_AsciiString BinDrivers::StorageVersion()
|
||||
return BinLDrivers::StorageVersion();
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
|
||||
#endif
|
||||
PLUGIN(BinDrivers)
|
||||
|
Reference in New Issue
Block a user