| |
- FormatHandler(object)
-
- ListHandler
class ListHandler(FormatHandler) |
|
Storage of array data in Python lists/arrays
This mechanism, unlike multi-dimensional arrays, is not necessarily
uniform in type or dimension, so we have to do a lot of extra checks
to make sure that we get a correctly-structured array. That, as
well as the need to copy the arrays in Python code, makes this a far
less efficient implementation than the numpy implementation, which
does all the same things, but does them all in C code.
Note: as an *output* format, this format handler produces ctypes
arrays, not Python lists, this is done for convenience in coding
the implementation, mostly. |
|
- Method resolution order:
- ListHandler
- FormatHandler
- object
Methods defined here:
- arraySize(self, value, typeCode=None)
- Given a data-value, calculate dimensions for the array
- arrayToGLType(self, value)
- Given a value, guess OpenGL type of the corresponding pointer
- asArray(self, value, typeCode=None)
- Convert given value to a ctypes array value of given typeCode
This does a *lot* of work just to get the data into the correct
format. It's not going to be anywhere near as fast as a numpy
or similar approach!
- dimensions(self, value, typeCode=None)
- Determine dimensions of the passed array value (if possible)
- dims(self, value)
- Produce iterable of all dimensions
- types(self, value)
- Produce iterable producing all composite types
- unitSize(self, value, typeCode=None)
- Determine unit size of an array (if possible)
- voidDataPointer(cls, value)
- Given value in a known data-pointer type, return void_p for pointer
- zeros(self, dims, typeCode)
- Return array of zeros in given size
Class methods defined here:
- dimsOf(cls, x) from type
- Calculate total dimension-set of the elements in x
This is *extremely* messy, as it has to track nested arrays
where the arrays could be different sizes on all sorts of
levels...
Static methods defined here:
- dataPointer = addressof(...)
- addressof(C instance) -> integer
Return the address of the C instance internal buffer
- from_param = byref(...)
- byref(C instance) -> byref-object
Return a pointer lookalike to a C instance, only usable
as function argument
Data and other attributes defined here:
- HANDLED_TYPES = (<type 'list'>, <type 'tuple'>)
Methods inherited from FormatHandler:
- register(self, types=None)
- Register this class as handler for given set of types
- registerEquivalent(self, typ, base)
- Register a sub-class for handling as the base-type
- registerReturn(self)
- Register this handler as the default return-type handler
Class methods inherited from FormatHandler:
- chooseOutput(cls, preferred=None) from type
- Choose our output-capable plugin
- loadAll(cls) from type
- Load all setuptools-registered FormatHandler classes
register a new datatype with code similar to this in your
package's setup.py for setuptools:
entry_points = {
'OpenGL.arrays.formathandler':[
'numpy = OpenGL.arrays.numpymodule.NumpyHandler',
],
}
Data descriptors inherited from FormatHandler:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from FormatHandler:
- ALL_OUTPUT_HANDLERS = []
- GENERIC_OUTPUT_PREFERENCES = ['numpy', 'numeric', 'ctypesarrays']
- HANDLER_REGISTRY = {}
- TYPE_REGISTRY = {}
- baseType = None
- preferredOutput = None
- typeConstant = None
| |