Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.StringAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 24, 2020
1 parent 2355e4b commit 4741786
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 1 deletion.
5 changes: 5 additions & 0 deletions include/fctypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ typedef Handle SecKeyMocks__Handle;
*/
typedef Handle SeedGeneratorMocks__Handle;

/**
* StringAddressMocks__Handle Handle, struct mocks.StringAddress
*/
typedef Handle StringAddressMocks__Handle;

// Callbacks

/**
Expand Down
75 changes: 75 additions & 0 deletions lib/cgo/coin.mocks.StringAddress.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
package main

import (
"reflect"
"unsafe"
)

/*
#include <string.h>
#include <stdlib.h>
#include "fctypes.h"
*/
import "C"

//export FC_mocks_StringAddress_GetCoinType
func FC_mocks_StringAddress_GetCoinType(__m *C.StringAddressMocks__Handle, _arg0 *C.GoSlice_) (____error_code uint32) {
_m, ok_m := lookupStringAddressMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetCoinType()
copyToGoSlice(reflect.ValueOf(__arg0), _arg0)
return
}

//export FC_mocks_StringAddress_GetValue
func FC_mocks_StringAddress_GetValue(__m *C.StringAddressMocks__Handle, _arg0 *C.GoSlice_) (____error_code uint32) {
_m, ok_m := lookupStringAddressMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetValue()
copyToGoSlice(reflect.ValueOf(__arg0), _arg0)
return
}

//export FC_mocks_StringAddress_IsValid
func FC_mocks_StringAddress_IsValid(__m *C.StringAddressMocks__Handle, _arg0 *bool) (____error_code uint32) {
_m, ok_m := lookupStringAddressMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.IsValid()
*_arg0 = __arg0
return
}

//export FC_mocks_StringAddress_SetCoinType
func FC_mocks_StringAddress_SetCoinType(__m *C.StringAddressMocks__Handle, _val []byte) (____error_code uint32) {
_m, ok_m := lookupStringAddressMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
val := *(*[]byte)(unsafe.Pointer(&_val))
_m.SetCoinType(val)
return
}

//export FC_mocks_StringAddress_SetValue
func FC_mocks_StringAddress_SetValue(__m *C.StringAddressMocks__Handle, _val []byte) (____error_code uint32) {
_m, ok_m := lookupStringAddressMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
val := *(*[]byte)(unsafe.Pointer(&_val))
_m.SetValue(val)
return
}
3 changes: 2 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,5 @@ CGOGEN HANDLES mocks__PexNodeIterator|PexNodeIteratorMocks
CGOGEN HANDLES mocks__PexNodeSet|PexNodeSetMocks
CGOGEN HANDLES mocks__PubKey|PubKeyMocks
CGOGEN HANDLES mocks__SecKey|SecKeyMocks
CGOGEN HANDLES mocks__SeedGenerator|SeedGeneratorMocks
CGOGEN HANDLES mocks__SeedGenerator|SeedGeneratorMocks
CGOGEN HANDLES mocks__StringAddress|StringAddressMocks
13 changes: 13 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,3 +835,16 @@ func lookupSeedGeneratorMocksHandle(handle C.SeedGeneratorMocks__Handle) (*mocks
func registerSeedGeneratorMocksHandle(obj *mocks.SeedGenerator) C.SeedGeneratorMocks__Handle {
return (C.SeedGeneratorMocks__Handle)(registerHandle(obj))
}
func lookupStringAddressMocksHandle(handle C.StringAddressMocks__Handle) (*mocks.StringAddress, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*mocks.StringAddress); isOK {
return obj, true
}
}
return nil, false
}

func registerStringAddressMocksHandle(obj *mocks.StringAddress) C.StringAddressMocks__Handle {
return (C.StringAddressMocks__Handle)(registerHandle(obj))
}

0 comments on commit 4741786

Please sign in to comment.