Add support for int64 and uint64 as it was done in Schweizer-Messer

See https://github.com/ethz-asl/Schweizer-Messer
release/4.3a0
Ellon Mendes 2015-12-03 13:04:47 +01:00
parent 46178731c6
commit 2754613072
1 changed files with 25 additions and 0 deletions

View File

@ -28,6 +28,31 @@ template<> struct TypeToNumPy<int>
}
};
template<> struct TypeToNumPy<boost::int64_t>
{
enum { NpyType = NPY_LONG };
static const char * npyString() { return "NPY_LONG"; }
static const char * typeString() { return "long"; }
static bool canConvert(int type)
{
return type == NPY_INT || type == NPY_LONG;
}
};
template<> struct TypeToNumPy<boost::uint64_t>
{
enum { NpyType = NPY_UINT64 };
static const char * npyString() { return "NPY_UINT64"; }
static const char * typeString() { return "uint64"; }
static bool canConvert(int type)
{
return type == NPY_UINT8 || type == NPY_USHORT ||
type == NPY_UINT16 || type == NPY_UINT32 ||
type == NPY_ULONG || type == NPY_ULONGLONG ||
type == NPY_UINT64;
}
};
template<> struct TypeToNumPy<unsigned char>
{
enum { NpyType = NPY_UBYTE };