class documentation

class _ctypes: (source)

View In Hierarchy

Undocumented

Method __init__ Undocumented
Method data_as Return the data pointer cast to a particular c-types object. For example, calling self._as_parameter_ is equivalent to self.data_as(ctypes.c_void_p). Perhaps you want to use the data as a pointer to a ctypes array of floating-point data: ...
Method get_as_parameter Deprecated getter for the _ctypes._as_parameter_ property.
Method get_data Deprecated getter for the _ctypes.data property.
Method get_shape Deprecated getter for the _ctypes.shape property.
Method get_strides Deprecated getter for the _ctypes.strides property.
Method shape_as Return the shape tuple as an array of some other c-types type. For example: self.shape_as(ctypes.c_short).
Method strides_as Return the strides tuple as an array of some other c-types type. For example: self.strides_as(ctypes.c_longlong).
Property data A pointer to the memory area of the array as a Python integer. This memory area may contain data that is not aligned, or not in correct byte-order. The memory area may not even be writeable. The array flags and data-type of this array should be respected when passing this attribute to arbitrary C-code to avoid trouble that can include Python crashing...
Property shape A ctypes array of length self.ndim where the basetype is the C-integer corresponding to dtype('p') on this platform (see ~numpy.ctypeslib.c_intp). This base-type could be ctypes.c_int, ctypes.c_long, or ...
Property strides A ctypes array of length self.ndim where the basetype is the same as for the shape attribute. This ctypes array contains the strides information from the underlying array. This strides information is important for showing how many bytes must be jumped to get to the next element in the array.
Instance Variable _arr Undocumented
Instance Variable _ctypes Undocumented
Instance Variable _data Undocumented
Instance Variable _zerod Undocumented
Property _as_parameter_ Overrides the ctypes semi-magic method
def __init__(self, array, ptr=None): (source)

Undocumented

def data_as(self, obj): (source)

Return the data pointer cast to a particular c-types object. For example, calling self._as_parameter_ is equivalent to self.data_as(ctypes.c_void_p). Perhaps you want to use the data as a pointer to a ctypes array of floating-point data: self.data_as(ctypes.POINTER(ctypes.c_double)).

The returned pointer will keep a reference to the array.

def get_as_parameter(self): (source)

Deprecated getter for the _ctypes._as_parameter_ property.

Deprecated since version 1.21.
def get_data(self): (source)

Deprecated getter for the _ctypes.data property.

Deprecated since version 1.21.
def get_shape(self): (source)

Deprecated getter for the _ctypes.shape property.

Deprecated since version 1.21.
def get_strides(self): (source)

Deprecated getter for the _ctypes.strides property.

Deprecated since version 1.21.
def shape_as(self, obj): (source)

Return the shape tuple as an array of some other c-types type. For example: self.shape_as(ctypes.c_short).

def strides_as(self, obj): (source)

Return the strides tuple as an array of some other c-types type. For example: self.strides_as(ctypes.c_longlong).

A pointer to the memory area of the array as a Python integer. This memory area may contain data that is not aligned, or not in correct byte-order. The memory area may not even be writeable. The array flags and data-type of this array should be respected when passing this attribute to arbitrary C-code to avoid trouble that can include Python crashing. User Beware! The value of this attribute is exactly the same as self._array_interface_['data'][0].

Note that unlike data_as, a reference will not be kept to the array: code like ctypes.c_void_p((a + b).ctypes.data) will result in a pointer to a deallocated array, and should be spelt (a + b).ctypes.data_as(ctypes.c_void_p)

A ctypes array of length self.ndim where the basetype is the C-integer corresponding to dtype('p') on this platform (see ~numpy.ctypeslib.c_intp). This base-type could be ctypes.c_int, ctypes.c_long, or ctypes.c_longlong depending on the platform. The ctypes array contains the shape of the underlying array.

A ctypes array of length self.ndim where the basetype is the same as for the shape attribute. This ctypes array contains the strides information from the underlying array. This strides information is important for showing how many bytes must be jumped to get to the next element in the array.

Undocumented

Undocumented

Undocumented

Undocumented

@property
_as_parameter_ = (source)

Overrides the ctypes semi-magic method

Enables c_func(some_array.ctypes)