Directory: | ./ |
---|---|
File: | python/ndcurves/archive_python_binding.h |
Date: | 2025-03-05 17:18:30 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 8 | 8 | 100.0% |
Branches: | 11 | 22 | 50.0% |
Line | Branch | Exec | Source |
---|---|---|---|
1 | // Copyright (c) 2015-2018, CNRS | ||
2 | // Authors: Justin Carpentier <jcarpent@laas.fr> | ||
3 | |||
4 | #ifndef __curves_python_serialization_archive_hpp__ | ||
5 | #define __curves_python_serialization_archive_hpp__ | ||
6 | |||
7 | #include <boost/python.hpp> | ||
8 | |||
9 | namespace ndcurves { | ||
10 | namespace bp = boost::python; | ||
11 | template <typename Derived> | ||
12 | struct SerializableVisitor | ||
13 | : public boost::python::def_visitor<SerializableVisitor<Derived> > { | ||
14 | template <class PyClass> | ||
15 | 240 | void visit(PyClass& cl) const { | |
16 | 240 | cl.def("saveAsText", &Derived::template saveAsText<Derived>, | |
17 | bp::args("self", "filename"), "Saves *this inside a text file.") | ||
18 |
2/4✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 120 times.
✗ Branch 5 not taken.
|
480 | .def("loadFromText", &Derived::template loadFromText<Derived>, |
19 | bp::args("self", "filename"), "Loads *this from a text file.") | ||
20 |
2/4✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 120 times.
✗ Branch 5 not taken.
|
480 | .def("saveAsXML", &Derived::template saveAsXML<Derived>, |
21 | bp::args("self", "filename", "tag_name"), | ||
22 | "Saves *this inside a XML file.") | ||
23 |
2/4✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 120 times.
✗ Branch 5 not taken.
|
480 | .def("loadFromXML", &Derived::template loadFromXML<Derived>, |
24 | bp::args("self", "filename", "tag_name"), | ||
25 | "Loads *this from a XML file.") | ||
26 |
2/4✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 120 times.
✗ Branch 5 not taken.
|
480 | .def("saveAsBinary", &Derived::template saveAsBinary<Derived>, |
27 | bp::args("self", "filename"), "Saves *this inside a binary file.") | ||
28 |
3/6✓ Branch 1 taken 120 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 120 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 120 times.
✗ Branch 8 not taken.
|
240 | .def("loadFromBinary", &Derived::template loadFromBinary<Derived>, |
29 | bp::args("self", "filename"), "Loads *this from a binary file."); | ||
30 | 240 | } | |
31 | }; | ||
32 | } // namespace ndcurves | ||
33 | |||
34 | #endif // ifndef __multicontact_api_python_serialization_archive_hpp__ | ||
35 |