Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.WalletOutput
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 26, 2020
1 parent 4e5979a commit e58ea19
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/fctypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,12 @@ typedef Handle WalletEnvMocks__Handle;
*/
typedef Handle WalletIteratorMocks__Handle;

/**
*WalletOutputMocks__Handle Handle, struct
* mocks.WalletOutput
*/
typedef Handle WalletOutputMocks__Handle;

// Callbacks

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

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

//export FC_mocks_WalletOutput_GetOutput
func FC_mocks_WalletOutput_GetOutput(__m *C.WalletOutputMocks__Handle, _arg0 *C.TransactionOutput__Handle) (____error_code uint32) {
_m, ok_m := lookupWalletOutputMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetOutput()
*_arg0 = registerTransactionOutputHandle(&__arg0)
return
}

//export FC_mocks_WalletOutput_GetWallet
func FC_mocks_WalletOutput_GetWallet(__m *C.WalletOutputMocks__Handle, _arg0 *C.Wallet__Handle) (____error_code uint32) {
_m, ok_m := lookupWalletOutputMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetWallet()
*_arg0 = registerWalletHandle(&__arg0)
return
}
3 changes: 2 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,5 @@ CGOGEN HANDLES mocks__TxnSignerIterator|TxnSignerIteratorMocks
CGOGEN HANDLES mocks__Wallet|WalletMocks
CGOGEN HANDLES mocks__WalletAddress|WalletAddressMocks
CGOGEN HANDLES mocks__WalletEnv|WalletEnvMocks
CGOGEN HANDLES mocks__WalletIterator|WalletIteratorMocks
CGOGEN HANDLES mocks__WalletIterator|WalletIteratorMocks
CGOGEN HANDLES mocks__WalletOutput|WalletOutputMocks
14 changes: 14 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -1040,3 +1040,17 @@ func lookupWalletIteratorMocksHandle(handle C.WalletIteratorMocks__Handle) (*moc
func registerWalletIteratorMocksHandle(obj *mocks.WalletIterator) C.WalletIteratorMocks__Handle {
return (C.WalletIteratorMocks__Handle)(registerHandle(obj))
}

func lookupWalletOutputMocksHandle(handle C.WalletOutputMocks__Handle) (*mocks.WalletOutput, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*mocks.WalletOutput); isOK {
return obj, true
}
}
return nil, false
}

func registerWalletOutputMocksHandle(obj *mocks.WalletOutput) C.WalletOutputMocks__Handle {
return (C.WalletOutputMocks__Handle)(registerHandle(obj))
}

0 comments on commit e58ea19

Please sign in to comment.