Michele De Stefano's C++ Utilities
mds_utils::python Namespace Reference

Namespace of all Michele De Stefano's C++ Python utilities. More...

Namespaces

 numpy
 Contains utilities for the creation of NumPy extensions.
 
 ublas
 Contains several utilities for interfacing Python with Boost's uBLAS.
 

Classes

class  Dictionary
 Wraps a Python dictionary. More...
 
class  FileObj
 Class for easily managment of Python file objects from C++ code. More...
 
class  iFileObj
 Class for easily managment of Python input file objects from C++ code. More...
 
struct  index_error
 Exception used for detecting and raising IndexError Python exceptions. More...
 
class  List
 Wraps a Python list. More...
 
class  Obj
 This is a simple wrapper around the PyObject* datatype. More...
 
class  oFileObj
 Class for easily managment of Python output file objects from C++ code. More...
 
class  ProxyPySeqElement
 Default Reference type for the PySequenceIterator class. More...
 
class  PySeqIt_Access
 Accessor class for the PySequenceIterator. More...
 
class  PySequenceIterator
 Iterator that allows to scan a Python sequence composed by homogeneous elements. More...
 
class  Sequence
 Wraps a generic Python sequence. More...
 
class  Sequence_Base
 Base class for all generic sequence types. More...
 
struct  support_random_access
 Adds support for random access operator (i.e. square brackets) to a class that has to be exposed to the Python interpreter. The access is only in read mode. More...
 
struct  support_random_getset_access
 Adds support for random get/set access operator (i.e. square brackets) to a class that has to be exposed to the Python interpreter. The access is both in read and write mode. More...
 
class  Tuple
 Wraps a Python tuple. More...
 

Functions

template<class T >
get (PyObject *po)
 Primary template for extracting a value from a Python object. More...
 
PyObject * to_python (void)
 Converts a value into a Python object. More...
 
size_t len (PyObject *o)
 Retrieves the length of a sequence object. More...
 

Detailed Description

Namespace of all Michele De Stefano's C++ Python utilities.

Author
Michele De Stefano
Date
24/09/2009

Function Documentation

template<class T >
T mds_utils::python::get ( PyObject *  po)
inline

Primary template for extracting a value from a Python object.

It is meant to be specialized for each particular data type.

Template Parameters
TThe data type of the value to be extracted.
Author
Michele De Stefano
Date
24/09/2012

Primary template for extracting a value from a Python object.

Template Parameters
MThe data type of a dense uBLAS matrix.
Parameters
poThe Numpy array object to convert from.
Returns
Boost uBLAS dense matrix corresponding to the Numpy array to be converted.
Author
Michele De Stefano
Date
22/06/2014

Primary template for extracting a value from a Python object.

Template Parameters
MThe data type of a uBLAS compressed_matrix.
Parameters
poThe Numpy array object to convert from.
Returns
A Boost uBLAS compressed matrix corresponding to the Numpy array to be converted.
Remarks
Works with real and complex data types.
Author
Michele De Stefano
Date
24/06/2014

Primary template for extracting a value from a Python object.

Template Parameters
ublas_vec_TThe data type of a dense uBLAS vector.
Parameters
poThe Numpy array object to be converted.
Returns
Boost uBLAS dense vector corresponding to the Numpy array to be converted.
Author
Michele De Stefano
Date
30/06/2014

Definition at line 56 of file matrix.hpp.

References mds_utils::python::Obj::attr(), mds_utils::python::Obj::get_ownership(), and len().

size_t mds_utils::python::len ( PyObject *  o)
inline

Retrieves the length of a sequence object.

Throws an exception if it is not possible to retrieve a length for the object.

Parameters
oThe object whose length has to be queried.
Returns
The object length.
Author
Michele De Stefano
Date
27/05/2014

Definition at line 54 of file sequence.hpp.

Referenced by mds_utils::python::ublas::get().

PyObject* mds_utils::python::to_python ( void  )