include
eigenpy
copyable.hpp
Go to the documentation of this file.
1
//
2
// Copyright (c) 2016-2023 CNRS INRIA
3
// Copyright (c) 2023 Heriot-Watt University
4
//
5
6
#ifndef __eigenpy_utils_copyable_hpp__
7
#define __eigenpy_utils_copyable_hpp__
8
9
#include <boost/python.hpp>
10
11
namespace
eigenpy
{
12
17
template
<
class
C>
18
struct
CopyableVisitor
:
public
bp::def_visitor<CopyableVisitor<C> > {
19
template
<
class
PyClass>
20
void
visit
(PyClass& cl)
const
{
21
cl.def(
"copy"
, &
copy
, bp::arg(
"self"
),
"Returns a copy of *this."
);
22
cl.def(
"__copy__"
, &
copy
, bp::arg(
"self"
),
"Returns a copy of *this."
);
23
cl.def(
"__deepcopy__"
, &
deepcopy
, bp::args(
"self"
,
"memo"
),
24
"Returns a deep copy of *this."
);
25
}
26
27
private
:
28
static
C
copy
(
const
C&
self
) {
return
C(
self
); }
29
static
C
deepcopy
(
const
C&
self
, bp::dict) {
return
C(
self
); }
30
};
31
}
// namespace eigenpy
32
33
#endif // ifndef __eigenpy_utils_copyable_hpp__
eigenpy::CopyableVisitor
Add the Python method copy to allow a copy of this by calling the copy constructor.
Definition:
copyable.hpp:18
eigenpy::CopyableVisitor::deepcopy
static C deepcopy(const C &self, bp::dict)
Definition:
copyable.hpp:29
eigenpy::CopyableVisitor::copy
static C copy(const C &self)
Definition:
copyable.hpp:28
eigenpy::CopyableVisitor::visit
void visit(PyClass &cl) const
Definition:
copyable.hpp:20
eigenpy
Definition:
alignment.hpp:14
eigenpy
Author(s): Justin Carpentier, Nicolas Mansard
autogenerated on Sat Nov 2 2024 02:14:45