* indentations + whitespace cleanup

This commit is contained in:
Caner Candan 2011-05-05 16:54:00 +02:00
commit 56c6edab04
285 changed files with 6068 additions and 6223 deletions

View file

@ -1,6 +1,6 @@
/*
PyEO
Copyright (C) 2003 Maarten Keijzer
This program is free software; you can redistribute it and/or modify
@ -23,104 +23,104 @@
#include <eoFunctor.h>
// DEFINES for call
// DEFINES for call
#define WC1 boost::python::with_custodian_and_ward<1,2>()
#define WC2 boost::python::with_custodian_and_ward<1,2, with_custodian_and_ward<1,3> >()
namespace eoutils {
using namespace boost::python;
template <class Proc>
class ProcWrapper : public Proc
{
public:
PyObject* self;
ProcWrapper(PyObject* s) : self(s) {}
using namespace boost::python;
typename Proc::result_type operator()(void)
template <class Proc>
class ProcWrapper : public Proc
{
return boost::python::call_method<typename Proc::result_type>(self, "__call__");
}
};
template <class Proc>
void make_abstract_functor(std::string name, typename eoFunctorBase::procedure_tag)
{
typedef ProcWrapper<Proc> Wrapper;
boost::python::class_<Proc, Wrapper,boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator());
}
template <class Proc>
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::procedure_tag)
{
typedef ProcWrapper<Proc> Wrapper;
boost::python::class_<Proc, Wrapper,boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>());
}
template <class Unary>
class UnaryWrapper : public Unary
{
public:
PyObject* self;
UnaryWrapper(PyObject* s) : self(s) {}
PyObject* self;
ProcWrapper(PyObject* s) : self(s) {}
typename Unary::result_type operator()(typename Unary::argument_type a)
{
return boost::python::call_method<typename Unary::result_type>(self, "__call__", boost::ref(a) );
}
};
typename Proc::result_type operator()(void)
{
return boost::python::call_method<typename Proc::result_type>(self, "__call__");
}
};
template <class Unary>
void make_abstract_functor(std::string name, typename eoFunctorBase::unary_function_tag)
{
typedef UnaryWrapper<Unary> Wrapper;
boost::python::class_<Unary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator())
;
}
template <class Unary>
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::unary_function_tag)
{
typedef UnaryWrapper<Unary> Wrapper;
boost::python::class_<Unary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>() )
;
}
template <class Binary>
class BinaryWrapper : public Binary
{
public:
PyObject* self;
BinaryWrapper(PyObject* s) : self(s) {}
typename Binary::result_type operator()(typename Binary::first_argument_type a1, typename Binary::second_argument_type a2)
template <class Proc>
void make_abstract_functor(std::string name, typename eoFunctorBase::procedure_tag)
{
return boost::python::call_method<
typename Binary::result_type>(self, "__call__", boost::ref(a1), boost::ref(a2) );
typedef ProcWrapper<Proc> Wrapper;
boost::python::class_<Proc, Wrapper,boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator());
}
};
template <class Binary>
void make_abstract_functor(std::string name, typename eoFunctorBase::binary_function_tag)
{
typedef BinaryWrapper<Binary> Wrapper;
boost::python::class_<Binary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator());
}
template <class Proc>
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::procedure_tag)
{
typedef ProcWrapper<Proc> Wrapper;
boost::python::class_<Proc, Wrapper,boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>());
}
template <class Binary>
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::binary_function_tag)
{
typedef BinaryWrapper<Binary> Wrapper;
boost::python::class_<Binary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>() );
}
template <class Unary>
class UnaryWrapper : public Unary
{
public:
PyObject* self;
UnaryWrapper(PyObject* s) : self(s) {}
typename Unary::result_type operator()(typename Unary::argument_type a)
{
return boost::python::call_method<typename Unary::result_type>(self, "__call__", boost::ref(a) );
}
};
template <class Unary>
void make_abstract_functor(std::string name, typename eoFunctorBase::unary_function_tag)
{
typedef UnaryWrapper<Unary> Wrapper;
boost::python::class_<Unary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator())
;
}
template <class Unary>
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::unary_function_tag)
{
typedef UnaryWrapper<Unary> Wrapper;
boost::python::class_<Unary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>() )
;
}
template <class Binary>
class BinaryWrapper : public Binary
{
public:
PyObject* self;
BinaryWrapper(PyObject* s) : self(s) {}
typename Binary::result_type operator()(typename Binary::first_argument_type a1, typename Binary::second_argument_type a2)
{
return boost::python::call_method<
typename Binary::result_type>(self, "__call__", boost::ref(a1), boost::ref(a2) );
}
};
template <class Binary>
void make_abstract_functor(std::string name, typename eoFunctorBase::binary_function_tag)
{
typedef BinaryWrapper<Binary> Wrapper;
boost::python::class_<Binary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator());
}
template <class Binary>
void make_abstract_functor_ref(std::string name, typename eoFunctorBase::binary_function_tag)
{
typedef BinaryWrapper<Binary> Wrapper;
boost::python::class_<Binary, Wrapper, boost::noncopyable>(name.c_str(), boost::python::init<>() )
.def("__call__", &Wrapper::operator(), boost::python::return_internal_reference<>() );
}
}// namespace eoutils