-
Notifications
You must be signed in to change notification settings - Fork 5
/
simple_alg_info.go
92 lines (78 loc) · 2.1 KB
/
simple_alg_info.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package foundation
// #include <virgil/crypto/foundation/vscf_foundation_public.h>
import "C"
import unsafe "unsafe"
import "runtime"
/*
* Handle simple algorithm information (just id).
*/
type SimpleAlgInfo struct {
cCtx *C.vscf_simple_alg_info_t /*ct10*/
}
/* Handle underlying C context. */
func (obj *SimpleAlgInfo) Ctx() uintptr {
return uintptr(unsafe.Pointer(obj.cCtx))
}
func NewSimpleAlgInfo() *SimpleAlgInfo {
ctx := C.vscf_simple_alg_info_new()
obj := &SimpleAlgInfo {
cCtx: ctx,
}
runtime.SetFinalizer(obj, (*SimpleAlgInfo).Delete)
return obj
}
/* Acquire C context.
* Note. This method is used in generated code only, and SHOULD NOT be used in another way.
*/
func newSimpleAlgInfoWithCtx(ctx *C.vscf_simple_alg_info_t /*ct10*/) *SimpleAlgInfo {
obj := &SimpleAlgInfo {
cCtx: ctx,
}
runtime.SetFinalizer(obj, (*SimpleAlgInfo).Delete)
return obj
}
/* Acquire retained C context.
* Note. This method is used in generated code only, and SHOULD NOT be used in another way.
*/
func newSimpleAlgInfoCopy(ctx *C.vscf_simple_alg_info_t /*ct10*/) *SimpleAlgInfo {
obj := &SimpleAlgInfo {
cCtx: C.vscf_simple_alg_info_shallow_copy(ctx),
}
runtime.SetFinalizer(obj, (*SimpleAlgInfo).Delete)
return obj
}
/*
* Release underlying C context.
*/
func (obj *SimpleAlgInfo) Delete() {
if obj == nil {
return
}
runtime.SetFinalizer(obj, nil)
obj.delete()
}
/*
* Release underlying C context.
*/
func (obj *SimpleAlgInfo) delete() {
C.vscf_simple_alg_info_delete(obj.cCtx)
}
/*
* Create algorithm info with identificator.
*/
func NewSimpleAlgInfoWithAlgId(algId AlgId) *SimpleAlgInfo {
proxyResult := /*pr4*/C.vscf_simple_alg_info_new_with_alg_id(C.vscf_alg_id_t(algId) /*pa7*/)
obj := &SimpleAlgInfo {
cCtx: proxyResult,
}
runtime.SetFinalizer(obj, (*SimpleAlgInfo).Delete)
return obj
}
/*
* Provide algorithm identificator.
*/
func (obj *SimpleAlgInfo) AlgId() AlgId {
proxyResult := /*pr4*/C.vscf_simple_alg_info_alg_id(obj.cCtx)
runtime.KeepAlive(obj)
return AlgId(proxyResult) /* r8 */
}