示例#1
0
            return self.arrayType.asArray( arg )
    class AsArrayTypedSize( converters.CConverter ):
        """Given arrayName and arrayType, determine size of arrayName
        """
        argNames = ( 'arrayName','arrayType' )
        indexLookups = ( 
            ('arrayIndex', 'arrayName','pyArgIndex'),
        )
        def __init__( self, arrayName='pointer', arrayType=None ):
            self.arrayName = arrayName
            self.arrayType = arrayType
        def __call__( self, pyArgs, index, wrappedOperation ):
            """Get the arg as an array of the appropriate type"""
            return self.arrayType.arraySize( pyArgs[self.arrayIndex ] )
else:
    returnPointer = returnPyArgumentIndex( 0 )



if not _configflags.ERROR_ON_COPY:
    def asArrayType( typ, size=None ):
        """Create PyConverter to get first argument as array of type"""
        return converters.CallFuncPyConverter( typ.asArray )
else:
    def asArrayType( typ, size=None ):
        """No converter required"""
        return None

if not _configflags.ARRAY_SIZE_CHECKING:
    asArrayTypeSize = asArrayType
else:
    class AsArrayTypedSize(converters.CConverter):
        """Given arrayName and arrayType, determine size of arrayName
        """
        argNames = ('arrayName', 'arrayType')
        indexLookups = (('arrayIndex', 'arrayName', 'pyArgIndex'), )

        def __init__(self, arrayName='pointer', arrayType=None):
            self.arrayName = arrayName
            self.arrayType = arrayType

        def __call__(self, pyArgs, index, wrappedOperation):
            """Get the arg as an array of the appropriate type"""
            return self.arrayType.arraySize(pyArgs[self.arrayIndex])
else:
    returnPointer = returnPyArgumentIndex(0)

if not _configflags.ERROR_ON_COPY:

    def asArrayType(typ, size=None):
        """Create PyConverter to get first argument as array of type"""
        return converters.CallFuncPyConverter(typ.asArray)
else:

    def asArrayType(typ, size=None):
        """No converter required"""
        return None


if not _configflags.ARRAY_SIZE_CHECKING:
    asArrayTypeSize = asArrayType