blob: 03cf01525c8e3984efd6a9d250635e4499417255 [file] [log] [blame]
Kshitij Sisodiaf9efe0d2022-09-30 16:42:50 +01001//
2// SPDX-FileCopyrightText: Copyright 2021-2022 Arm Limited and/or its affiliates <open-source-office@arm.com>
3// SPDX-License-Identifier: Apache-2.0
4//
5%include "stl.i"
6%include "cstring.i"
7%include "std_string.i"
8%include "std_vector.i"
9%include "std_unordered_set.i"
10%include "std_pair.i"
11%include "stdint.i"
12%include "carrays.i"
13%include "exception.i"
14%include "typemaps.i"
15%include "std_iostream.i"
16%include "std_shared_ptr.i"
17
18%ignore *::operator=;
19%ignore *::operator[];
20
21
22// Define exception typemap to wrap exception into python exception.
23
24%exception{
25 try {
26 $action
27 } catch (const EthosU::Exception& e) {
28 SWIG_exception(SWIG_RuntimeError, const_cast<char*>(e.what()));
29 }
30};
31
32%exception __getitem__ {
33 try {
34 $action
35 } catch (const std::out_of_range &e) {
36 SWIG_exception(SWIG_IndexError, const_cast<char*>(e.what()));
37 } catch (const std::exception &e) {
38 SWIG_exception(SWIG_RuntimeError, const_cast<char*>(e.what()));
39 }
40};
41
42%exception __setitem__ {
43 try {
44 $action
45 } catch (const std::out_of_range &e) {
46 SWIG_exception(SWIG_IndexError, const_cast<char*>(e.what()));
47 } catch (const std::exception &e) {
48 SWIG_exception(SWIG_RuntimeError, const_cast<char*>(e.what()));
49 }
50};