Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.TransactionInput
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 24, 2020
1 parent 8a62c14 commit 8d54c2f
Show file tree
Hide file tree
Showing 4 changed files with 84 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 @@ -465,6 +465,11 @@ typedef Handle StringAddressMocks__Handle;
*/
typedef Handle TransactionMocks__Handle;

/**
* TransactionInputMocks__Handle Handle, struct mocks.TransactionInput
*/
typedef Handle TransactionInputMocks__Handle;

// Callbacks

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

import "reflect"

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

//export FC_mocks_TransactionInput_GetCoins
func FC_mocks_TransactionInput_GetCoins(__m *C.TransactionInputMocks__Handle, _ticker string, _arg1 *uint64) (____error_code uint32) {
_m, ok_m := lookupTransactionInputMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
ticker := _ticker
__arg1, ____return_err := _m.GetCoins(ticker)
____error_code = libErrorCode(____return_err)
if ____return_err == nil {
*_arg1 = __arg1
}
return
}

//export FC_mocks_TransactionInput_GetId
func FC_mocks_TransactionInput_GetId(__m *C.TransactionInputMocks__Handle, _arg0 *C.GoString_) (____error_code uint32) {
_m, ok_m := lookupTransactionInputMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetId()
copyString(__arg0, _arg0)
return
}

//export FC_mocks_TransactionInput_GetSpentOutput
func FC_mocks_TransactionInput_GetSpentOutput(__m *C.TransactionInputMocks__Handle, _arg0 *C.TransactionOutput__Handle) (____error_code uint32) {
_m, ok_m := lookupTransactionInputMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.GetSpentOutput()
*_arg0 = registerTransactionOutputHandle(&__arg0)
return
}

//export FC_mocks_TransactionInput_SupportedAssets
func FC_mocks_TransactionInput_SupportedAssets(__m *C.TransactionInputMocks__Handle, _arg0 *C.GoSlice_) (____error_code uint32) {
_m, ok_m := lookupTransactionInputMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.SupportedAssets()
copyToGoSlice(reflect.ValueOf(__arg0), _arg0)
return
}
3 changes: 2 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,5 @@ CGOGEN HANDLES mocks__PubKey|PubKeyMocks
CGOGEN HANDLES mocks__SecKey|SecKeyMocks
CGOGEN HANDLES mocks__SeedGenerator|SeedGeneratorMocks
CGOGEN HANDLES mocks__StringAddress|StringAddressMocks
CGOGEN HANDLES mocks__Transaction|TransactionMocks
CGOGEN HANDLES mocks__Transaction|TransactionMocks
CGOGEN HANDLES mocks__TransactionInput|TransactionInputMocks
13 changes: 13 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -861,3 +861,16 @@ func lookupTransactionMocksHandle(handle C.TransactionMocks__Handle) (*mocks.Tra
func registerTransactionMocksHandle(obj *mocks.Transaction) C.TransactionMocks__Handle {
return (C.TransactionMocks__Handle)(registerHandle(obj))
}
func lookupTransactionInputMocksHandle(handle C.TransactionInputMocks__Handle) (*mocks.TransactionInput, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*mocks.TransactionInput); isOK {
return obj, true
}
}
return nil, false
}

func registerTransactionInputMocksHandle(obj *mocks.TransactionInput) C.TransactionInputMocks__Handle {
return (C.TransactionInputMocks__Handle)(registerHandle(obj))
}

0 comments on commit 8d54c2f

Please sign in to comment.