RDKit
Open-source cheminformatics and machine learning.
PySequenceHolder< T > Class Template Reference

Class to hold sequences (lists, tuples, arrays, etc.) passed from Python -> C++. More...

#include <PySequenceHolder.h>

Public Member Functions

 PySequenceHolder (python::object seq)
 
unsigned int size () const
 Returns the size of the contained sequence. More...
 
operator[] (unsigned int which) const
 Returns an element of the sequence. More...
 

Detailed Description

template<typename T>
class PySequenceHolder< T >

Class to hold sequences (lists, tuples, arrays, etc.) passed from Python -> C++.

PySequenceHolder is templated on the type of the contained object.

The class is lazy: elements are not evaluated until requested within the C++ code.

Definition at line 31 of file PySequenceHolder.h.

Constructor & Destructor Documentation

template<typename T >
PySequenceHolder< T >::PySequenceHolder ( python::object  seq)
inline

Definition at line 33 of file PySequenceHolder.h.

Member Function Documentation

template<typename T >
T PySequenceHolder< T >::operator[] ( unsigned int  which) const
inline

Returns an element of the sequence.

ARGUMENTS:

  • which: an integer specifying which element should be returned.

NOTES:

  • if the sequence is not which elements long, we raise an IndexError
  • if the element cannot be converted to type T, we raise a ValueError

Definition at line 61 of file PySequenceHolder.h.

References POSTCONDITION, and PySequenceHolder< T >::size().

template<typename T >
unsigned int PySequenceHolder< T >::size ( ) const
inline

Returns the size of the contained sequence.

NOTE: the sequence must have a len attribute, otherwise a ValueError will be raised.

Definition at line 40 of file PySequenceHolder.h.

Referenced by PySequenceHolder< T >::operator[]().


The documentation for this class was generated from the following file: