Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal API redesign #150

Draft
wants to merge 7 commits into
base: devel
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,42 @@ matrix:
- make
- make test

#
# G++ 8
#
- os: linux
env:
- TEST="G++ 8"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-8
- g++-8
script:
- cmake -DCMAKE_CXX_COMPILER="g++-8" -DBUILD_EXAMPLES=ON -DBUILD_TESTING=ON ..
- make
- make test

#
# G++ 9
#
- os: linux
env:
- TEST="G++ 9"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-9
- g++-9
script:
- cmake -DCMAKE_CXX_COMPILER="g++-9" -DBUILD_EXAMPLES=ON -DBUILD_TESTING=ON ..
- make
- make test

#
# Clang 3.8
#
Expand Down
2 changes: 0 additions & 2 deletions examples/se2_localization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@

#include "manif/SE2.h"

#include <Eigen/Dense>

#include <vector>

#include <iostream>
Expand Down
3 changes: 0 additions & 3 deletions examples/se2_sam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@
// manif
#include "manif/SE2.h"

// Eigen
#include <Eigen/Dense>

// Std
#include <vector>
#include <map>
Expand Down
2 changes: 0 additions & 2 deletions examples/se3_localization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@

#include "manif/SE3.h"

#include <Eigen/Dense>

#include <vector>

#include <iostream>
Expand Down
3 changes: 0 additions & 3 deletions examples/se3_sam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,6 @@
// manif
#include "manif/SE3.h"

// Eigen
#include <Eigen/Dense>

// Std
#include <vector>
#include <map>
Expand Down
3 changes: 0 additions & 3 deletions examples/se3_sam_selfcalib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,6 @@
// manif
#include "manif/SE3.h"

// Eigen
#include <Eigen/Dense>

