MIRA
Classes | Namespaces | Macros | Functions
PythonSet.h File Reference

Interface for exporting std::set to python Most of the code taken from Andreas Beyer <mail <at> a-beyer.de> see http://article.gmane.org/gmane.comp.python.c%2B%2B/9682. More...

#include <set>
#include <Python.h>
#include <python/BoostPythonWrapper.h>
#include <error/Exceptions.h>
Include dependency graph for PythonSet.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  PythonSetAccessor< type >
 

Namespaces

 mira
 
 mira::python
 

Macros

#define MIRA_PYTHONCONNECTOR_PYTHONSET_FUNCTIONS(type, name, footerfunctions)
 

Functions

void block_hashing (boost::python::object)
 

Detailed Description

Interface for exporting std::set to python Most of the code taken from Andreas Beyer <mail <at> a-beyer.de> see http://article.gmane.org/gmane.comp.python.c%2B%2B/9682.

Author
Tim Langner, Christof Schröter
Date
2012/07/10

Macro Definition Documentation

◆ MIRA_PYTHONCONNECTOR_PYTHONSET_FUNCTIONS

#define MIRA_PYTHONCONNECTOR_PYTHONSET_FUNCTIONS (   type,
  name,
  footerfunctions 
)
Value:
class_<std::set<type> >(name, "mutable set") \
.def("__repr__", &PythonSetAccessor<type>::str) \
.def("__len__", &PythonSetAccessor<type>::size) \
.def("__contains__", &PythonSetAccessor<type>::contains) \
.def("add", &PythonSetAccessor<type>::add, "add element") \
.def("__delitem__", &PythonSetAccessor<type>::remove) \
.def("remove", &PythonSetAccessor<type>::remove, "remove element") \
.def("__iter__", boost::python::iterator<std::set<type> >()) \
.def("__hash__", block_hashing) \
.def("union", &PythonSetAccessor<type>::set_union, "set union") \
.def("__or__", &PythonSetAccessor<type>::set_union, "set union") \
.def("intersection", &PythonSetAccessor<type>::set_intersection, "set intersection") \
.def("__and__", &PythonSetAccessor<type>::set_intersection, "set intersection") \
.def("difference", &PythonSetAccessor<type>::set_difference, "elements not in second set") \
.def("__sub__", &PythonSetAccessor<type>::set_difference, "set difference") \
.def("symmetric_difference", &PythonSetAccessor<type>::set_symmetric_difference, "elements unique to either set") \
.def("__xor__", &PythonSetAccessor<type>::set_symmetric_difference, "symmetric set difference") \
footerfunctions;
void block_hashing(boost::python::object)
Definition: PythonSet.h:116