cxtream  0.5.1
C++17 data pipeline with Python bindings.
Classes | Functions
Python tools and bindings.

Classes

struct  cxtream::python::stop_iteration_exception
 Exception which is translated to Python's StopIteration when thrown. More...
 
class  cxtream::python::range< Rng >
 Python adapter for C++ ranges. More...
 

Functions

void cxtream::python::initialize ()
 Initialize Python module, register OpenCV converters, exceptions, etc.
 
template<typename Rng >
auto cxtream::python::stream::to_python (Rng &&rng)
 Make a Python range from a stream (i.e, a range of tuples of cxtream columns). More...
 
template<typename T >
boost::python::object cxtream::python::utility::to_python (std::vector< T > v)
 Create a Python list-like object out of a multidimensional std::vector. More...
 
template<typename Tuple >
boost::python::dict cxtream::python::utility::columns_to_python (Tuple tuple)
 Convert a tuple of cxtream columns into a Python dict. More...
 
template<typename T >
bool cxtream::python::utility::is_registered ()
 Check whether a converter for the given C++ class is registered in boost::python. More...
 
template<typename T >
PyObject * cxtream::python::utility::to_ndarray (const std::vector< T > &vec)
 Build ndarray from a one dimensional std::vector.
 

Detailed Description

Function Documentation

◆ columns_to_python()

template<typename Tuple >
boost::python::dict cxtream::python::utility::columns_to_python ( Tuple  tuple)

Convert a tuple of cxtream columns into a Python dict.

The dict is indexed by column.name and the value is column.value. The values (i.e, the batches) are converted to Python lists using to_python(). If the batch is a multidimensional std::vector<std::vector<...>>, it is converted to multidimensional Python list.

Definition at line 84 of file pyboost_column_converter.hpp.

◆ is_registered()

template<typename T >
bool cxtream::python::utility::is_registered ( )

Check whether a converter for the given C++ class is registered in boost::python.

Beware that this function will report false for primitive types such as int or double.

Definition at line 22 of file pyboost_is_registered.hpp.

◆ to_python() [1/2]

template<typename Rng >
auto cxtream::python::stream::to_python ( Rng &&  rng)

Make a Python range from a stream (i.e, a range of tuples of cxtream columns).

Only a view of the given range is created, therefore, the given range cannot be an rvalue of a container.

Tuples of columns are converted using columns_to_python().

Definition at line 28 of file converter.hpp.

◆ to_python() [2/2]

template<typename T >
boost::python::object cxtream::python::utility::to_python ( std::vector< T >  v)

Create a Python list-like object out of a multidimensional std::vector.

If the vector is multidimensional, i.e., std::vector<std::vector<...>>, the resulting Python structure will be multidimensional as well.

Definition at line 69 of file pyboost_column_converter.hpp.