1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-09-03 14:10:33 +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

@@ -25,6 +25,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;

View File

@@ -29,7 +29,7 @@ static Standard_GUID BinXCAFRetrievalDriver("a78ff497-a779-11d5-aab4-0050044b1af
//function :
//purpose :
//=======================================================================
Handle(Standard_Transient) BinXCAFDrivers::Factory(const Standard_GUID& theGUID) {
const Handle(Standard_Transient)& BinXCAFDrivers::Factory(const Standard_GUID& theGUID) {
if (theGUID == BinXCAFStorageDriver)
{
@@ -53,7 +53,8 @@ Handle(Standard_Transient) BinXCAFDrivers::Factory(const Standard_GUID& theGUID)
Standard_Failure::Raise ("XCAFBinDrivers : unknown GUID");
return NULL;
static Handle(Standard_Transient) aNullHandle;
return aNullHandle;
}
//=======================================================================
@@ -70,7 +71,4 @@ Handle(BinMDF_ADriverTable) BinXCAFDrivers::AttributeDrivers(const Handle(CDM_Me
return aTable;
}
#ifdef _MSC_VER
#pragma warning(disable:4190) /* disable warning on C++ type returned by C function; should be OK for C++ usage */
#endif
PLUGIN(BinXCAFDrivers)