From a6b1428c636fd8ef334b27112e2c69f650e28163 Mon Sep 17 00:00:00 2001 From: Maykel Arias Torres Date: Tue, 24 Mar 2020 15:03:31 -0400 Subject: [PATCH] [cgo] refs #5 Added `coin.mocks.TransactionOutputIterator` --- include/fctypes.h | 6 +++ .../coin.mocks.TransactionOutputIterator.go | 46 +++++++++++++++++++ lib/cgo/handles | 3 +- lib/cgo/libfc_handle.go | 14 ++++++ 4 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 lib/cgo/coin.mocks.TransactionOutputIterator.go diff --git a/include/fctypes.h b/include/fctypes.h index 666fe8f..5b1fe29 100644 --- a/include/fctypes.h +++ b/include/fctypes.h @@ -493,6 +493,12 @@ typedef Handle TransactionIteratorMocks__Handle; */ typedef Handle TransactionOutputMocks__Handle; +/** + * TransactionOutputIteratorMocks__Handle Handle, struct + * mocks.TransactionOutputIterator + */ +typedef Handle TransactionOutputIteratorMocks__Handle; + // Callbacks /** diff --git a/lib/cgo/coin.mocks.TransactionOutputIterator.go b/lib/cgo/coin.mocks.TransactionOutputIterator.go new file mode 100644 index 0000000..9162e7d --- /dev/null +++ b/lib/cgo/coin.mocks.TransactionOutputIterator.go @@ -0,0 +1,46 @@ +package main + +/* + + #include + #include + + #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 +} diff --git a/lib/cgo/handles b/lib/cgo/handles index a0c3604..a56c687 100644 --- a/lib/cgo/handles +++ b/lib/cgo/handles @@ -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 \ No newline at end of file +CGOGEN HANDLES mocks__TransactionOutput|TransactionOutputMocks +CGOGEN HANDLES mocks__TransactionOutputIterator|TransactionOutputIteratorMocks \ No newline at end of file diff --git a/lib/cgo/libfc_handle.go b/lib/cgo/libfc_handle.go index 47631a0..00ad4de 100644 --- a/lib/cgo/libfc_handle.go +++ b/lib/cgo/libfc_handle.go @@ -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)) +}