Skip to content

Commit

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

/**
* TransactionInputIteratorMocks__Handle Handle, struct
* mocks.TransactionInputIterator
*/
typedef Handle TransactionInputIteratorMocks__Handle;

/**
* TransactionInput__Handle Handle, struct core.TransactionInput
*/
typedef Handle TransactionInput__Handle;

// Callbacks

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

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

//export FC_mocks_TransactionInputIterator_HasNext
func FC_mocks_TransactionInputIterator_HasNext(__m *C.TransactionInputIteratorMocks__Handle, _arg0 *bool) (____error_code uint32) {
_m, ok_m := lookupTransactionInputIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.HasNext()
*_arg0 = __arg0
return
}

//export FC_mocks_TransactionInputIterator_Next
func FC_mocks_TransactionInputIterator_Next(__m *C.TransactionInputIteratorMocks__Handle, _arg0 *bool) (____error_code uint32) {
_m, ok_m := lookupTransactionInputIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Next()
*_arg0 = __arg0
return
}

//export FC_mocks_TransactionInputIterator_Value
func FC_mocks_TransactionInputIterator_Value(__m *C.TransactionInputIteratorMocks__Handle, _arg0 *C.TransactionInput__Handle) (____error_code uint32) {
_m, ok_m := lookupTransactionInputIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Value()
*_arg0 = registerTransactionInputHandle(&__arg0)
return
}
4 changes: 3 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,6 @@ CGOGEN HANDLES mocks__SecKey|SecKeyMocks
CGOGEN HANDLES mocks__SeedGenerator|SeedGeneratorMocks
CGOGEN HANDLES mocks__StringAddress|StringAddressMocks
CGOGEN HANDLES mocks__Transaction|TransactionMocks
CGOGEN HANDLES mocks__TransactionInput|TransactionInputMocks
CGOGEN HANDLES mocks__TransactionInput|TransactionInputMocks
CGOGEN HANDLES mocks__TransactionInputIterator|TransactionInputIteratorMocks
CGOGEN HANDLES core__TransactionInput|TransactionInput
27 changes: 27 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -874,3 +874,30 @@ func lookupTransactionInputMocksHandle(handle C.TransactionInputMocks__Handle) (
func registerTransactionInputMocksHandle(obj *mocks.TransactionInput) C.TransactionInputMocks__Handle {
return (C.TransactionInputMocks__Handle)(registerHandle(obj))
}

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

func registerTransactionInputIteratorMocksHandle(obj *mocks.TransactionInputIterator) C.TransactionInputIteratorMocks__Handle {
return (C.TransactionInputIteratorMocks__Handle)(registerHandle(obj))
}
func lookupTransactionInputHandle(handle C.TransactionInput__Handle) (*core.TransactionInput, bool) {
obj, ok := lookupHandle(C.Handle(handle))
if ok {
if obj, isOK := (obj).(*core.TransactionInput); isOK {
return obj, true
}
}
return nil, false
}

func registerTransactionInputHandle(obj *core.TransactionInput) C.TransactionInput__Handle {
return (C.TransactionInput__Handle)(registerHandle(obj))
}

0 comments on commit 675efc8

Please sign in to comment.