Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.TxnSignerIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 24, 2020
1 parent 6648fce commit fde68d9
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
7 changes: 6 additions & 1 deletion include/fctypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,14 @@ typedef Handle TransactionOutputIteratorMocks__Handle;

/**
* TxnSignerMocks__Handle Handle, struct
* mocks.TxnSignerIterator
* mocks.TxnSigner
*/
typedef Handle TxnSignerMocks__Handle;
/**
* TxnSignerIteratorMocks__Handle Handle, struct
* mocks.TxnSignerIterator
*/
typedef Handle TxnSignerIteratorMocks__Handle;

// Callbacks

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

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

//export FC_mocks_TxnSignerIterator_Count
func FC_mocks_TxnSignerIterator_Count(__m *C.TxnSignerIteratorMocks__Handle, _arg0 *int) (____error_code uint32) {
_m, ok_m := lookupTxnSignerIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Count()
*_arg0 = __arg0
return
}

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

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

//export FC_mocks_TxnSignerIterator_Value
func FC_mocks_TxnSignerIterator_Value(__m *C.TxnSignerIteratorMocks__Handle, _arg0 *C.TxnSigner__Handle) (____error_code uint32) {
_m, ok_m := lookupTxnSignerIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Value()
*_arg0 = registerTxnSignerHandle(&__arg0)
return
}
3 changes: 2 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,5 @@ CGOGEN HANDLES core__TransactionInput|TransactionInput
CGOGEN HANDLES mocks__TransactionIterator|TransactionIteratorMocks
CGOGEN HANDLES mocks__TransactionOutput|TransactionOutputMocks
CGOGEN HANDLES mocks__TransactionOutputIterator|TransactionOutputIteratorMocks
CGOGEN HANDLES mocks__TxnSigner|TxnSignerMocks
CGOGEN HANDLES mocks__TxnSigner|TxnSignerMocks
CGOGEN HANDLES mocks__TxnSignerIterator|TxnSignerIteratorMocks
14 changes: 14 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -956,3 +956,17 @@ func lookupTxnSignerMocksHandle(handle C.TxnSignerMocks__Handle) (*mocks.TxnSign
func registerTxnSignerMocksHandle(obj *mocks.TxnSigner) C.TxnSignerMocks__Handle {
return (C.TxnSignerMocks__Handle)(registerHandle(obj))
}

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

func registerTxnSignerIteratorMocksHandle(obj *mocks.TxnSignerIterator) C.TxnSignerIteratorMocks__Handle {
return (C.TxnSignerIteratorMocks__Handle)(registerHandle(obj))
}

0 comments on commit fde68d9

Please sign in to comment.