Salome HOME
Merge branch 'BR_internationalization'
[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_swig.h"
13 %}
14
15 // import other modules
16 %import "GeomAPI.i"
17
18 // to avoid error on this
19 #define MODELAPI_EXPORT
20
21 // standard definitions
22 %include "typemaps.i"
23 %include "std_string.i"
24 %include "std_list.i"
25 %include "std_shared_ptr.i"
26 %include "std_set.i"
27
28 // directors
29 %feature("director") ModelAPI_Plugin;
30 %feature("director") ModelAPI_Object;
31 %feature("director") ModelAPI_Feature;
32 %feature("director") ModelAPI_CompositeFeature;
33 %feature("director") ModelAPI_Data;
34
35 // shared pointers
36 // For ModelAPI_ResultConstruction.shape()
37 %shared_ptr(ModelAPI_Entity)
38 %shared_ptr(ModelAPI_Document)
39 %shared_ptr(ModelAPI_Session)
40 %shared_ptr(ModelAPI_Plugin)
41 %shared_ptr(ModelAPI_Object)
42 %shared_ptr(ModelAPI_Feature)
43 %shared_ptr(ModelAPI_CompositeFeature)
44 %shared_ptr(ModelAPI_Data)
45 %shared_ptr(ModelAPI_Attribute)
46 %shared_ptr(ModelAPI_AttributeDocRef)
47 %shared_ptr(ModelAPI_AttributeDouble)
48 %shared_ptr(ModelAPI_AttributeInteger)
49 %shared_ptr(ModelAPI_AttributeIntArray)
50 %shared_ptr(ModelAPI_AttributeString)
51 %shared_ptr(ModelAPI_AttributeReference)
52 %shared_ptr(ModelAPI_AttributeRefAttr)
53 %shared_ptr(ModelAPI_AttributeRefList)
54 %shared_ptr(ModelAPI_AttributeRefAttrList)
55 %shared_ptr(ModelAPI_AttributeBoolean)
56 %shared_ptr(ModelAPI_AttributeSelection)
57 %shared_ptr(ModelAPI_AttributeSelectionList)
58 %shared_ptr(ModelAPI_Validator)
59 %shared_ptr(ModelAPI_AttributeValidator)
60 %shared_ptr(ModelAPI_FeatureValidator)
61 %shared_ptr(ModelAPI_Result)
62 %shared_ptr(ModelAPI_ResultConstruction)
63 %shared_ptr(ModelAPI_ResultBody)
64 %shared_ptr(ModelAPI_ResultPart)
65 %shared_ptr(ModelAPI_ResultGroup)
66 %shared_ptr(ModelAPI_ResultParameter)
67 %shared_ptr(ModelAPI_ResultCompSolid)
68
69 // all supported interfaces
70 %include "ModelAPI_Entity.h"
71 %include "ModelAPI_Document.h"
72 %include "ModelAPI_Session.h"
73 %include "ModelAPI_Plugin.h"
74 %include "ModelAPI_Object.h"
75 %include "ModelAPI_Feature.h"
76 %include "ModelAPI_CompositeFeature.h"
77 %include "ModelAPI_Data.h"
78 %include "ModelAPI_Attribute.h"
79 %include "ModelAPI_AttributeDocRef.h"
80 %include "ModelAPI_AttributeDouble.h"
81 %include "ModelAPI_AttributeInteger.h"
82 %include "ModelAPI_AttributeIntArray.h"
83 %include "ModelAPI_AttributeString.h"
84 %include "ModelAPI_AttributeReference.h"
85 %include "ModelAPI_AttributeRefAttr.h"
86 %include "ModelAPI_AttributeBoolean.h"
87 %include "ModelAPI_AttributeSelection.h"
88 %include "ModelAPI_AttributeSelectionList.h"
89 %include "ModelAPI_AttributeRefList.h"
90 %include "ModelAPI_AttributeRefAttrList.h"
91 %include "ModelAPI_Validator.h"
92 %include "ModelAPI_AttributeValidator.h"
93 %include "ModelAPI_FeatureValidator.h"
94 %include "ModelAPI_Result.h"
95 %include "ModelAPI_ResultConstruction.h"
96 %include "ModelAPI_ResultBody.h"
97 %include "ModelAPI_ResultPart.h"
98 %include "ModelAPI_ResultGroup.h"
99 %include "ModelAPI_ResultParameter.h"
100 %include "ModelAPI_Tools.h"
101 %include "ModelAPI_ResultCompSolid.h"
102
103 // std::list -> [] 
104 %template(StringList) std::list<std::string>;
105 %template(ObjectList) std::list<std::shared_ptr<ModelAPI_Object> >;
106 %template(ResultList) std::list<std::shared_ptr<ModelAPI_Result> >;
107 %template(DocumentList) std::list<std::shared_ptr<ModelAPI_Document> >;
108 // std::set -> []
109 %template(AttributeSet) std::set<std::shared_ptr<ModelAPI_Attribute> >;
110
111 // std::dynamic_pointer_cast
112 template<class T1, class T2> std::shared_ptr<T1> shared_ptr_cast(std::shared_ptr<T2> theObject);
113 %template(featureToCompositeFeature) shared_ptr_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
114 %template(objectToFeature) shared_ptr_cast<ModelAPI_Feature, ModelAPI_Object>;
115 %template(objectToResult) shared_ptr_cast<ModelAPI_Result, ModelAPI_Object>;
116 %template(compositeFeatureToFeature) shared_ptr_cast<ModelAPI_Feature, ModelAPI_CompositeFeature>;
117
118 %template(modelAPI_Result) shared_ptr_cast<ModelAPI_Result, ModelAPI_Object>;
119 %template(modelAPI_ResultConstruction) shared_ptr_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
120 %template(modelAPI_ResultBody) shared_ptr_cast<ModelAPI_ResultBody, ModelAPI_Result>;
121 %template(modelAPI_ResultPart) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_Result>;
122 %template(modelAPI_ResultParameter) shared_ptr_cast<ModelAPI_ResultParameter, ModelAPI_Result>;
123 %template(modelAPI_ResultGroup) shared_ptr_cast<ModelAPI_ResultPart, ModelAPI_ResultGroup>;
124 %template(modelAPI_ResultCompSolid) shared_ptr_cast<ModelAPI_ResultCompSolid, ModelAPI_ResultBody>;
125
126 // Attribute casts
127 %template(modelAPI_AttributeDocRef)        shared_ptr_cast<ModelAPI_AttributeDocRef, ModelAPI_Attribute>;
128 %template(modelAPI_AttributeDouble)        shared_ptr_cast<ModelAPI_AttributeDouble, ModelAPI_Attribute>;
129 %template(modelAPI_AttributeInteger)       shared_ptr_cast<ModelAPI_AttributeInteger, ModelAPI_Attribute>;
130 %template(modelAPI_AttributeIntArray)      shared_ptr_cast<ModelAPI_AttributeIntArray, ModelAPI_Attribute>;
131 %template(modelAPI_AttributeString)        shared_ptr_cast<ModelAPI_AttributeString, ModelAPI_Attribute>;
132 %template(modelAPI_AttributeReference)     shared_ptr_cast<ModelAPI_AttributeReference, ModelAPI_Attribute>;
133 %template(modelAPI_AttributeRefAttr)       shared_ptr_cast<ModelAPI_AttributeRefAttr, ModelAPI_Attribute>;
134 %template(modelAPI_AttributeBoolean)       shared_ptr_cast<ModelAPI_AttributeBoolean, ModelAPI_Attribute>;
135 %template(modelAPI_AttributeSelection)     shared_ptr_cast<ModelAPI_AttributeSelection, ModelAPI_Attribute>;
136 %template(modelAPI_AttributeSelectionList) shared_ptr_cast<ModelAPI_AttributeSelectionList, ModelAPI_Attribute>;
137 %template(modelAPI_AttributeRefList)       shared_ptr_cast<ModelAPI_AttributeRefList, ModelAPI_Attribute>;
138 %template(modelAPI_AttributeRefAttrList)   shared_ptr_cast<ModelAPI_AttributeRefAttrList, ModelAPI_Attribute>;