SMIL  1.0.4
DNumpy.h
1 /*
2  * Copyright (c) 2011-2016, Matthieu FAESSEL and ARMINES
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are met:
7  *
8  * * Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * * Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  * * Neither the name of Matthieu FAESSEL, or ARMINES nor the
14  * names of its contributors may be used to endorse or promote products
15  * derived from this software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND ANY
18  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
21  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 
30 #ifndef _D_NUMPY_H
31 #define _D_NUMPY_H
32 
33 #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
34 
35 #include "numpy/arrayobject.h"
36 
37 namespace smil {
38 
39 template <class T> class Image;
40 
41 template <class T> int getNumpyType(Image<T> &/*im*/) { return NPY_VOID; } // Default
42 
43 template <> int getNumpyType(Image<UINT8> &/*im*/) { return NPY_UBYTE; }
44 template <> int getNumpyType(Image<INT8> &/*im*/) { return NPY_BYTE; }
45 template <> int getNumpyType(Image<UINT16> &/*im*/) { return NPY_USHORT; }
46 template <> int getNumpyType(Image<INT16> &/*im*/) { return NPY_SHORT; }
47 template <> int getNumpyType(Image<UINT32> &/*im*/) { return NPY_UINT; }
48 template <> int getNumpyType(Image<INT32> &/*im*/) { return NPY_INT; }
49 template <> int getNumpyType(Image<unsigned long> &/*im*/) { return NPY_ULONG; }
50 template <> int getNumpyType(Image<long> &/*im*/) { return NPY_LONG; }
51 template <> int getNumpyType(Image<float> &/*im*/) { return NPY_FLOAT; }
52 template <> int getNumpyType(Image<double> &/*im*/) { return NPY_DOUBLE; }
53 
54 
55 // NPY_BOOL=0,
56 // NPY_BYTE, NPY_UBYTE,
57 // NPY_SHORT, NPY_USHORT,
58 // NPY_INT, NPY_UINT,
59 // NPY_LONG, NPY_ULONG,
60 // NPY_LONGLONG, NPY_ULONGLONG,
61 // NPY_FLOAT, NPY_DOUBLE, NPY_LONGDOUBLE,
62 // NPY_CFLOAT, NPY_CDOUBLE, NPY_CLONGDOUBLE,
63 // NPY_OBJECT=17,
64 // NPY_STRING, NPY_UNICODE,
65 // NPY_VOID,
66 // /*
67 
68 }
69 
70 #endif // _D_NUMPY_H