Directory: | ./ |
---|---|
File: | src/wrapper_convertType.cpp |
Date: | 2025-04-25 19:10:50 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 11 | 12 | 91.7% |
Branches: | 21 | 28 | 75.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | /*************************************** | ||
2 | Auteur : Pierre Aubert | ||
3 | Mail : pierre.aubert@lapp.in2p3.fr | ||
4 | Licence : CeCILL-C | ||
5 | ****************************************/ | ||
6 | |||
7 | |||
8 | #include "wrapper_convertType.h" | ||
9 | |||
10 | ///Gets the python API str type of the correcponding numpy C/C++ type | ||
11 | /** @param typeStr : C/C++ type | ||
12 | * @return python str type of the correcponding C/C++ type | ||
13 | * See documentation : https://docs.python.org/3/c-api/structures.html | ||
14 | */ | ||
15 | 12 | PString getPythonStrForPythonApiType(const PString & typeStr){ | |
16 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
12 | if(typeStr == "char") return "Py_T_CHAR"; |
17 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
12 | else if(typeStr == "bool") return "Py_T_BOOL"; |
18 |
1/2✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
|
12 | else if(typeStr == "short") return "Py_T_SHORT"; |
19 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 11 times.
|
12 | else if(typeStr == "unsigned short") return "Py_T_USHORT"; |
20 |
2/2✓ Branch 1 taken 6 times.
✓ Branch 2 taken 5 times.
|
11 | else if(typeStr == "int") return "Py_T_INT"; |
21 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 4 times.
|
5 | else if(typeStr == "unsigned int") return "Py_T_UINT"; |
22 |
3/6✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
|
4 | else if(typeStr == "ssize_t" || typeStr == "long int") return "Py_T_LONG"; |
23 |
6/6✓ Branch 1 taken 3 times.
✓ Branch 2 taken 1 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 2 times.
|
4 | else if(typeStr == "size_t" || typeStr == "long unsigned int") return "Py_T_ULONG"; |
24 |
2/2✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
|
2 | else if(typeStr == "float") return "Py_T_FLOAT"; |
25 |
1/2✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
|
1 | else if(typeStr == "double") return "Py_T_DOUBLE"; |
26 | ✗ | else return ""; | |
27 | } | ||
28 | |||
29 | |||
30 | |||
31 |