OpenGL.converters | index /var/pylive/src/OpenGL-dev/OpenGL-ctypes/OpenGL/converters.py

`Implementations for common converter types`

Modules
`` |  |
ctypes |  |  |

Classes
`` |  | object Converter CConverter DefaultCConverter Output SizedOutput StringLengths getPyArgsName PyConverter CallFuncPyConverter ReturnValues returnCArgument returnPyArgument
class CConverter(Converter)
`` | `Converter sub-class for use in Wrapper.cConverters This class just defines the interface for a cConverter-style Converter object`
| Method resolution order: CConverter Converter object Methods defined here: __call__(self, pyArgs, index, baseOperation) `Calculate C-compatible Python object from Python arguments pyArgs -- set of Python argument objects converted by pyConverters from the incoming arguments index -- our index in baseOperation.cConverters baseOperation -- the Wrapper object which we are supporting` Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from Converter: argNames = () indexLookups = ()
class CallFuncPyConverter(PyConverter)
`` | `PyConverter that takes a callable and calls it on incoming`
| Method resolution order: CallFuncPyConverter PyConverter Converter object Methods defined here: __call__(self, incoming, function, argument) `Call our function on incoming` __init__(self, function) `Store the function` Methods inherited from Converter: finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from Converter: argNames = () indexLookups = ()
class Converter(object)
`` | `Base class for Converter types Converter objects are callable objects used with the OpenGL.wrapper.Wrapper class to simplify the wrapping of functions by collecting commonly used functionality into a reusable function. Each Converter has two (class) attributes: argNames -- list of argument names for initialisation indexLookups -- set of (indexname, argName,methodName) values to lookup on wrapper. These allow us to use argument-name references to refer to which arguments to use when processing (prevents the need to revise pointers when we change the API for a function). Converters can be any of the Wrapper API helper functions, so the callable interface can vary among Converter classes.`
| Methods defined here: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes defined here: argNames = () indexLookups = ()
class DefaultCConverter(CConverter)
`` | `NULL or Default CConverter, returns same-named Python argument Used primarily to allow for specifying a converter that explicitly says "use the default behaviour". This is *not* a finalise-ing converter, it is passed in the index explicitly and just retrieves that index from pyArgs when called. Raises informative errors if the index cannot be resolved in pyArgs`
| Method resolution order: DefaultCConverter CConverter Converter object Methods defined here: __call__(self, pyArgs, index, wrapper) `Return pyArgs[self.index] or raise a ValueError` __init__(self, index) `Just store index for future access` Methods inherited from Converter: finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from Converter: argNames = () indexLookups = ()
class Output(CConverter)
`` | `CConverter generating static-size typed output arrays Produces an output array of given type (arrayType) and size using lookup() to determine the size of the array to be produced, where the lookup function is passed as an initialisation argument. Provides also: oldStyleReturn( ... ) for use in the default case of PyOpenGL compatability mode, where result arrays of size (1,) are returned as scalar values.`
| Method resolution order: Output CConverter Converter object Methods defined here: __call__(self, pyArgs, index, baseOperation) `Return pyArgs[ self.index ]` getSize(self, pyArgs) `Retrieve the array size for this argument` oldStyleReturn(self, result, baseOperation, pyArgs, cArgs) `Retrieve cArgs[ self.index ]` Data descriptors defined here: arrayType index size Data and other attributes defined here: argNames = ('name', 'size', 'arrayType') indexLookups = [('outIndex', 'name', 'cArgIndex')] Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class PyConverter(Converter)
`` | `Converter sub-class for use in Wrapper.pyConverters This class just defines the interface for a pyConverter-style Converter object`
| Method resolution order: PyConverter Converter object Methods defined here: __call__(self, incoming, function, arguments) `Convert incoming argument into compatable data-types incoming -- the Python argument for this parameter function -- the wrapper.Wrapper class we are supporting arguments -- the complete set of arguments passed to the function` Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from Converter: argNames = () indexLookups = ()
class ReturnValues(Converter)
`` | `Converter sub-class for use as Wrapper.returnValues This class just defines the interface for a returnValues-style Converter object`
| Method resolution order: ReturnValues Converter object Methods defined here: __call__(self, result, baseOperation, pyArgs, cArgs) `Return a final value to the caller result -- the raw ctypes result value baseOperation -- the Wrapper object which we are supporting pyArgs -- the set of Python arguments produced by pyConverters cArgs -- the set of C-compatible arguments produced by CConverter return the Python object for the final result` Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)` Data and other attributes inherited from Converter: argNames = () indexLookups = ()
class SizedOutput(Output)
`` | `Output generating dynamically-sized typed output arrays Takes an extra parameter "specifier", which is the name of a Python argument to be passed to the lookup function in order to determine the appropriate size for the output array.`
| Method resolution order: SizedOutput Output CConverter Converter object Methods defined here: getSize(self, pyArgs) `Retrieve the array size for this argument` Data descriptors defined here: arrayType index lookup specifier Data and other attributes defined here: argNames = ('name', 'specifier', 'lookup', 'arrayType') indexLookups = [('outIndex', 'name', 'cArgIndex'), ('index', 'specifier', 'pyArgIndex')] Methods inherited from Output: __call__(self, pyArgs, index, baseOperation) `Return pyArgs[ self.index ]` oldStyleReturn(self, result, baseOperation, pyArgs, cArgs) `Retrieve cArgs[ self.index ]` Data descriptors inherited from Output: size Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class StringLengths(CConverter)
`` | `CConverter for processing array-of-pointers-to-strings data-type Converter is a CConverter for the array-of-lengths for a array-of-pointers-to-strings data-type used to pass a set of code fragments to the GLSL compiler. Provides also: stringArray -- PyConverter callable ensuring list-of-strings format for the python argument stringArrayForC -- CResolver converting the array to POINTER(c_char_p) format for passing to C totalCount -- CConverter callable giving count of string pointers (that is, length of the pointer array)`
| Method resolution order: StringLengths CConverter Converter object Methods defined here: __call__(self, pyArgs, index, baseOperation) `Get array of length integers for string contents` stringArray(self, arg, baseOperation, args) `Create basic array-of-strings object from pyArg` stringArrayForC(self, strings) `Create a ctypes pointer to char-pointer set` totalCount(self, pyArgs, index, baseOperation) `Get array of length integers for string contents` Data and other attributes defined here: argNames = ('name',) indexLookups = [('index', 'name', 'pyArgIndex')] Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class getPyArgsName(CConverter)
`` | `CConverter returning named Python argument Intended for use in cConverters, the function returned retrieves the named pyArg and returns it when called.`
| Method resolution order: getPyArgsName CConverter Converter object Methods defined here: __call__(self, pyArgs, index, baseOperation) `Return pyArgs[ self.index ]` Data descriptors defined here: index name Data and other attributes defined here: argNames = ('name',) indexLookups = [('index', 'name', 'pyArgIndex')] Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class returnCArgument(ReturnValues)
`` | `ReturnValues returning the named cArgs value`
| Method resolution order: returnCArgument ReturnValues Converter object Methods defined here: __call__(self, result, baseOperation, pyArgs, cArgs) `Retrieve cArgs[ self.index ]` Data descriptors defined here: index name Data and other attributes defined here: argNames = ('name',) indexLookups = [('index', 'name', 'cArgIndex')] Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class returnPyArgument(ReturnValues)
`` | `ReturnValues returning the named pyArgs value`
| Method resolution order: returnPyArgument ReturnValues Converter object Methods defined here: __call__(self, result, baseOperation, pyArgs, cArgs) `Retrieve pyArgs[ self.index ]` Data descriptors defined here: index name Data and other attributes defined here: argNames = ('name',) indexLookups = [('index', 'name', 'pyArgIndex')] Methods inherited from Converter: __init__(self, *args, **named) `Store arguments in attributes *args -- mapped to self.argNames in order to set attributes **named -- mapped to self.argNames by name to set attributes` finalise(self, wrapper) `Look up our indices (where appropriate)` Data descriptors inherited from Converter: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`