callback

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2022 License: BSL-1.0 Imports: 0 Imported by: 0

README

callback

Go Reference Go Report Card

About

callback is a package for Go to map objects to ids. This allows to manage callbacks from C to Go. It is published on https://github.com/vbsw/golib/callback and https://gitlab.com/vbsw/golib/callback.

Copyright 2022, Vitali Baumtrok (vbsw@mailbox.org).

callback is distributed under the Boost Software License, version 1.0. (See accompanying file LICENSE or copy at http://www.boost.org/LICENSE_1_0.txt)

callback is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Boost Software License for more details.

References

Documentation

Overview

Package callback maps objects to ids. This allows to manage callbacks from C to Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback struct {
	// contains filtered or unexported fields
}

Callback holds objects identified by ids.

func New

func New() *Callback

New returns an instance of Callback.

func (*Callback) Obj

func (cb *Callback) Obj(id int) interface{}

Obj returns object identified by id.

func (*Callback) Register

func (cb *Callback) Register(obj interface{}) int

Register returns a new id number for obj. obj will not be garbage collected until Unregister is called with this id.

func (*Callback) Unregister

func (cb *Callback) Unregister(id int) interface{}

Unregister makes the object no more identified by id. This object may be garbage collected, now.

Jump to

Keyboard shortcuts

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