// Std
#include <vector>
#include <map>
Expand Down
3 changes: 2 additions & 1 deletion external/lt/lt/optional.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ struct optional_copy_base<T, false> : optional_operations_base<T> {
using optional_operations_base<T>::optional_operations_base;

optional_copy_base() = default;
optional_copy_base(const optional_copy_base &rhs) {
optional_copy_base(const optional_copy_base &rhs)
: optional_operations_base<T>() {
if (rhs.has_value()) {
this->construct(rhs.get());
} else {
Expand Down
19 changes: 18 additions & 1 deletion include/manif/Rn.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@
#define _MANIF_RN_H_

#include "manif/impl/macro.h"
#include "manif/constants.h"
#include "manif/impl/utils.h"
#include "manif/impl/lie_group_base.h"

#include "manif/impl/traits.h"
#include "manif/impl/core/crtp.h"

#include "manif/impl/eigen.h"

#include "manif/impl/expr/expr.h"
#include "manif/impl/random.h"
#include "manif/impl/generator.h"
#include "manif/impl/assignment_assert.h"

#include "lt/optional.hpp"

#include "manif/impl/tangent_base.h"
#include "manif/impl/lie_group_base.h"

#include "manif/impl/rn/Rn_properties.h"
#include "manif/impl/rn/Rn_base.h"
#include "manif/impl/rn/RnTangent_base.h"
#include "manif/impl/rn/Rn.h"
#include "manif/impl/rn/Rn_expr.h"
#include "manif/impl/rn/RnTangent.h"
#include "manif/impl/rn/RnTangent_expr.h"

#include "manif/impl/rn/Rn_map.h"
#include "manif/impl/rn/RnTangent_map.h"

Expand Down
20 changes: 19 additions & 1 deletion include/manif/SE2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,32 @@
#define _MANIF_SE2_H_

#include "manif/impl/macro.h"
#include "manif/impl/lie_group_base.h"
#include "manif/constants.h"
#include "manif/impl/utils.h"

#include "manif/impl/traits.h"
#include "manif/impl/core/crtp.h"

#include "manif/impl/eigen.h"

#include "manif/impl/expr/expr.h"
#include "manif/impl/random.h"
#include "manif/impl/generator.h"
#include "manif/impl/assignment_assert.h"

#include "lt/optional.hpp"

#include "manif/impl/tangent_base.h"
#include "manif/impl/lie_group_base.h"

#include "manif/impl/se2/SE2_properties.h"
#include "manif/impl/se2/SE2_base.h"
#include "manif/impl/se2/SE2Tangent_base.h"
#include "manif/impl/se2/SE2.h"
#include "manif/impl/se2/SE2_expr.h"
#include "manif/impl/se2/SE2Tangent.h"
#include "manif/impl/se2/SE2Tangent_expr.h"

#include "manif/impl/se2/SE2_map.h"
#include "manif/impl/se2/SE2Tangent_map.h"

Expand Down
27 changes: 24 additions & 3 deletions include/manif/SE3.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
#ifndef _MANIF_SE3_H_
#define _MANIF_SE3_H_

#include "manif/impl/macro.h"
#include "manif/impl/lie_group_base.h"
#include "manif/impl/tangent_base.h"
// #include "manif/impl/macro.h"
// #include "manif/constants.h"
// #include "manif/impl/utils.h"
//
// #include "manif/impl/traits.h"
// #include "manif/impl/core/crtp.h"
//
// #include "manif/impl/eigen.h"
//
// #include "manif/impl/expr/expr.h"
// #include "manif/impl/random.h"
// #include "manif/impl/generator.h"
// #include "manif/impl/assignment_assert.h"
//
// #include "lt/optional.hpp"
//
// #include "manif/impl/tangent_base.h"
// #include "manif/impl/lie_group_base.h"

#include "manif/SO3.h"

#include "manif/impl/se3/SE3_utils.h"
#include "manif/impl/se3/SE3_properties.h"
#include "manif/impl/se3/SE3_base.h"
#include "manif/impl/se3/SE3Tangent_base.h"
#include "manif/impl/se3/SE3.h"
#include "manif/impl/se3/SE3_expr.h"
#include "manif/impl/se3/SE3Tangent.h"
#include "manif/impl/se3/SE3Tangent_expr.h"

#include "manif/impl/se3/SE3_map.h"
#include "manif/impl/se3/SE3Tangent_map.h"

Expand Down
19 changes: 18 additions & 1 deletion include/manif/SO2.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,32 @@
#define _MANIF_SO2_H_

#include "manif/impl/macro.h"
#include "manif/constants.h"
#include "manif/impl/utils.h"
#include "manif/impl/lie_group_base.h"

#include "manif/impl/traits.h"
#include "manif/impl/core/crtp.h"

#include "manif/impl/eigen.h"

#include "manif/impl/expr/expr.h"
#include "manif/impl/random.h"
#include "manif/impl/generator.h"
#include "manif/impl/assignment_assert.h"

#include "lt/optional.hpp"

#include "manif/impl/tangent_base.h"
#include "manif/impl/lie_group_base.h"

#include "manif/impl/so2/SO2_properties.h"
#include "manif/impl/so2/SO2_base.h"
#include "manif/impl/so2/SO2Tangent_base.h"
#include "manif/impl/so2/SO2.h"
#include "manif/impl/so2/SO2_expr.h"
#include "manif/impl/so2/SO2Tangent.h"
#include "manif/impl/so2/SO2Tangent_expr.h"

#include "manif/impl/so2/SO2_map.h"
#include "manif/impl/so2/SO2Tangent_map.h"

Expand Down
20 changes: 19 additions & 1 deletion include/manif/SO3.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,32 @@
#define _MANIF_SO3_H_

#include "manif/impl/macro.h"
#include "manif/impl/lie_group_base.h"
#include "manif/constants.h"
#include "manif/impl/utils.h"

#include "manif/impl/traits.h"
#include "manif/impl/core/crtp.h"

#include "manif/impl/eigen.h"

#include "manif/impl/expr/expr.h"
#include "manif/impl/random.h"
#include "manif/impl/generator.h"
#include "manif/impl/assignment_assert.h"

#include "lt/optional.hpp"

#include "manif/impl/tangent_base.h"
#include "manif/impl/lie_group_base.h"

#include "manif/impl/so3/SO3_properties.h"
#include "manif/impl/so3/SO3_base.h"
#include "manif/impl/so3/SO3Tangent_base.h"
#include "manif/impl/so3/SO3.h"
#include "manif/impl/so3/SO3_expr.h"
#include "manif/impl/so3/SO3Tangent.h"
#include "manif/impl/so3/SO3Tangent_expr.h"

#include "manif/impl/so3/SO3_map.h"
#include "manif/impl/so3/SO3Tangent_map.h"

Expand Down
24 changes: 24 additions & 0 deletions include/manif/impl/assignment_assert.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#ifndef _MANIF_MANIF_IMPL_ASSIGNMENT_ASSERT_H_
#define _MANIF_MANIF_IMPL_ASSIGNMENT_ASSERT_H_

namespace manif {
namespace internal {

template <typename Derived>
struct AssignmentEvaluatorImpl
{
template <typename T> static void run_impl(const T&) { }
};

template <typename Derived>
struct AssignmentEvaluator : AssignmentEvaluatorImpl<Derived>
{
using Base = AssignmentEvaluatorImpl<Derived>;

template <typename T> void run(T&& t) { Base::run_impl(std::forward<T>(t)); }
};

} // namespace internal
} // namespace manif

#endif // _MANIF_MANIF_IMPL_ASSIGNMENT_ASSERT_H_
28 changes: 28 additions & 0 deletions include/manif/impl/core/crtp.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef _MANIF_MANIF_IMPL_CRTP_H_
#define _MANIF_MANIF_IMPL_CRTP_H_

namespace manif {
namespace internal {

template <typename Derived>
struct crtp
{
protected:
/** Return reference to this as derived object */
inline Derived &derived() & noexcept {
return *static_cast<Derived *>(this);
}
/** Return reference to this as derived object */
inline const Derived &derived() const & noexcept {
return *static_cast<Derived const *>(this);
}
/** Return reference to this as derived object, when this is rvalue */
inline Derived &&derived() && noexcept {
return std::move(*static_cast<Derived *>(this));
}
};

} // namespace internal
} // namespace manif

#endif // _MANIF_MANIF_IMPL_CRTP_H_
33 changes: 33 additions & 0 deletions include/manif/impl/core/storage.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#ifndef _MANIF_MANIF_IMPL_CORE_UNARY_STORAGE_H_
#define _MANIF_MANIF_IMPL_CORE_UNARY_STORAGE_H_

namespace manif {
namespace internal {

template <typename T>
struct storage_selector {
using type = T;
};

template <typename T>
struct storage_selector<T&> {
using type = T&;
};

template <typename T>
struct storage_selector<const T&> {
using type = const T&;
};

template <typename T>
struct storage_selector<T&&> {
using type = T;
};

template <typename T>
using storage_t = typename storage_selector<T>::type;

} // namespace internal
} // namespace manif

#endif // _MANIF_MANIF_IMPL_CORE_UNARY_STORAGE_H_
Loading