gopyh

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 16, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package gopyh provides the variable gopyvar manager for gopy. The gopyvars map can NOT be globally shared in C because it must use interface{} values that can change location via GC. In effect, each gopy package must be thought of as a completely separate Go instance, and there can be NO sharing of anything between them, because they fundamentally live in different .so libraries. Thus, we must ensure that all gopyvars used within a package are registered within that same package -- this means python users typically will import a single package, which exports all the relevant functionality as needed. Any further packages cannot share anything other than basic types (int, string etc).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecRef

func DecRef(gopyvar CGoGopyvar)

DecRef decrements the reference count for the specified gopyvar and removes it if the reference count goes to zero.

func Embed

func Embed(stru interface{}, embed reflect.Type) interface{}

Embed returns the embedded struct (in first field only) of given type within given struct

func IfaceIsNil

func IfaceIsNil(it interface{}) bool

IfaceIsNil returns true if interface or value represented by interface is nil

func IncRef

func IncRef(gopyvar CGoGopyvar)

IncRef increments the reference count for the specified gopyvar.

func NonPtrValue

func NonPtrValue(v reflect.Value) reflect.Value

NonPtrValue returns the non-pointer underlying value

func NumGopyvars

func NumGopyvars() int

NumGopyvars returns the number of gopyvars in use.

func PtrValue

func PtrValue(v reflect.Value) reflect.Value

PtrValue returns the pointer version (Addr()) of the underlying value if the value is not already a Ptr

func VarFromGopyvar

func VarFromGopyvar(h CGoGopyvar, typnm string) interface{}

VarFromGopyvar gets variable from gopyvar string. Reports error to python but does not return it, for use in inline calls

func VarFromGopyvarTry

func VarFromGopyvarTry(h CGoGopyvar, typnm string) (interface{}, error)

VarFromGopyvarTry version returns the error explicitly, for use when error can be processed

Types

type CGoGopyvar

type CGoGopyvar int64

func Register

func Register(typnm string, ifc interface{}) CGoGopyvar

Register registers a new variable instance.

type GoGopyvar

type GoGopyvar int64

GoGopyvar is the type for the gopyvar

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL