github.com/kaydxh/golang@v0.0.131/pkg/gocv/cgo/swig/pycv/pycv.go (about)

     1  /* ----------------------------------------------------------------------------
     2   * This file was automatically generated by SWIG (https://www.swig.org).
     3   * Version 4.1.1
     4   *
     5   * Do not make changes to this file unless you know what you are doing - modify
     6   * the SWIG interface file instead.
     7   * ----------------------------------------------------------------------------- */
     8  
     9  // source: pycv.swigcxx
    10  
    11  package pycv
    12  
    13  /*
    14  #define intgo swig_intgo
    15  typedef void *swig_voidp;
    16  
    17  #include <stddef.h>
    18  #include <stdint.h>
    19  
    20  
    21  typedef long long intgo;
    22  typedef unsigned long long uintgo;
    23  
    24  
    25  
    26  typedef struct { char *p; intgo n; } _gostring_;
    27  typedef struct { void* array; intgo len; intgo cap; } _goslice_;
    28  
    29  
    30  typedef _gostring_ swig_type_1;
    31  typedef _gostring_ swig_type_2;
    32  typedef _gostring_ swig_type_3;
    33  typedef _gostring_ swig_type_4;
    34  typedef _gostring_ swig_type_5;
    35  typedef _gostring_ swig_type_6;
    36  typedef _gostring_ swig_type_7;
    37  typedef _gostring_ swig_type_8;
    38  typedef _gostring_ swig_type_9;
    39  extern void _wrap_Swig_free_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    40  extern uintptr_t _wrap_Swig_malloc_pycv_ffa8ea6aa3be9035(swig_intgo arg1);
    41  extern void _wrap_LocalInitRequest_gpu_id_set_pycv_ffa8ea6aa3be9035(uintptr_t arg1, swig_intgo arg2);
    42  extern swig_intgo _wrap_LocalInitRequest_gpu_id_get_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    43  extern void _wrap_LocalInitRequest_sdk_dir_set_pycv_ffa8ea6aa3be9035(uintptr_t arg1, swig_type_1 arg2);
    44  extern swig_type_2 _wrap_LocalInitRequest_sdk_dir_get_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    45  extern void _wrap_LocalInitRequest_model_dir_set_pycv_ffa8ea6aa3be9035(uintptr_t arg1, swig_type_3 arg2);
    46  extern swig_type_4 _wrap_LocalInitRequest_model_dir_get_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    47  extern uintptr_t _wrap_new_LocalInitRequest_pycv_ffa8ea6aa3be9035(void);
    48  extern void _wrap_delete_LocalInitRequest_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    49  extern uintptr_t _wrap_new_LocalInitResponse_pycv_ffa8ea6aa3be9035(void);
    50  extern void _wrap_delete_LocalInitResponse_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    51  extern void _wrap_DoRequest_arg1_set_pycv_ffa8ea6aa3be9035(uintptr_t arg1, swig_type_5 arg2);
    52  extern swig_type_6 _wrap_DoRequest_arg1_get_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    53  extern void _wrap_DoRequest_arg2_set_pycv_ffa8ea6aa3be9035(uintptr_t arg1, swig_type_7 arg2);
    54  extern swig_type_8 _wrap_DoRequest_arg2_get_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    55  extern uintptr_t _wrap_new_DoRequest_pycv_ffa8ea6aa3be9035(void);
    56  extern void _wrap_delete_DoRequest_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    57  extern uintptr_t _wrap_new_DoResponse_pycv_ffa8ea6aa3be9035(void);
    58  extern void _wrap_delete_DoResponse_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    59  extern uintptr_t _wrap_new_Wrapped_PyImage_pycv_ffa8ea6aa3be9035(void);
    60  extern void _wrap_delete_Wrapped_PyImage_pycv_ffa8ea6aa3be9035(uintptr_t arg1);
    61  extern void _wrap_Wrapped_PyImage_GlobalInit_pycv_ffa8ea6aa3be9035(swig_type_9 arg1, swig_intgo arg2);
    62  extern void _wrap_Wrapped_PyImage_GlobalRelease_pycv_ffa8ea6aa3be9035(void);
    63  extern void _wrap_Wrapped_PyImage_Wrapped_PyImage_LocalInit_pycv_ffa8ea6aa3be9035(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3);
    64  extern void _wrap_Wrapped_PyImage_Wrapped_PyImage_Do_pycv_ffa8ea6aa3be9035(uintptr_t arg1, uintptr_t arg2, uintptr_t arg3);
    65  #undef intgo
    66  */
    67  import "C"
    68  
    69  import "unsafe"
    70  import _ "runtime/cgo"
    71  import "sync"
    72  import "fmt"
    73  
    74  
    75  type _ unsafe.Pointer
    76  
    77  
    78  
    79  var Swig_escape_always_false bool
    80  var Swig_escape_val interface{}
    81  
    82  
    83  type _swig_fnptr *byte
    84  type _swig_memberptr *byte
    85  
    86  
    87  func getSwigcptr(v interface { Swigcptr() uintptr }) uintptr {
    88  	if v == nil {
    89  		return 0
    90  	}
    91  	return v.Swigcptr()
    92  }
    93  
    94  
    95  type _ sync.Mutex
    96  
    97  //export cgo_panic__pycv_ffa8ea6aa3be9035
    98  func cgo_panic__pycv_ffa8ea6aa3be9035(p *byte) {
    99  	s := (*[1024]byte)(unsafe.Pointer(p))[:]
   100  	for i, b := range s {
   101  		if b == 0 {
   102  			panic(string(s[:i]))
   103  		}
   104  	}
   105  	panic(string(s))
   106  }
   107  
   108  
   109  type swig_gostring struct { p uintptr; n int }
   110  func swigCopyString(s string) string {
   111    p := *(*swig_gostring)(unsafe.Pointer(&s))
   112    r := string((*[0x7fffffff]byte)(unsafe.Pointer(p.p))[:p.n])
   113    Swig_free(p.p)
   114    return r
   115  }
   116  
   117  func Swig_free(arg1 uintptr) {
   118  	_swig_i_0 := arg1
   119  	C._wrap_Swig_free_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   120  }
   121  
   122  func Swig_malloc(arg1 int) (_swig_ret uintptr) {
   123  	var swig_r uintptr
   124  	_swig_i_0 := arg1
   125  	swig_r = (uintptr)(C._wrap_Swig_malloc_pycv_ffa8ea6aa3be9035(C.swig_intgo(_swig_i_0)))
   126  	return swig_r
   127  }
   128  
   129  type SwigcptrLocalInitRequest uintptr
   130  
   131  func (p SwigcptrLocalInitRequest) Swigcptr() uintptr {
   132  	return (uintptr)(p)
   133  }
   134  
   135  func (p SwigcptrLocalInitRequest) SwigIsLocalInitRequest() {
   136  }
   137  
   138  func (arg1 SwigcptrLocalInitRequest) SetGpu_id(arg2 int) {
   139  	_swig_i_0 := arg1
   140  	_swig_i_1 := arg2
   141  	C._wrap_LocalInitRequest_gpu_id_set_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0), C.swig_intgo(_swig_i_1))
   142  }
   143  
   144  func (arg1 SwigcptrLocalInitRequest) GetGpu_id() (_swig_ret int) {
   145  	var swig_r int
   146  	_swig_i_0 := arg1
   147  	swig_r = (int)(C._wrap_LocalInitRequest_gpu_id_get_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0)))
   148  	return swig_r
   149  }
   150  
   151  func (arg1 SwigcptrLocalInitRequest) SetSdk_dir(arg2 string) {
   152  	_swig_i_0 := arg1
   153  	_swig_i_1 := arg2
   154  	C._wrap_LocalInitRequest_sdk_dir_set_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0), *(*C.swig_type_1)(unsafe.Pointer(&_swig_i_1)))
   155  	if Swig_escape_always_false {
   156  		Swig_escape_val = arg2
   157  	}
   158  }
   159  
   160  func (arg1 SwigcptrLocalInitRequest) GetSdk_dir() (_swig_ret string) {
   161  	var swig_r string
   162  	_swig_i_0 := arg1
   163  	swig_r_p := C._wrap_LocalInitRequest_sdk_dir_get_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   164  	swig_r = *(*string)(unsafe.Pointer(&swig_r_p))
   165  	var swig_r_1 string
   166   swig_r_1 = swigCopyString(swig_r) 
   167  	return swig_r_1
   168  }
   169  
   170  func (arg1 SwigcptrLocalInitRequest) SetModel_dir(arg2 string) {
   171  	_swig_i_0 := arg1
   172  	_swig_i_1 := arg2
   173  	C._wrap_LocalInitRequest_model_dir_set_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0), *(*C.swig_type_3)(unsafe.Pointer(&_swig_i_1)))
   174  	if Swig_escape_always_false {
   175  		Swig_escape_val = arg2
   176  	}
   177  }
   178  
   179  func (arg1 SwigcptrLocalInitRequest) GetModel_dir() (_swig_ret string) {
   180  	var swig_r string
   181  	_swig_i_0 := arg1
   182  	swig_r_p := C._wrap_LocalInitRequest_model_dir_get_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   183  	swig_r = *(*string)(unsafe.Pointer(&swig_r_p))
   184  	var swig_r_1 string
   185   swig_r_1 = swigCopyString(swig_r) 
   186  	return swig_r_1
   187  }
   188  
   189  func NewLocalInitRequest() (_swig_ret LocalInitRequest) {
   190  	var swig_r LocalInitRequest
   191  	swig_r = (LocalInitRequest)(SwigcptrLocalInitRequest(C._wrap_new_LocalInitRequest_pycv_ffa8ea6aa3be9035()))
   192  	return swig_r
   193  }
   194  
   195  func DeleteLocalInitRequest(arg1 LocalInitRequest) {
   196  	_swig_i_0 := getSwigcptr(arg1)
   197  	C._wrap_delete_LocalInitRequest_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   198  }
   199  
   200  type LocalInitRequest interface {
   201  	Swigcptr() uintptr
   202  	SwigIsLocalInitRequest()
   203  	SetGpu_id(arg2 int)
   204  	GetGpu_id() (_swig_ret int)
   205  	SetSdk_dir(arg2 string)
   206  	GetSdk_dir() (_swig_ret string)
   207  	SetModel_dir(arg2 string)
   208  	GetModel_dir() (_swig_ret string)
   209  }
   210  
   211  type SwigcptrLocalInitResponse uintptr
   212  
   213  func (p SwigcptrLocalInitResponse) Swigcptr() uintptr {
   214  	return (uintptr)(p)
   215  }
   216  
   217  func (p SwigcptrLocalInitResponse) SwigIsLocalInitResponse() {
   218  }
   219  
   220  func NewLocalInitResponse() (_swig_ret LocalInitResponse) {
   221  	var swig_r LocalInitResponse
   222  	swig_r = (LocalInitResponse)(SwigcptrLocalInitResponse(C._wrap_new_LocalInitResponse_pycv_ffa8ea6aa3be9035()))
   223  	return swig_r
   224  }
   225  
   226  func DeleteLocalInitResponse(arg1 LocalInitResponse) {
   227  	_swig_i_0 := getSwigcptr(arg1)
   228  	C._wrap_delete_LocalInitResponse_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   229  }
   230  
   231  type LocalInitResponse interface {
   232  	Swigcptr() uintptr
   233  	SwigIsLocalInitResponse()
   234  }
   235  
   236  type SwigcptrDoRequest uintptr
   237  
   238  func (p SwigcptrDoRequest) Swigcptr() uintptr {
   239  	return (uintptr)(p)
   240  }
   241  
   242  func (p SwigcptrDoRequest) SwigIsDoRequest() {
   243  }
   244  
   245  func (arg1 SwigcptrDoRequest) SetArg1(arg2 string) {
   246  	_swig_i_0 := arg1
   247  	_swig_i_1 := arg2
   248  	C._wrap_DoRequest_arg1_set_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0), *(*C.swig_type_5)(unsafe.Pointer(&_swig_i_1)))
   249  	if Swig_escape_always_false {
   250  		Swig_escape_val = arg2
   251  	}
   252  }
   253  
   254  func (arg1 SwigcptrDoRequest) GetArg1() (_swig_ret string) {
   255  	var swig_r string
   256  	_swig_i_0 := arg1
   257  	swig_r_p := C._wrap_DoRequest_arg1_get_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   258  	swig_r = *(*string)(unsafe.Pointer(&swig_r_p))
   259  	var swig_r_1 string
   260   swig_r_1 = swigCopyString(swig_r) 
   261  	return swig_r_1
   262  }
   263  
   264  func (arg1 SwigcptrDoRequest) SetArg2(arg2 string) {
   265  	_swig_i_0 := arg1
   266  	_swig_i_1 := arg2
   267  	C._wrap_DoRequest_arg2_set_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0), *(*C.swig_type_7)(unsafe.Pointer(&_swig_i_1)))
   268  	if Swig_escape_always_false {
   269  		Swig_escape_val = arg2
   270  	}
   271  }
   272  
   273  func (arg1 SwigcptrDoRequest) GetArg2() (_swig_ret string) {
   274  	var swig_r string
   275  	_swig_i_0 := arg1
   276  	swig_r_p := C._wrap_DoRequest_arg2_get_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   277  	swig_r = *(*string)(unsafe.Pointer(&swig_r_p))
   278  	var swig_r_1 string
   279   swig_r_1 = swigCopyString(swig_r) 
   280  	return swig_r_1
   281  }
   282  
   283  func NewDoRequest() (_swig_ret DoRequest) {
   284  	var swig_r DoRequest
   285  	swig_r = (DoRequest)(SwigcptrDoRequest(C._wrap_new_DoRequest_pycv_ffa8ea6aa3be9035()))
   286  	return swig_r
   287  }
   288  
   289  func DeleteDoRequest(arg1 DoRequest) {
   290  	_swig_i_0 := getSwigcptr(arg1)
   291  	C._wrap_delete_DoRequest_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   292  }
   293  
   294  type DoRequest interface {
   295  	Swigcptr() uintptr
   296  	SwigIsDoRequest()
   297  	SetArg1(arg2 string)
   298  	GetArg1() (_swig_ret string)
   299  	SetArg2(arg2 string)
   300  	GetArg2() (_swig_ret string)
   301  }
   302  
   303  type SwigcptrDoResponse uintptr
   304  
   305  func (p SwigcptrDoResponse) Swigcptr() uintptr {
   306  	return (uintptr)(p)
   307  }
   308  
   309  func (p SwigcptrDoResponse) SwigIsDoResponse() {
   310  }
   311  
   312  func NewDoResponse() (_swig_ret DoResponse) {
   313  	var swig_r DoResponse
   314  	swig_r = (DoResponse)(SwigcptrDoResponse(C._wrap_new_DoResponse_pycv_ffa8ea6aa3be9035()))
   315  	return swig_r
   316  }
   317  
   318  func DeleteDoResponse(arg1 DoResponse) {
   319  	_swig_i_0 := getSwigcptr(arg1)
   320  	C._wrap_delete_DoResponse_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   321  }
   322  
   323  type DoResponse interface {
   324  	Swigcptr() uintptr
   325  	SwigIsDoResponse()
   326  }
   327  
   328  type SwigcptrWrapped_PyImage uintptr
   329  
   330  func (p SwigcptrWrapped_PyImage) Swigcptr() uintptr {
   331  	return (uintptr)(p)
   332  }
   333  
   334  func (p SwigcptrWrapped_PyImage) SwigIsWrapped_PyImage() {
   335  }
   336  
   337  func NewWrapped_PyImage() (_swig_ret Wrapped_PyImage) {
   338  	var swig_r Wrapped_PyImage
   339  	swig_r = (Wrapped_PyImage)(SwigcptrWrapped_PyImage(C._wrap_new_Wrapped_PyImage_pycv_ffa8ea6aa3be9035()))
   340  	return swig_r
   341  }
   342  
   343  func DeleteWrapped_PyImage(arg1 Wrapped_PyImage) {
   344  	_swig_i_0 := getSwigcptr(arg1)
   345  	C._wrap_delete_Wrapped_PyImage_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0))
   346  }
   347  
   348  func Wrapped_PyImageGlobalInit(arg1 string, arg2 int) {
   349  	_swig_i_0 := arg1
   350  	_swig_i_1 := arg2
   351  	C._wrap_Wrapped_PyImage_GlobalInit_pycv_ffa8ea6aa3be9035(*(*C.swig_type_9)(unsafe.Pointer(&_swig_i_0)), C.swig_intgo(_swig_i_1))
   352  	if Swig_escape_always_false {
   353  		Swig_escape_val = arg1
   354  	}
   355  }
   356  
   357  func Wrapped_PyImageGlobalRelease() {
   358  	C._wrap_Wrapped_PyImage_GlobalRelease_pycv_ffa8ea6aa3be9035()
   359  }
   360  
   361  func (arg1 SwigcptrWrapped_PyImage) Wrapped_PyImage_LocalInit(arg2 LocalInitRequest, arg3 LocalInitResponse) {
   362  	_swig_i_0 := arg1
   363  	_swig_i_1 := getSwigcptr(arg2)
   364  	_swig_i_2 := getSwigcptr(arg3)
   365  	C._wrap_Wrapped_PyImage_Wrapped_PyImage_LocalInit_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1), C.uintptr_t(_swig_i_2))
   366  }
   367  
   368  func (arg1 SwigcptrWrapped_PyImage) Wrapped_PyImage_Do(arg2 DoRequest, arg3 DoResponse) {
   369  	_swig_i_0 := arg1
   370  	_swig_i_1 := getSwigcptr(arg2)
   371  	_swig_i_2 := getSwigcptr(arg3)
   372  	C._wrap_Wrapped_PyImage_Wrapped_PyImage_Do_pycv_ffa8ea6aa3be9035(C.uintptr_t(_swig_i_0), C.uintptr_t(_swig_i_1), C.uintptr_t(_swig_i_2))
   373  }
   374  
   375  type Wrapped_PyImage interface {
   376  	Swigcptr() uintptr
   377  	SwigIsWrapped_PyImage()
   378  	Wrapped_PyImage_LocalInit(arg2 LocalInitRequest, arg3 LocalInitResponse)
   379  	Wrapped_PyImage_Do(arg2 DoRequest, arg3 DoResponse)
   380  }
   381  
   382  
   383  
   384  type PyImage interface {
   385     Wrapped_PyImage  
   386     LocalInit(LocalInitRequest) (LocalInitResponse, error);
   387     Do(DoRequest) (DoResponse, error);
   388  }
   389  
   390  func NewPyImage() PyImage {
   391       e := NewWrapped_PyImage()
   392       return e.(PyImage)
   393  }
   394  
   395  // catch will recover from a panic and store the recover message to the error 
   396  // parameter. The error must be passed by reference in order to be returned to the
   397  // calling function.
   398  func catch(err *error) {
   399      if r := recover(); r != nil {
   400          *err = fmt.Errorf("%v", r)
   401      }
   402  }
   403  
   404  func GlobalInit(model_dir string, gpu_id int) (err error) {
   405     defer catch(&err)
   406     Wrapped_PyImageGlobalInit(model_dir, gpu_id)
   407     return
   408  }
   409  
   410  func GlobalRelease() (err error){
   411     defer catch(&err)
   412     Wrapped_PyImageGlobalRelease()
   413     return
   414  }
   415  
   416  func (arg SwigcptrWrapped_PyImage) LocalInit(req LocalInitRequest) (resp LocalInitResponse, err error) {
   417     defer catch(&err)
   418     resp = NewLocalInitResponse()
   419     arg.Wrapped_PyImage_LocalInit(req, resp)
   420     return
   421  }
   422  
   423  func (arg SwigcptrWrapped_PyImage) Do(req DoRequest) (resp DoResponse, err error) {
   424     defer catch(&err)
   425     resp = NewDoResponse()
   426     arg.Wrapped_PyImage_Do(req, resp)
   427     return
   428  }
   429  
   430  
   431  
   432  
   433  
   434  var swigDirectorTrack struct {
   435  	sync.Mutex
   436  	m map[int]interface{}
   437  	c int
   438  }
   439  
   440  func swigDirectorAdd(v interface{}) int {
   441  	swigDirectorTrack.Lock()
   442  	defer swigDirectorTrack.Unlock()
   443  	if swigDirectorTrack.m == nil {
   444  		swigDirectorTrack.m = make(map[int]interface{})
   445  	}
   446  	swigDirectorTrack.c++
   447  	ret := swigDirectorTrack.c
   448  	swigDirectorTrack.m[ret] = v
   449  	return ret
   450  }
   451  
   452  func swigDirectorLookup(c int) interface{} {
   453  	swigDirectorTrack.Lock()
   454  	defer swigDirectorTrack.Unlock()
   455  	ret := swigDirectorTrack.m[c]
   456  	if ret == nil {
   457  		panic("C++ director pointer not found (possible	use-after-free)")
   458  	}
   459  	return ret
   460  }
   461  
   462  func swigDirectorDelete(c int) {
   463  	swigDirectorTrack.Lock()
   464  	defer swigDirectorTrack.Unlock()
   465  	if swigDirectorTrack.m[c] == nil {
   466  		if c > swigDirectorTrack.c {
   467  			panic("C++ director pointer invalid (possible memory corruption")
   468  		} else {
   469  			panic("C++ director pointer not found (possible use-after-free)")
   470  		}
   471  	}
   472  	delete(swigDirectorTrack.m, c)
   473  }
   474  
   475