conversions.h
Go to the documentation of this file.
1#pragma once
2
3#include <memory>
4#include <optional>
5#include <ostream>
6
7#include <Eigen/Core>
8
10
11namespace armarx::core::eigen
12{
13 // optional
14 template <class EigenT, int rows, int cols>
15 std::optional<Eigen::Matrix<EigenT, rows, cols, Eigen::ColMajor>>&
18 {
20 if (rh.has_value())
21 {
22 lh.emplace(rh.value());
23 }
24 else
25 {
26 lh = std::nullopt;
27 }
28 return lh;
29 }
30
31 template <class EigenT, int rows, int cols>
32 std::optional<Eigen::Matrix<EigenT, rows, cols, Eigen::RowMajor>>&
35 {
37 if (rh.has_value())
38 {
39 lh.emplace(rh.value());
40 }
41 else
42 {
43 lh = std::nullopt;
44 }
45 return lh;
46 }
47
48 // shared_ptr
49 template <class EigenT, int rows, int cols>
50 std::shared_ptr<Eigen::Matrix<EigenT, rows, cols, Eigen::ColMajor>>&
53 {
55 if (rh)
56 {
57 lh = std::make_shared<Eigen::Matrix<EigenT, rows, cols, Eigen::ColMajor>>(*rh);
58 }
59 else
60 {
61 lh = nullptr;
62 }
63 return lh;
64 }
65
66 template <class EigenT, int rows, int cols>
67 std::shared_ptr<Eigen::Matrix<EigenT, rows, cols, Eigen::RowMajor>>&
70 {
72 if (rh)
73 {
74 lh = std::make_shared<Eigen::Matrix<EigenT, rows, cols, Eigen::RowMajor>>(*rh);
75 }
76 else
77 {
78 lh = nullptr;
79 }
80 return lh;
81 }
82} // namespace armarx::core::eigen
83
84namespace armarx
85{
87}
std::optional< Eigen::Matrix< EigenT, rows, cols, Eigen::ColMajor > > & assign(std::optional< Eigen::Matrix< EigenT, rows, cols, Eigen::ColMajor > > &lh, const std::optional< Eigen::Matrix< EigenT, rows, cols, Eigen::RowMajor > > &rh)
Definition conversions.h:16
This file offers overloads of toIce() and fromIce() functions for STL container types.
#define ARMARX_TRACE
Definition trace.h:77