Program Listing for File printable.hpp

Return to documentation for file (include/pinocchio/bindings/python/utils/printable.hpp)

//
// Copyright (c) 2016 CNRS
//

#ifndef __pinocchio_python_utils_printable_hpp__
#define __pinocchio_python_utils_printable_hpp__

#include <boost/python.hpp>

namespace pinocchio
{
  namespace python
  {

    namespace bp = boost::python;

    template<class C>
    struct PrintableVisitor : public bp::def_visitor< PrintableVisitor<C> >
    {
      template<class PyClass>
      void visit(PyClass & cl) const
      {
        cl
        .def(bp::self_ns::str(bp::self_ns::self))
        .def(bp::self_ns::repr(bp::self_ns::self))
        ;
      }
    };
  } // namespace python
} // namespace pinocchio

#endif // ifndef __pinocchio_python_utils_printable_hpp__