Salome HOME
Add call execute() to sketch feature.
[modules/shaper.git] / src / ModelAPI / ModelAPI.i
1 /* ModelAPI.i */
2 %module(directors="1") ModelAPI
3 %feature("director:except") {
4     if ($error != NULL) {
5       PyErr_Print();
6       std::cerr << std::endl;
7       throw Swig::DirectorMethodException();
8     }
9 }
10
11 %{
12   #include "ModelAPI.h"
13   #include "ModelAPI_Entity.h"
14   #include "ModelAPI_Document.h"
15   #include "ModelAPI_Session.h"
16   #include "ModelAPI_Object.h"
17   #include "ModelAPI_Feature.h"
18   #include "ModelAPI_Plugin.h"
19   #include "ModelAPI_CompositeFeature.h"
20   #include "ModelAPI_Data.h"
21   #include "ModelAPI_Attribute.h"
22   #include "ModelAPI_AttributeDocRef.h"
23   #include "ModelAPI_AttributeDouble.h"
24   #include "ModelAPI_AttributeInteger.h"
25   #include "ModelAPI_AttributeIntArray.h"
26   #include "ModelAPI_AttributeString.h"
27   #include "ModelAPI_AttributeReference.h"
28   #include "ModelAPI_AttributeRefAttr.h"
29   #include "ModelAPI_AttributeSelection.h"
30   #include "ModelAPI_AttributeSelectionList.h"
31   #include "ModelAPI_AttributeValidator.h"
32   #include "ModelAPI_Validator.h"
33   #include "ModelAPI_FeatureValidator.h"
34   #include "ModelAPI_AttributeRefList.h"
35   #include "ModelAPI_AttributeBoolean.h"
36   #include "ModelAPI_Result.h"
37   #include "ModelAPI_ResultConstruction.h"
38   #include "ModelAPI_ResultBody.h"
39   #include "ModelAPI_ResultPart.h"
40   #include "ModelAPI_ResultParameter.h"
41   #include "ModelAPI_ResultGroup.h"
42   #include "ModelAPI_Tools.h"
43   #include "ModelAPI_ResultCompSolid.h"
44   
45   #include <memory>
46   #include <string>
47   
48   template<class T1, class T2> 
49   std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject)
50   { 
51     return std::dynamic_pointer_cast<T1>(theObject); 
52   }
53
54 %}
55
56 // to avoid error on this
57 #define MODELAPI_EXPORT
58
59 // standard definitions
60 %include "GeomAPI.i"
61 %include "typemaps.i"
62 %include "std_string.i"
63 %include "std_list.i"
64 %include "std_shared_ptr.i"
65
66 // directors
67 %feature("director") ModelAPI_Plugin;
68 %feature("director") ModelAPI_Object;
69 %feature("director") ModelAPI_Feature;
70 %feature("director") ModelAPI_CompositeFeature;
71 %feature("director") ModelAPI_Data;
72
73 // shared pointers
74 // For ModelAPI_ResultConstruction.shape()
75 %shared_ptr(ModelAPI_Entity)
76 %shared_ptr(ModelAPI_Document)
77 %shared_ptr(ModelAPI_Session)
78 %shared_ptr(ModelAPI_Plugin)
79 %shared_ptr(ModelAPI_Object)
80 %shared_ptr(ModelAPI_Feature)
81 %shared_ptr(ModelAPI_CompositeFeature)
82 %shared_ptr(ModelAPI_Data)
83 %shared_ptr(ModelAPI_Attribute)
84 %shared_ptr(ModelAPI_AttributeDocRef)
85 %shared_ptr(ModelAPI_AttributeDouble)
86 %shared_ptr(ModelAPI_AttributeInteger)
87 %shared_ptr(ModelAPI_AttributeIntArray)
88 %shared_ptr(ModelAPI_AttributeString)
89 %shared_ptr(ModelAPI_AttributeReference)
90 %shared_ptr(ModelAPI_AttributeRefAttr)
91 %shared_ptr(ModelAPI_AttributeRefList)
92 %shared_ptr(ModelAPI_AttributeBoolean)
93 %shared_ptr(ModelAPI_AttributeSelection)
94 %shared_ptr(ModelAPI_AttributeSelectionList)
95 %shared_ptr(ModelAPI_Validator)
96 %shared_ptr(ModelAPI_AttributeValidator)
97 %shared_ptr(ModelAPI_FeatureValidator)
98 %shared_ptr(ModelAPI_Result)
99 %shared_ptr(ModelAPI_ResultConstruction)
100 %shared_ptr(ModelAPI_ResultBody)
101 %shared_ptr(ModelAPI_ResultPart)
102 %shared_ptr(ModelAPI_ResultGroup)
103 %shared_ptr(ModelAPI_ResultParameter)
104 %shared_ptr(ModelAPI_ResultCompSolid)
105
106 // all supported interfaces
107 %include "ModelAPI_Entity.h"
108 %include "ModelAPI_Document.h"
109 %include "ModelAPI_Session.h"
110 %include "ModelAPI_Plugin.h"
111 %include "ModelAPI_Object.h"
112 %include "ModelAPI_Feature.h"
113 %include "ModelAPI_CompositeFeature.h"
114 %include "ModelAPI_Data.h"
115 %include "ModelAPI_Attribute.h"
116 %include "ModelAPI_AttributeDocRef.h"
117 %include "ModelAPI_AttributeDouble.h"
118 %include "ModelAPI_AttributeInteger.h"
119 %include "ModelAPI_AttributeIntArray.h"
120 %include "ModelAPI_AttributeString.h"
121 %include "ModelAPI_AttributeReference.h"
122 %include "ModelAPI_AttributeRefAttr.h"
123 %include "ModelAPI_AttributeBoolean.h"
124 %include "ModelAPI_AttributeSelection.h"
125 %include "ModelAPI_AttributeSelectionList.h"
126 %include "ModelAPI_AttributeRefList.h"
127 %include "ModelAPI_Validator.h"
128 %include "ModelAPI_AttributeValidator.h"
129 %include "ModelAPI_FeatureValidator.h"
130 %include "ModelAPI_Result.h"
131 %include "ModelAPI_ResultConstruction.h"
132 %include "ModelAPI_ResultBody.h"
133 %include "ModelAPI_ResultPart.h"
134 %include "ModelAPI_ResultGroup.h"
135 %include "ModelAPI_ResultParameter.h"
136 %include "ModelAPI_Tools.h"
137 %include "ModelAPI_ResultCompSolid.h"
138
139 // std::list -> [] 
140 %template(ObjectList) std::list<std::shared_ptr<ModelAPI_Object> >;
141 %template(ResultList) std::list<std::shared_ptr<ModelAPI_Result> >;
142 %template(DocumentList) std::list<std::shared_ptr<ModelAPI_Document> >;
143
144 // std::dynamic_pointer_cast
145 template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject);
146 %template(featureToCompositeFeature) shared_ptr_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
147 %template(objectToFeature) shared_ptr_cast<ModelAPI_Feature, ModelAPI_Object>;
148 %template(compositeFeatureToFeature) shared_ptr_cast<ModelAPI_Feature, ModelAPI_CompositeFeature>;
149
150 %template(modelAPI_Result) shared_ptr_cast<ModelAPI_Result, ModelAPI_Object>;
151 %template(modelAPI_ResultConstruction) shared_ptr_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
152 %template(modelAPI_ResultBody) shared_ptr_cast<ModelAPI_ResultBody, ModelAPI_Result>;
153 %template(modelAPI_ResultPart) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_Result>;
154 %template(modelAPI_ResultParameter) shared_ptr_cast<ModelAPI_ResultParameter, ModelAPI_Result>;
155 %template(modelAPI_ResultGroup) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_ResultGroup>;
156 %template(modelAPI_ResultCompSolid) shared_ptr_cast<ModelAPI_ResultCompSolid, ModelAPI_ResultBody>;
157
158 // Attribute casts
159 %template(modelAPI_AttributeDocRef)        shared_ptr_cast<ModelAPI_AttributeDocRef, ModelAPI_Attribute>;
160 %template(modelAPI_AttributeDouble)        shared_ptr_cast<ModelAPI_AttributeDouble, ModelAPI_Attribute>;
161 %template(modelAPI_AttributeInteger)       shared_ptr_cast<ModelAPI_AttributeInteger, ModelAPI_Attribute>;
162 %template(modelAPI_AttributeIntArray)      shared_ptr_cast<ModelAPI_AttributeIntArray, ModelAPI_Attribute>;
163 %template(modelAPI_AttributeString)        shared_ptr_cast<ModelAPI_AttributeString, ModelAPI_Attribute>;
164 %template(modelAPI_AttributeReference)     shared_ptr_cast<ModelAPI_AttributeReference, ModelAPI_Attribute>;
165 %template(modelAPI_AttributeRefAttr)       shared_ptr_cast<ModelAPI_AttributeRefAttr, ModelAPI_Attribute>;
166 %template(modelAPI_AttributeBoolean)       shared_ptr_cast<ModelAPI_AttributeBoolean, ModelAPI_Attribute>;
167 %template(modelAPI_AttributeSelection)     shared_ptr_cast<ModelAPI_AttributeSelection, ModelAPI_Attribute>;
168 %template(modelAPI_AttributeSelectionList) shared_ptr_cast<ModelAPI_AttributeSelectionList, ModelAPI_Attribute>;
169 %template(modelAPI_AttributeRefList)       shared_ptr_cast<ModelAPI_AttributeRefList, ModelAPI_Attribute>;