Salome HOME
Merge branch 'master' into BR_PYTHON_PLUGIN
[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 "GeomAPI_Interface.h"
13   #include "GeomAPI_Shape.h"
14   #include "ModelAPI.h"
15   #include "ModelAPI_Document.h"
16   #include "ModelAPI_Session.h"
17   #include "ModelAPI_Object.h"
18   #include "ModelAPI_Feature.h"
19   #include "ModelAPI_Plugin.h"
20   #include "ModelAPI_CompositeFeature.h"
21   #include "ModelAPI_Data.h"
22   #include "ModelAPI_Attribute.h"
23   #include "ModelAPI_AttributeDocRef.h"
24   #include "ModelAPI_AttributeDouble.h"
25   #include "ModelAPI_AttributeInteger.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_Validator.h"
32   #include "ModelAPI_AttributeRefList.h"
33   #include "ModelAPI_AttributeBoolean.h"
34   #include "ModelAPI_Result.h"
35   #include "ModelAPI_ResultConstruction.h"
36   #include "ModelAPI_ResultBody.h"
37   #include "ModelAPI_ResultPart.h"
38   
39   template<class T1, class T2> 
40   boost::shared_ptr<T1> boost_cast(boost::shared_ptr<T2> theObject)
41   { 
42     return boost::dynamic_pointer_cast<T1>(theObject); 
43   }
44   
45 %}
46
47 // to avoid error on this
48 #define MODELAPI_EXPORT
49 #define GEOMAPI_EXPORT
50
51 // standard definitions
52 %include "typemaps.i"
53 %include "std_string.i"
54 %include "std_list.i"
55
56 // directors
57 %feature("director") ModelAPI_Plugin;
58 %feature("director") ModelAPI_Object;
59 %feature("director") ModelAPI_Feature;
60
61 // boost pointers
62 %include "boost_shared_ptr.i"
63 // For ModelAPI_ResultConstruction.shape()
64 %shared_ptr(GeomAPI_Interface)
65 %shared_ptr(GeomAPI_Shape)
66 %shared_ptr(ModelAPI_Document)
67 %shared_ptr(ModelAPI_Session)
68 %shared_ptr(ModelAPI_Plugin)
69 %shared_ptr(ModelAPI_Object)
70 %shared_ptr(ModelAPI_Feature)
71 %shared_ptr(ModelAPI_CompositeFeature)
72 %shared_ptr(ModelAPI_Data)
73 %shared_ptr(ModelAPI_Attribute)
74 %shared_ptr(ModelAPI_AttributeDocRef)
75 %shared_ptr(ModelAPI_AttributeDouble)
76 %shared_ptr(ModelAPI_AttributeInteger)
77 %shared_ptr(ModelAPI_AttributeString)
78 %shared_ptr(ModelAPI_AttributeReference)
79 %shared_ptr(ModelAPI_AttributeRefAttr)
80 %shared_ptr(ModelAPI_AttributeRefList)
81 %shared_ptr(ModelAPI_AttributeBoolean)
82 %shared_ptr(ModelAPI_AttributeSelection)
83 %shared_ptr(ModelAPI_AttributeSelectionList)
84 %shared_ptr(ModelAPI_Result)
85 %shared_ptr(ModelAPI_ResultConstruction)
86 %shared_ptr(ModelAPI_ResultBody)
87 %shared_ptr(ModelAPI_ResultPart)
88
89 // all supported interfaces
90 %include "GeomAPI_Interface.h"
91 %include "GeomAPI_Shape.h"
92 %include "ModelAPI_Document.h"
93 %include "ModelAPI_Session.h"
94 %include "ModelAPI_Plugin.h"
95 %include "ModelAPI_Object.h"
96 %include "ModelAPI_Feature.h"
97 %include "ModelAPI_CompositeFeature.h"
98 %include "ModelAPI_Data.h"
99 %include "ModelAPI_Attribute.h"
100 %include "ModelAPI_AttributeDocRef.h"
101 %include "ModelAPI_AttributeDouble.h"
102 %include "ModelAPI_AttributeInteger.h"
103 %include "ModelAPI_AttributeString.h"
104 %include "ModelAPI_AttributeReference.h"
105 %include "ModelAPI_AttributeRefAttr.h"
106 %include "ModelAPI_AttributeBoolean.h"
107 %include "ModelAPI_AttributeSelection.h"
108 %include "ModelAPI_AttributeSelectionList.h"
109 %include "ModelAPI_AttributeRefList.h"
110 %include "ModelAPI_Validator.h"
111 %include "ModelAPI_Result.h"
112 %include "ModelAPI_ResultConstruction.h"
113 %include "ModelAPI_ResultBody.h"
114 %include "ModelAPI_ResultPart.h"
115
116 %template(ObjectList) std::list<boost::shared_ptr<ModelAPI_Object> >;
117 %template(ResultList) std::list<boost::shared_ptr<ModelAPI_Result> >;
118
119 template<class T1, class T2> boost::shared_ptr<T1> boost_cast(boost::shared_ptr<T2> theObject);
120
121 // Feature casts
122 %template(modelAPI_Feature)          boost_cast<ModelAPI_Feature, ModelAPI_Object>;
123 %template(modelAPI_CompositeFeature) boost_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
124
125 // Result casts
126 %template(modelAPI_ResultConstruction) boost_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
127 %template(modelAPI_ResultBody)         boost_cast<ModelAPI_ResultBody, ModelAPI_Result>;
128 %template(modelAPI_ResultPart)         boost_cast<ModelAPI_ResultPart, ModelAPI_Result>;
129
130 // Attribute casts
131 %template(modelAPI_AttributeDocRef)        boost_cast<ModelAPI_AttributeDocRef, ModelAPI_Attribute>;
132 %template(modelAPI_AttributeDouble)        boost_cast<ModelAPI_AttributeDouble, ModelAPI_Attribute>;
133 %template(modelAPI_AttributeInteger)       boost_cast<ModelAPI_AttributeInteger, ModelAPI_Attribute>;
134 %template(modelAPI_AttributeString)        boost_cast<ModelAPI_AttributeString, ModelAPI_Attribute>;
135 %template(modelAPI_AttributeReference)     boost_cast<ModelAPI_AttributeReference, ModelAPI_Attribute>;
136 %template(modelAPI_AttributeRefAttr)       boost_cast<ModelAPI_AttributeRefAttr, ModelAPI_Attribute>;
137 %template(modelAPI_AttributeBoolean)       boost_cast<ModelAPI_AttributeBoolean, ModelAPI_Attribute>;
138 %template(modelAPI_AttributeSelection)     boost_cast<ModelAPI_AttributeSelection, ModelAPI_Attribute>;
139 %template(modelAPI_AttributeSelectionList) boost_cast<ModelAPI_AttributeSelectionList, ModelAPI_Attribute>;
140 %template(modelAPI_AttributeRefList)       boost_cast<ModelAPI_AttributeRefList, ModelAPI_Attribute>;