Memory

Objects of this class are used internally to store native data.  Use Sequence or MultiArray instead.

Inherits

See also

Summary
MemoryObjects of this class are used internally to store native data.
Functions
Memory.allocAllocate ‘size’ bytes of memory.
Memory.importImport data from Ruby string.
Memory.newInitialize with existing memory pointer.
windowReturns a new Memory object which ignores part of the data.
loadLoad data and convert to Ruby object.
storeConvert Ruby object to native datatype and store the data.
importImport Ruby string into Malloc object.
exportExport data to Ruby string.

Functions

Memory.alloc

def Memory.alloc(size)

Allocate ‘size’ bytes of memory.

Parameters

sizeNumber of bytes to allocate.

See also

Memory.import

def Memory.import(str)

Import data from Ruby string.

Parameters

strRuby string.

Memory.new

def Memory.new(ptr,  
offset =  0)

Initialize with existing memory pointer.  It is possible to specify an offset to ignore part of the data (i.e. increase the memory pointer).

Parameters

ptrA Malloc object.
offsetNumber of bytes to ignore (optional)

See also

window

def window(offset)

Returns a new Memory object which ignores part of the data.

Parameters

offsetAmount of data to ignore.

load

def load(typecode)

Load data and convert to Ruby object.

Parameters

typecodeNative data type.

store

def store(typecode,
value)

Convert Ruby object to native datatype and store the data.

Parameters

typecodeNative data type.
valueRuby object.

import

def import(data)

Import Ruby string into Malloc object.

Parameters

dataRuby string.

export

def export(size)

Export data to Ruby string.

Parameters

sizeNumber of bytes to export.
def Memory.alloc(size)
Allocate ‘size’ bytes of memory.
def Memory.import(str)
Import data from Ruby string.
def Memory.new(ptr,  
offset =  0)
Initialize with existing memory pointer.
def window(offset)
Returns a new Memory object which ignores part of the data.
def load(typecode)
Load data and convert to Ruby object.
def store(typecode,
value)
Convert Ruby object to native datatype and store the data.
def import(data)
Import Ruby string into Malloc object.
def export(size)
Export data to Ruby string.
def Sequence(element_type,  
num_elements,  
stride =  element_type.size)
Create an array class.
def MultiArray(element_type,
*shape)
Create a multi-dimensional array class.
Abstract class for internal use.
Objects of this class are used internally to store Ruby objects.
Objects of this class are used internally to store native data.
Class to allocate raw memory.
Close