X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI.i;h=bdf6c28e52b440c0161f3fd7a0010419d974c8d9;hb=031fb5e7c551e695afa72a9de299f118a40d8d88;hp=f601d1b11ea2317844500fba0bdee5e2de0eeba7;hpb=b50f2e7197f799e272292692ab581b9e164848b2;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI.i b/src/ModelAPI/ModelAPI.i index f601d1b11..bdf6c28e5 100644 --- a/src/ModelAPI/ModelAPI.i +++ b/src/ModelAPI/ModelAPI.i @@ -1,5 +1,13 @@ /* ModelAPI.i */ -%module ModelAPI +%module(directors="1") ModelAPI +%feature("director:except") { + if ($error != NULL) { + PyErr_Print(); + std::cerr << std::endl; + throw Swig::DirectorMethodException(); + } +} + %{ #include "GeomAPI_Interface.h" #include "GeomAPI_Shape.h" @@ -8,6 +16,7 @@ #include "ModelAPI_Session.h" #include "ModelAPI_Object.h" #include "ModelAPI_Feature.h" + #include "ModelAPI_Plugin.h" #include "ModelAPI_CompositeFeature.h" #include "ModelAPI_Data.h" #include "ModelAPI_Attribute.h" @@ -50,12 +59,18 @@ %include "std_list.i" %include "std_shared_ptr.i" +// directors +%feature("director") ModelAPI_Plugin; +%feature("director") ModelAPI_Object; +%feature("director") ModelAPI_Feature; + // shared pointers // For ModelAPI_ResultConstruction.shape() %shared_ptr(GeomAPI_Interface) %shared_ptr(GeomAPI_Shape) %shared_ptr(ModelAPI_Document) %shared_ptr(ModelAPI_Session) +%shared_ptr(ModelAPI_Plugin) %shared_ptr(ModelAPI_Object) %shared_ptr(ModelAPI_Feature) %shared_ptr(ModelAPI_CompositeFeature) @@ -86,6 +101,7 @@ %include "GeomAPI_Shape.h" %include "ModelAPI_Document.h" %include "ModelAPI_Session.h" +%include "ModelAPI_Plugin.h" %include "ModelAPI_Object.h" %include "ModelAPI_Feature.h" %include "ModelAPI_CompositeFeature.h" @@ -112,14 +128,30 @@ %include "ModelAPI_ResultParameters.h" %include "ModelAPI_Tools.h" +// std::list -> [] %template(ObjectList) std::list >; %template(ResultList) std::list >; %template(DocumentList) std::list >; +// std::dynamic_pointer_cast template std::shared_ptr shared_ptr_cast(std::shared_ptr theObject); %template(modelAPI_CompositeFeature) shared_ptr_cast; +%template(modelAPI_Feature) shared_ptr_cast; + +%template(modelAPI_Result) shared_ptr_cast; %template(modelAPI_ResultConstruction) shared_ptr_cast; %template(modelAPI_ResultBody) shared_ptr_cast; %template(modelAPI_ResultPart) shared_ptr_cast; +%template(modelAPI_ResultGroup) shared_ptr_cast; - +// Attribute casts +%template(modelAPI_AttributeDocRef) shared_ptr_cast; +%template(modelAPI_AttributeDouble) shared_ptr_cast; +%template(modelAPI_AttributeInteger) shared_ptr_cast; +%template(modelAPI_AttributeString) shared_ptr_cast; +%template(modelAPI_AttributeReference) shared_ptr_cast; +%template(modelAPI_AttributeRefAttr) shared_ptr_cast; +%template(modelAPI_AttributeBoolean) shared_ptr_cast; +%template(modelAPI_AttributeSelection) shared_ptr_cast; +%template(modelAPI_AttributeSelectionList) shared_ptr_cast; +%template(modelAPI_AttributeRefList) shared_ptr_cast;