Salome HOME
Debug of visualization of compsolids and sub-shapes
[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_AttributeString.h"
26   #include "ModelAPI_AttributeReference.h"
27   #include "ModelAPI_AttributeRefAttr.h"
28   #include "ModelAPI_AttributeSelection.h"
29   #include "ModelAPI_AttributeSelectionList.h"
30   #include "ModelAPI_AttributeValidator.h"
31   #include "ModelAPI_Validator.h"
32   #include "ModelAPI_FeatureValidator.h"
33   #include "ModelAPI_AttributeRefList.h"
34   #include "ModelAPI_AttributeBoolean.h"
35   #include "ModelAPI_Result.h"
36   #include "ModelAPI_ResultConstruction.h"
37   #include "ModelAPI_ResultBody.h"
38   #include "ModelAPI_ResultPart.h"
39   #include "ModelAPI_ResultParameter.h"
40   #include "ModelAPI_ResultGroup.h"
41   #include "ModelAPI_Tools.h"
42   
43   #include <memory>
44   #include <string>
45   
46   template<class T1, class T2> 
47   std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject)
48   { 
49     return std::dynamic_pointer_cast<T1>(theObject); 
50   }
51
52 %}
53
54 // to avoid error on this
55 #define MODELAPI_EXPORT
56
57 // standard definitions
58 %include "GeomAPI.i"
59 %include "typemaps.i"
60 %include "std_string.i"
61 %include "std_list.i"
62 %include "std_shared_ptr.i"
63
64 // directors
65 %feature("director") ModelAPI_Plugin;
66 %feature("director") ModelAPI_Object;
67 %feature("director") ModelAPI_Feature;
68 %feature("director") ModelAPI_CompositeFeature;
69 %feature("director") ModelAPI_Data;
70
71 // shared pointers
72 // For ModelAPI_ResultConstruction.shape()
73 %shared_ptr(ModelAPI_Entity)
74 %shared_ptr(ModelAPI_Document)
75 %shared_ptr(ModelAPI_Session)
76 %shared_ptr(ModelAPI_Plugin)
77 %shared_ptr(ModelAPI_Object)
78 %shared_ptr(ModelAPI_Feature)
79 %shared_ptr(ModelAPI_CompositeFeature)
80 %shared_ptr(ModelAPI_Data)
81 %shared_ptr(ModelAPI_Attribute)
82 %shared_ptr(ModelAPI_AttributeDocRef)
83 %shared_ptr(ModelAPI_AttributeDouble)
84 %shared_ptr(ModelAPI_AttributeInteger)
85 %shared_ptr(ModelAPI_AttributeString)
86 %shared_ptr(ModelAPI_AttributeReference)
87 %shared_ptr(ModelAPI_AttributeRefAttr)
88 %shared_ptr(ModelAPI_AttributeRefList)
89 %shared_ptr(ModelAPI_AttributeBoolean)
90 %shared_ptr(ModelAPI_AttributeSelection)
91 %shared_ptr(ModelAPI_AttributeSelectionList)
92 %shared_ptr(ModelAPI_Validator)
93 %shared_ptr(ModelAPI_AttributeValidator)
94 %shared_ptr(ModelAPI_FeatureValidator)
95 %shared_ptr(ModelAPI_Result)
96 %shared_ptr(ModelAPI_ResultConstruction)
97 %shared_ptr(ModelAPI_ResultBody)
98 %shared_ptr(ModelAPI_ResultPart)
99 %shared_ptr(ModelAPI_ResultGroup)
100 %shared_ptr(ModelAPI_ResultParameter)
101
102 // all supported interfaces
103 %include "ModelAPI_Entity.h"
104 %include "ModelAPI_Document.h"
105 %include "ModelAPI_Session.h"
106 %include "ModelAPI_Plugin.h"
107 %include "ModelAPI_Object.h"
108 %include "ModelAPI_Feature.h"
109 %include "ModelAPI_CompositeFeature.h"
110 %include "ModelAPI_Data.h"
111 %include "ModelAPI_Attribute.h"
112 %include "ModelAPI_AttributeDocRef.h"
113 %include "ModelAPI_AttributeDouble.h"
114 %include "ModelAPI_AttributeInteger.h"
115 %include "ModelAPI_AttributeString.h"
116 %include "ModelAPI_AttributeReference.h"
117 %include "ModelAPI_AttributeRefAttr.h"
118 %include "ModelAPI_AttributeBoolean.h"
119 %include "ModelAPI_AttributeSelection.h"
120 %include "ModelAPI_AttributeSelectionList.h"
121 %include "ModelAPI_AttributeRefList.h"
122 %include "ModelAPI_Validator.h"
123 %include "ModelAPI_AttributeValidator.h"
124 %include "ModelAPI_FeatureValidator.h"
125 %include "ModelAPI_Result.h"
126 %include "ModelAPI_ResultConstruction.h"
127 %include "ModelAPI_ResultBody.h"
128 %include "ModelAPI_ResultPart.h"
129 %include "ModelAPI_ResultGroup.h"
130 %include "ModelAPI_ResultParameter.h"
131 %include "ModelAPI_Tools.h"
132
133 // std::list -> [] 
134 %template(ObjectList) std::list<std::shared_ptr<ModelAPI_Object> >;
135 %template(ResultList) std::list<std::shared_ptr<ModelAPI_Result> >;
136 %template(DocumentList) std::list<std::shared_ptr<ModelAPI_Document> >;
137
138 // std::dynamic_pointer_cast
139 template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject);
140 %template(featureToCompositeFeature) shared_ptr_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
141 %template(objectToFeature) shared_ptr_cast<ModelAPI_Feature, ModelAPI_Object>;
142 %template(compositeFeatureToFeature) shared_ptr_cast<ModelAPI_Feature, ModelAPI_CompositeFeature>;
143
144 %template(modelAPI_Result) shared_ptr_cast<ModelAPI_Result, ModelAPI_Object>;
145 %template(modelAPI_ResultConstruction) shared_ptr_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
146 %template(modelAPI_ResultBody) shared_ptr_cast<ModelAPI_ResultBody, ModelAPI_Result>;
147 %template(modelAPI_ResultPart) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_Result>;
148 %template(modelAPI_ResultParameter) shared_ptr_cast<ModelAPI_ResultParameter, ModelAPI_Result>;
149 %template(modelAPI_ResultGroup) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_ResultGroup>;
150
151 // Attribute casts
152 %template(modelAPI_AttributeDocRef)        shared_ptr_cast<ModelAPI_AttributeDocRef, ModelAPI_Attribute>;
153 %template(modelAPI_AttributeDouble)        shared_ptr_cast<ModelAPI_AttributeDouble, ModelAPI_Attribute>;
154 %template(modelAPI_AttributeInteger)       shared_ptr_cast<ModelAPI_AttributeInteger, ModelAPI_Attribute>;
155 %template(modelAPI_AttributeString)        shared_ptr_cast<ModelAPI_AttributeString, ModelAPI_Attribute>;
156 %template(modelAPI_AttributeReference)     shared_ptr_cast<ModelAPI_AttributeReference, ModelAPI_Attribute>;
157 %template(modelAPI_AttributeRefAttr)       shared_ptr_cast<ModelAPI_AttributeRefAttr, ModelAPI_Attribute>;
158 %template(modelAPI_AttributeBoolean)       shared_ptr_cast<ModelAPI_AttributeBoolean, ModelAPI_Attribute>;
159 %template(modelAPI_AttributeSelection)     shared_ptr_cast<ModelAPI_AttributeSelection, ModelAPI_Attribute>;
160 %template(modelAPI_AttributeSelectionList) shared_ptr_cast<ModelAPI_AttributeSelectionList, ModelAPI_Attribute>;
161 %template(modelAPI_AttributeRefList)       shared_ptr_cast<ModelAPI_AttributeRefList, ModelAPI_Attribute>;