资源说明:Expose C/C++ structs to numpy
================== Nupy C/C++ Library ================== ----------------------------- Expose C/C++ structs to numpy ----------------------------- SYNOPSIS ======== #define nupyStruct(T) begin a declaration of struct ``T`` #define nupyEnd() end a declaration #define nupyBase(T) declare a base class ``T`` - C++ only #define nupyM(M) declare a member ``M`` #define nupyFAM(M) declare flexible array member ``M`` DESCRIPTION =========== Nupy is a simple set of C++ macros to generate a dtype string for a class or a struct. For example, C/C++ ``struct Line`` :: struct Line { double start[2]; double end [2]; char note [16]; }; can be "decorated" by ``nupyStruct(Line)`` and ``nupyEnd()`` macros and all members can be wrapped by ``nupyM(m)`` :: struct Line { nupyStruct(Line) double nupyM(start) [2]; double nupyM(end ) [2]; char nupyM(note ) [16]; nupyEnd() }; In plain C ``nupyStruct(T)`` and ``nupyEnd()`` evaluate to nothing and ``nupyM(M)`` evaluates to ``M`` producing a struct identical to the original. In C++, the second definition generates ``nupy_dtype`` static member function :: int Line::nupy_dtype(const char* str, size_t bufsz, size_t famsz = 0); If ``bufsz`` is big enough, the function copies ``Line``'s dtype to ``buf`` producing a string similar to :: "[('start','
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。