Server IP : 185.86.78.101 / Your IP : 216.73.216.124 Web Server : Apache System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /usr/share/swig4.0/octave/ |
Upload File : |
// Pairs %include <octstdcommon.swg> //#define SWIG_STD_PAIR_ASVAL %fragment("StdPairTraits","header",fragment="StdTraits") { namespace swig { #ifdef SWIG_STD_PAIR_ASVAL template <class T, class U > struct traits_asval<std::pair<T,U> > { typedef std::pair<T,U> value_type; static int get_pair(const octave_value& first, octave_value second, std::pair<T,U> *val) { if (val) { T *pfirst = &(val->first); int res1 = swig::asval(first, pfirst); if (!SWIG_IsOK(res1)) return res1; U *psecond = &(val->second); int res2 = swig::asval(second, psecond); if (!SWIG_IsOK(res2)) return res2; return res1 > res2 ? res1 : res2; } else { T *pfirst = 0; int res1 = swig::asval(first, pfirst); if (!SWIG_IsOK(res1)) return res1; U *psecond = 0; int res2 = swig::asval((PyObject*)second, psecond); if (!SWIG_IsOK(res2)) return res2; return res1 > res2 ? res1 : res2; } } static int asval(const octave_value& obj, std::pair<T,U> *val) { if ( %#if SWIG_OCTAVE_PREREQ(4,4,0) obj.iscell() %#else obj.is_cell() %#endif ) { Cell c=obj.cell_value(); if (c.numel()<2) { error("pair from Cell array requires at least two elements"); return SWIG_ERROR; } return get_pair(c(0),c(1),val); } else { value_type *p; swig_type_info *descriptor = swig::type_info<value_type>(); int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = *p; return res; } return SWIG_ERROR; } }; #else template <class T, class U > struct traits_asptr<std::pair<T,U> > { typedef std::pair<T,U> value_type; static int get_pair(const octave_value& first, octave_value second, std::pair<T,U> **val) { if (val) { value_type *vp = %new_instance(std::pair<T,U>); T *pfirst = &(vp->first); int res1 = swig::asval(first, pfirst); if (!SWIG_IsOK(res1)) { %delete(vp); return res1; } U *psecond = &(vp->second); int res2 = swig::asval(second, psecond); if (!SWIG_IsOK(res2)) { %delete(vp); return res2; } *val = vp; return SWIG_AddNewMask(res1 > res2 ? res1 : res2); } else { T *pfirst = 0; int res1 = swig::asval(first, pfirst); if (!SWIG_IsOK(res1)) return res1; U *psecond = 0; int res2 = swig::asval(second, psecond); if (!SWIG_IsOK(res2)) return res2; return res1 > res2 ? res1 : res2; } return SWIG_ERROR; } static int asptr(const octave_value& obj, std::pair<T,U> **val) { if ( %#if SWIG_OCTAVE_PREREQ(4,4,0) obj.iscell() %#else obj.is_cell() %#endif ) { Cell c=obj.cell_value(); if (c.numel()<2) { error("pair from Cell array requires at least two elements"); return SWIG_ERROR; } return get_pair(c(0),c(1),val); } else { value_type *p; swig_type_info *descriptor = swig::type_info<value_type>(); int res = descriptor ? SWIG_ConvertPtr(obj, (void **)&p, descriptor, 0) : SWIG_ERROR; if (SWIG_IsOK(res) && val) *val = p; return res; } return SWIG_ERROR; } }; #endif template <class T, class U > struct traits_from<std::pair<T,U> > { static octave_value from(const std::pair<T,U>& val) { Cell c(1,2); c(0)=swig::from(val.first); c(1)=swig::from(val.second); return c; } }; } } %define %swig_pair_methods(pair...) %enddef %include <std/std_pair.i>