SyFi 0.3
swig::traits_asptr< std::pair< T, U > > Struct Template Reference

List of all members.

Public Types

typedef std::pair< T, U > value_type

Static Public Member Functions

static int get_pair (PyObject *first, PyObject *second, std::pair< T, U > **val)
static int asptr (PyObject *obj, std::pair< T, U > **val)

Detailed Description

template<class T, class U>
struct swig::traits_asptr< std::pair< T, U > >

Definition at line 4641 of file SyFi_wrap.cc.


Member Typedef Documentation

template<class T , class U >
typedef std::pair<T,U> swig::traits_asptr< std::pair< T, U > >::value_type

Definition at line 4642 of file SyFi_wrap.cc.


Member Function Documentation

template<class T , class U >
static int swig::traits_asptr< std::pair< T, U > >::asptr ( PyObject *  obj,
std::pair< T, U > **  val 
) [inline, static]

Definition at line 4668 of file SyFi_wrap.cc.

References SyFi::p, PySequence_Size, run_all::res, SWIG_ConvertPtr, SWIG_ERROR, and SWIG_IsOK.

                                                          {
        int res = SWIG_ERROR;
        if (PyTuple_Check(obj)) {
          if (PyTuple_GET_SIZE(obj) == 2) {
            res = get_pair(PyTuple_GET_ITEM(obj,0),PyTuple_GET_ITEM(obj,1), val);
          }
        } else if (PySequence_Check(obj)) {
          if (PySequence_Size(obj) == 2) {
            swig::SwigVar_PyObject first = PySequence_GetItem(obj,0);
            swig::SwigVar_PyObject second = PySequence_GetItem(obj,1);
            res = get_pair(first, second, val);
          }
        } else {
          value_type *p;
          res = SWIG_ConvertPtr(obj,(void**)&p,swig::type_info<value_type>(),0);
          if (SWIG_IsOK(res) && val)  *val = p;
        }
        return res;
      }
template<class T , class U >
static int swig::traits_asptr< std::pair< T, U > >::get_pair ( PyObject *  first,
PyObject *  second,
std::pair< T, U > **  val 
) [inline, static]

Definition at line 4644 of file SyFi_wrap.cc.

References swig::asval(), SWIG_AddNewMask, and SWIG_IsOK.

      {
        if (val) {
          value_type *vp = (new std::pair<T,U>);
          T *pfirst = &(vp->first);
          int res1 = swig::asval((PyObject*)first, pfirst);
          if (!SWIG_IsOK(res1)) return res1;
          U *psecond = &(vp->second);
          int res2 = swig::asval((PyObject*)second, psecond);
          if (!SWIG_IsOK(res2)) return res2;
          *val = vp;
          return SWIG_AddNewMask(res1 > res2 ? res1 : res2);
        } else {
          T *pfirst = 0;
          int res1 = swig::asval((PyObject*)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;
        }       
      }

The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines