Salome HOME
2665eb1accdf1c54557e0e1f0e133563a7e03333
[modules/kernel.git] / src / SALOMESDS / SALOMEWrappedStdType.py
1 # -*- coding: utf-8 -*-
2 # Copyright (C) 2007-2021  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License, or (at your option) any later version.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20 # Author : Anthony Geay (EDF R&D)
21
22
23 import abc
24
25 def _raiseNow(strCont):
26     raise Exception("The method %s has been called whereas it is an interface !"%strCont)
27
28 class WrappedType(object, metaclass=abc.ABCMeta):
29     """ Here definition of an interface in python."""
30     @abc.abstractmethod
31     def ptr(self):
32         _raiseNow("ptr")
33     @abc.abstractmethod
34     def local_copy(self):
35         _raiseNow("local_copy")
36     @abc.abstractmethod
37     def assign(self,elt):
38         _raiseNow("assign")
39
40 class List(WrappedType):
41     @abc.abstractmethod
42     def __getitem__(self,*args):
43         _raiseNow("__getitem__")
44     @abc.abstractmethod
45     def __setitem__(self,*args):
46         _raiseNow("__setitem__")
47     @abc.abstractmethod
48     def __delitem__(self,*args):
49         _raiseNow("__delitem__")
50     @abc.abstractmethod
51     def append(self,*args):
52         _raiseNow("append")
53     @abc.abstractmethod
54     def extend(self,*args):
55         _raiseNow("extend")
56     @abc.abstractmethod
57     def insert(self,*args):
58         _raiseNow("insert")
59     @abc.abstractmethod
60     def pop(self,*args):
61         _raiseNow("pop")
62     @abc.abstractmethod
63     def remove(self,*args):
64         _raiseNow("remove")
65     @abc.abstractmethod
66     def reverse(self,*args):
67         _raiseNow("reverse")
68     @abc.abstractmethod
69     def sort(self,*args):
70         _raiseNow("sort")
71     # work on local copy
72     @abc.abstractmethod
73     def count(self,*args):
74         _raiseNow("count")
75     @abc.abstractmethod
76     def index(self,*args):
77         _raiseNow("index")
78     @abc.abstractmethod
79     def __len__(self):
80         _raiseNow("__len__")
81     pass
82
83 class Dict(WrappedType):
84     @abc.abstractmethod
85     def __getitem__(self,*args):
86         _raiseNow("__getitem__")
87     @abc.abstractmethod
88     def __setitem__(self,*args):
89         _raiseNow("__setitem__")
90     @abc.abstractmethod
91     def __delitem__(self,*args):
92         _raiseNow("__delitem__")
93     @abc.abstractmethod
94     def clear(self,*args):
95         _raiseNow("clear")
96     @abc.abstractmethod
97     def get(self,*args):
98         _raiseNow("get")
99     @abc.abstractmethod
100     def items(self,*args):
101         _raiseNow("items")
102     @abc.abstractmethod
103     def pop(self,*args):
104         _raiseNow("pop")
105     @abc.abstractmethod
106     def popitem(self,*args):
107         _raiseNow("popitem")
108     @abc.abstractmethod
109     def setdefault(self,*args):
110         _raiseNow("setdefault")
111     @abc.abstractmethod
112     def update(self,*args):
113         _raiseNow("update")
114     @abc.abstractmethod
115     def values(self,*args):
116         _raiseNow("values")
117     # work on local copy
118     @abc.abstractmethod
119     def __contains__(self,*args):
120         _raiseNow("__contains__")
121     @abc.abstractmethod
122     def has_key(self,*args):
123         _raiseNow("has_key")
124     @abc.abstractmethod
125     def keys(self,*args):
126         _raiseNow("keys")
127     @abc.abstractmethod
128     def copy(self,*args):
129         _raiseNow("copy")
130     @abc.abstractmethod
131     def __len__(self):
132         _raiseNow("__len__")
133     pass
134
135 class Tuple(WrappedType):
136     @abc.abstractmethod
137     def __getitem__(self,*args):
138         _raiseNow("__getitem__")
139     # work on local copy
140     @abc.abstractmethod
141     def count(self,*args):
142         _raiseNow("count")
143     @abc.abstractmethod
144     def index(self,*args):
145         _raiseNow("index")
146     @abc.abstractmethod
147     def __len__(self):
148         _raiseNow("__len__")
149     pass
150
151 class Float(WrappedType):
152     @abc.abstractmethod
153     def __iadd__(self,*args):
154         _raiseNow("__iadd__")
155     @abc.abstractmethod
156     def __isub__(self,*args):
157         _raiseNow("__isub__")
158     @abc.abstractmethod
159     def __imul__(self,*args):
160         _raiseNow("__imul__")
161     @abc.abstractmethod
162     def __idiv__(self,*args):
163         _raiseNow("__idiv__")
164     @abc.abstractmethod
165     def __add__(self,*args):
166         _raiseNow("__add__")
167     @abc.abstractmethod
168     def __sub__(self,*args):
169         _raiseNow("__sub__")
170     @abc.abstractmethod
171     def __mul__(self,*args):
172         _raiseNow("__mul__")
173     @abc.abstractmethod
174     def __div__(self,*args):
175         _raiseNow("__div__")
176     @abc.abstractmethod
177     def __pow__(self,*args):
178         _raiseNow("__pow__")
179     @abc.abstractmethod
180     def as_integer_ratio(self,*args):
181         _raiseNow("as_integer_ratio")
182     @abc.abstractmethod
183     def conjugate(self,*args):
184         _raiseNow("conjugate")
185     @abc.abstractmethod
186     def fromhex(self,*args):
187         _raiseNow("fromhex")
188     @abc.abstractmethod
189     def hex(self,*args):
190         _raiseNow("hex")
191     @abc.abstractmethod
192     def imag(self,*args):
193         _raiseNow("imag")
194     @abc.abstractmethod
195     def is_integer(self,*args):
196         _raiseNow("is_integer")
197     @abc.abstractmethod
198     def real(self,*args):
199         _raiseNow("real")
200     pass
201
202 class Int(WrappedType):
203     @abc.abstractmethod
204     def __iadd__(self,*args):
205         _raiseNow("__iadd__")
206     @abc.abstractmethod
207     def __isub__(self,*args):
208         _raiseNow("__isub__")
209     @abc.abstractmethod
210     def __imul__(self,*args):
211         _raiseNow("__imul__")
212     @abc.abstractmethod
213     def __imod__(self,*args):
214         _raiseNow("__imod__")
215     @abc.abstractmethod
216     def __idiv__(self,*args):
217         _raiseNow("__idiv__")
218     @abc.abstractmethod
219     def __add__(self,*args):
220         _raiseNow("__add__")
221     @abc.abstractmethod
222     def __sub__(self,*args):
223         _raiseNow("__sub__")
224     @abc.abstractmethod
225     def __mul__(self,*args):
226         _raiseNow("__mul__")
227     @abc.abstractmethod
228     def __mod__(self,*args):
229         _raiseNow("__mod__")
230     @abc.abstractmethod
231     def __div__(self,*args):
232         _raiseNow("__div__")
233     @abc.abstractmethod
234     def __pow__(self,*args):
235         _raiseNow("__pow__")
236     @abc.abstractmethod
237     def bit_length(self,*args):
238         _raiseNow("bit_length")
239     @abc.abstractmethod
240     def conjugate(self,*args):
241         _raiseNow("conjugate")
242     @abc.abstractmethod
243     def denominator(self,*args):
244         _raiseNow("denominator")
245     @abc.abstractmethod
246     def imag(self,*args):
247         _raiseNow("imag")
248     @abc.abstractmethod
249     def numerator(self,*args):
250         _raiseNow("numerator")
251     @abc.abstractmethod
252     def real(self,*args):
253         _raiseNow("real")
254     pass
255
256 class String(WrappedType):
257     @abc.abstractmethod
258     def __add__(self,*args):
259         _raiseNow("__add__")
260     @abc.abstractmethod
261     def __iadd__(self,*args):
262         _raiseNow("__iadd__")
263     @abc.abstractmethod
264     def __getitem__(self,*args):
265         _raiseNow("__getitem__")
266     @abc.abstractmethod
267     def capitalize(self,*args):
268         _raiseNow("capitalize")
269     @abc.abstractmethod
270     def center(self,*args):
271         _raiseNow("center")
272     @abc.abstractmethod
273     def count(self,*args):
274         _raiseNow("count")
275     @abc.abstractmethod
276     def decode(self,*args):
277         _raiseNow("decode")
278     @abc.abstractmethod
279     def encode(self,*args):
280         _raiseNow("encode")
281     @abc.abstractmethod
282     def endswith(self,*args):
283         _raiseNow("endswith")
284     @abc.abstractmethod
285     def expandtabs(self,*args):
286         _raiseNow("expandtabs")
287     @abc.abstractmethod
288     def find(self,*args):
289         _raiseNow("find")
290     @abc.abstractmethod
291     def format(self,*args):
292         _raiseNow("format")
293     @abc.abstractmethod
294     def index(self,*args):
295         _raiseNow("index")
296     @abc.abstractmethod
297     def isalnum(self,*args):
298         _raiseNow("isalnum")
299     @abc.abstractmethod
300     def isalpha(self,*args):
301         _raiseNow("isalpha")
302     @abc.abstractmethod
303     def isdigit(self,*args):
304         _raiseNow("isdigit")
305     @abc.abstractmethod
306     def islower(self,*args):
307         _raiseNow("islower")
308     @abc.abstractmethod
309     def isspace(self,*args):
310         _raiseNow("isspace")
311     @abc.abstractmethod
312     def istitle(self,*args):
313         _raiseNow("istitle")
314     @abc.abstractmethod
315     def isupper(self,*args):
316         _raiseNow("isupper")
317     @abc.abstractmethod
318     def join(self,*args):
319         _raiseNow("join")
320     @abc.abstractmethod
321     def ljust(self,*args):
322         _raiseNow("ljust")
323     @abc.abstractmethod
324     def lower(self,*args):
325         _raiseNow("lower")
326     @abc.abstractmethod
327     def lstrip(self,*args):
328         _raiseNow("lstrip")
329     @abc.abstractmethod
330     def partition(self,*args):
331         _raiseNow("partition")
332     @abc.abstractmethod
333     def replace(self,*args):
334         _raiseNow("replace")
335     @abc.abstractmethod
336     def rfind(self,*args):
337         _raiseNow("rfind")
338     @abc.abstractmethod
339     def rindex(self,*args):
340         _raiseNow("rindex")
341     @abc.abstractmethod
342     def rjust(self,*args):
343         _raiseNow("rjust")
344     @abc.abstractmethod
345     def rpartition(self,*args):
346         _raiseNow("rpartition")
347     @abc.abstractmethod
348     def rsplit(self,*args):
349         _raiseNow("rsplit")
350     @abc.abstractmethod
351     def rstrip(self,*args):
352         _raiseNow("rstrip")
353     @abc.abstractmethod
354     def split(self,*args):
355         _raiseNow("split")
356     @abc.abstractmethod
357     def splitlines(self,*args):
358         _raiseNow("splitlines")
359     @abc.abstractmethod
360     def startswith(self,*args):
361         _raiseNow("startswith")
362     @abc.abstractmethod
363     def strip(self,*args):
364         _raiseNow("strip")
365     @abc.abstractmethod
366     def swapcase(self,*args):
367         _raiseNow("swapcase")
368     @abc.abstractmethod
369     def title(self,*args):
370         _raiseNow("title")
371     @abc.abstractmethod
372     def translate(self,*args):
373         _raiseNow("translate")
374     @abc.abstractmethod
375     def upper(self,*args):
376         _raiseNow("upper")
377     @abc.abstractmethod
378     def zfill(self,*args):
379         _raiseNow("zfill")
380     @abc.abstractmethod
381     def __len__(self):
382         _raiseNow("__len__")
383     pass