Skip to content

Commit

Permalink
[cgo] refs fibercrypto#5 Added coin.mocks.TransactionOutputIterator
Browse files Browse the repository at this point in the history
  • Loading branch information
Maykel Arias Torres committed Mar 24, 2020
1 parent 78ccfa0 commit a6b1428
Show file tree
Hide file tree
Showing 4 changed files with 68 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 @@ -493,6 +493,12 @@ typedef Handle TransactionIteratorMocks__Handle;
*/
typedef Handle TransactionOutputMocks__Handle;

/**
* TransactionOutputIteratorMocks__Handle Handle, struct
* mocks.TransactionOutputIterator
*/
typedef Handle TransactionOutputIteratorMocks__Handle;

// Callbacks

/**
Expand Down
46 changes: 46 additions & 0 deletions lib/cgo/coin.mocks.TransactionOutputIterator.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_TransactionOutputIterator_HasNext
func FC_mocks_TransactionOutputIterator_HasNext(__m *C.TransactionOutputIteratorMocks__Handle, _arg0 *bool) (____error_code uint32) {
_m, ok_m := lookupTransactionOutputIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.HasNext()
*_arg0 = __arg0
return
}

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

//export FC_mocks_TransactionOutputIterator_Value
func FC_mocks_TransactionOutputIterator_Value(__m *C.TransactionOutputIteratorMocks__Handle, _arg0 *C.TransactionOutput__Handle) (____error_code uint32) {
_m, ok_m := lookupTransactionOutputIteratorMocksHandle(*__m)
if !ok_m {
____error_code = FC_BAD_HANDLE
return
}
__arg0 := _m.Value()
*_arg0 = registerTransactionOutputHandle(&__arg0)
return
}
3 changes: 2 additions & 1 deletion lib/cgo/handles
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,5 @@ CGOGEN HANDLES mocks__TransactionInput|TransactionInputMocks
CGOGEN HANDLES mocks__TransactionInputIterator|TransactionInputIteratorMocks
CGOGEN HANDLES core__TransactionInput|TransactionInput
CGOGEN HANDLES mocks__TransactionIterator|TransactionIteratorMocks
CGOGEN HANDLES mocks__TransactionOutput|TransactionOutputMocks
CGOGEN HANDLES mocks__TransactionOutput|TransactionOutputMocks
CGOGEN HANDLES mocks__TransactionOutputIterator|TransactionOutputIteratorMocks
14 changes: 14 additions & 0 deletions lib/cgo/libfc_handle.go
Original file line number Diff line number Diff line change
Expand Up @@ -928,3 +928,17 @@ func lookupTransactionOutputMocksHandle(handle C.TransactionOutputMocks__Handle)
func registerTransactionOutputMocksHandle(obj *mocks.TransactionOutput) C.TransactionOutputMocks__Handle {
return (C.TransactionOutputMocks__Handle)(registerHandle(obj))
}

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

func registerTransactionOutputIteratorMocksHandle(obj *mocks.TransactionOutputIterator) C.TransactionOutputIteratorMocks__Handle {
return (C.TransactionOutputIteratorMocks__Handle)(registerHandle(obj))
}

0 comments on commit a6b1428

Please sign in to comment.