HQPData.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018 CNRS, NYU, MPI Tübingen
3 //
4 // This file is part of tsid
5 // tsid is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 // tsid is distributed in the hope that it will be
10 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
11 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Lesser Public License for more details. You should have
13 // received a copy of the GNU Lesser General Public License along with
14 // tsid If not, see
15 // <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef __tsid_python_test_hpp__
19 #define __tsid_python_test_hpp__
20 
22 
24 
25 namespace tsid
26 {
27  namespace python
28  {
29  namespace bp = boost::python;
30 
31  template<typename T>
33  : public boost::python::def_visitor< ConstPythonVisitor<T> >
34  {
35  template<class PyClass>
36 
37  void visit(PyClass& cl) const
38  {
39  cl
40  .def(bp::init<>("Default Constructor"))
41  .def("print_all", &T::print)
42  .def("append", &T::append_eq, bp::arg("data"))
43  .def("append", &T::append_ineq, bp::arg("data"))
44  .def("append", &T::append_bound, bp::arg("data"))
45  ;
46  }
47 
48  static void expose(const std::string & class_name)
49  {
50  std::string doc = "ConstraintLevel info.";
51  bp::class_<T>(class_name.c_str(),
52  doc.c_str(),
53  bp::no_init)
54  .def(ConstPythonVisitor<T>());
55  }
56  };
57 
58  template<typename T>
60  : public boost::python::def_visitor< HQPPythonVisitor<T> >
61  {
62  template<class PyClass>
63 
64  void visit(PyClass& cl) const
65  {
66  cl
67  .def(bp::init<>("Default Constructor"))
68  .def("print_all", &T::print)
69  .def("resize", &T::resize, bp::arg("i"))
70  .def("append", &T::append_helper, bp::arg("constraintLevel"))
71  ;
72  }
73 
74  static void expose(const std::string & class_name)
75  {
76  std::string doc = "HQPdata info.";
77  bp::class_<T>(class_name.c_str(),
78  doc.c_str(),
79  bp::no_init)
80  .def(HQPPythonVisitor<T>());
81  }
82  };
83 
84  }
85 }
86 
87 
88 #endif // ifndef __tsid_python_test_hpp__
tsid::python::HQPPythonVisitor::expose
static void expose(const std::string &class_name)
Definition: HQPData.hpp:74
tsid::python::ConstPythonVisitor
Definition: HQPData.hpp:32
tsid::python::ConstPythonVisitor::visit
void visit(PyClass &cl) const
Definition: HQPData.hpp:37
tsid::python::HQPPythonVisitor::visit
void visit(PyClass &cl) const
Definition: HQPData.hpp:64
tsid::python::HQPPythonVisitor
Definition: HQPData.hpp:59
tsid
Definition: constraint-bound.hpp:26
container.hpp
fwd.hpp
tsid::python::ConstPythonVisitor::expose
static void expose(const std::string &class_name)
Definition: HQPData.hpp:48