SyFi  0.3
swig::SwigPySequence_Cont< T > Struct Template Reference

List of all members.

Public Types

typedef SwigPySequence_Ref< T > reference
typedef const
SwigPySequence_Ref< T > 
const_reference
typedef T value_type
typedef T * pointer
typedef int difference_type
typedef int size_type
typedef const pointer const_pointer
typedef
SwigPySequence_InputIterator
< T, reference
iterator
typedef
SwigPySequence_InputIterator
< T, const_reference
const_iterator

Public Member Functions

 SwigPySequence_Cont (PyObject *seq)
 ~SwigPySequence_Cont ()
size_type size () const
bool empty () const
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
reference operator[] (difference_type n)
const_reference operator[] (difference_type n) const
bool check (bool set_err=true) const

Private Attributes

PyObject * _seq

Detailed Description

template<class T>
struct swig::SwigPySequence_Cont< T >

Definition at line 4731 of file SyFiPYTHON_wrap.cxx.


Member Typedef Documentation

Definition at line 4741 of file SyFiPYTHON_wrap.cxx.

template<class T>
typedef const pointer swig::SwigPySequence_Cont< T >::const_pointer

Definition at line 4739 of file SyFiPYTHON_wrap.cxx.

template<class T>
typedef const SwigPySequence_Ref<T> swig::SwigPySequence_Cont< T >::const_reference

Definition at line 4734 of file SyFiPYTHON_wrap.cxx.

template<class T>
typedef int swig::SwigPySequence_Cont< T >::difference_type

Definition at line 4737 of file SyFiPYTHON_wrap.cxx.

Definition at line 4740 of file SyFiPYTHON_wrap.cxx.

template<class T>
typedef T* swig::SwigPySequence_Cont< T >::pointer

Definition at line 4736 of file SyFiPYTHON_wrap.cxx.

template<class T>
typedef SwigPySequence_Ref<T> swig::SwigPySequence_Cont< T >::reference

Definition at line 4733 of file SyFiPYTHON_wrap.cxx.

template<class T>
typedef int swig::SwigPySequence_Cont< T >::size_type

Definition at line 4738 of file SyFiPYTHON_wrap.cxx.

template<class T>
typedef T swig::SwigPySequence_Cont< T >::value_type

Definition at line 4735 of file SyFiPYTHON_wrap.cxx.


Constructor & Destructor Documentation

template<class T>
swig::SwigPySequence_Cont< T >::SwigPySequence_Cont ( PyObject *  seq) [inline]

Definition at line 4743 of file SyFiPYTHON_wrap.cxx.

                                       : _seq(0)
    {
      if (!PySequence_Check(seq)) {
        throw std::invalid_argument("a sequence is expected");
      }
      _seq = seq;
      Py_INCREF(_seq);
    }
template<class T>
swig::SwigPySequence_Cont< T >::~SwigPySequence_Cont ( ) [inline]

Definition at line 4752 of file SyFiPYTHON_wrap.cxx.

    {
      Py_XDECREF(_seq);
    }

Member Function Documentation

template<class T>
iterator swig::SwigPySequence_Cont< T >::begin ( ) [inline]

Definition at line 4767 of file SyFiPYTHON_wrap.cxx.

    {
      return iterator(_seq, 0);
    }
template<class T>
const_iterator swig::SwigPySequence_Cont< T >::begin ( ) const [inline]

Definition at line 4772 of file SyFiPYTHON_wrap.cxx.

    {
      return const_iterator(_seq, 0);
    }
template<class T>
bool swig::SwigPySequence_Cont< T >::check ( bool  set_err = true) const [inline]

Definition at line 4797 of file SyFiPYTHON_wrap.cxx.

References SWIG_Error, and SWIG_RuntimeError.

Referenced by swig::traits_asptr_stdseq< Seq, T >::asptr().

    {
      int s = size();
      for (int i = 0; i < s; ++i) {
        swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i);
        if (!swig::check<value_type>(item)) {
          if (set_err) {
            char msg[1024];
            sprintf(msg, "in sequence element %d", i);
            SWIG_Error(SWIG_RuntimeError, msg);
          }
          return false;
        }
      }
      return true;
    }
template<class T>
bool swig::SwigPySequence_Cont< T >::empty ( ) const [inline]

Definition at line 4762 of file SyFiPYTHON_wrap.cxx.

    {
      return size() == 0;
    }
template<class T>
iterator swig::SwigPySequence_Cont< T >::end ( ) [inline]

Definition at line 4777 of file SyFiPYTHON_wrap.cxx.

    {
      return iterator(_seq, size());
    }
template<class T>
const_iterator swig::SwigPySequence_Cont< T >::end ( ) const [inline]

Definition at line 4782 of file SyFiPYTHON_wrap.cxx.

    {
      return const_iterator(_seq, size());
    }
template<class T>
reference swig::SwigPySequence_Cont< T >::operator[] ( difference_type  n) [inline]

Definition at line 4787 of file SyFiPYTHON_wrap.cxx.

    {
      return reference(_seq, n);
    }
template<class T>
const_reference swig::SwigPySequence_Cont< T >::operator[] ( difference_type  n) const [inline]

Definition at line 4792 of file SyFiPYTHON_wrap.cxx.

    {
      return const_reference(_seq, n);
    }
template<class T>
size_type swig::SwigPySequence_Cont< T >::size ( ) const [inline]

Definition at line 4757 of file SyFiPYTHON_wrap.cxx.

References PySequence_Size.

    {
      return static_cast<size_type>(PySequence_Size(_seq));
    }

Member Data Documentation

template<class T>
PyObject* swig::SwigPySequence_Cont< T >::_seq [private]

Definition at line 4815 of file SyFiPYTHON_wrap.cxx.


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