PrimitiveType
Defines a general purpose ArgumentType so that we can easily manage complicated type specs
The basic idea is to define a hierarchy of types that can then convert themselves down to
a ctypes
-style spec as well as a C++ argument spec so that we can enable SharedLibraryFunction
to use either the basic ctypes
FFI or a more efficient, but fragile system based off of extension modules
typeset: dict
__init__(self, name, ctypes_spec, cpp_spec, capi_spec, python_types, numpy_dtypes, serializer, deserializer):
name
:str
argument name (e.g. ‘double’)
ctypes_spec
:Any
the ctypes data-type that arguments of this type would be converted to
cpp_spec
:str
the C++ spec for this type (as a string)
capi_spec
:str
the python C-API string for use in
Py_BuildValue
python_types
:Iterable[type]
the python types that this argument maps onto
numpy_dtypes
:Iterable[np.dtype]
the numpy dtypes that this argument maps onto
serializer
:Callable
a serializer for converting this object into a byte-stream
deserializer
:Callable
a deserializer for converting the byte-stream into a C-level object
@property
name(self):
@property
ctypes_type(self):
@property
cpp_type(self):
@property
types(self):
@property
dtypes(self):
@property
typechar(self):
isinstance(self, arg):
cast(self, arg):
c_cast(self, arg):
__repr__(self):