Skip to content

Commit ec232e7

Browse files
authored
Merge pull request #217 from jcarpent/devel
Move EIGENPY_MAKE_TYPEDEFS to a dedicated file
2 parents 8a2a206 + 25b789f commit ec232e7

File tree

3 files changed

+35
-23
lines changed

3 files changed

+35
-23
lines changed

CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ SET(${PROJECT_NAME}_HEADERS
113113
include/eigenpy/eigen-allocator.hpp
114114
include/eigenpy/eigen-to-python.hpp
115115
include/eigenpy/eigen-from-python.hpp
116+
include/eigenpy/eigen-typedef.hpp
116117
include/eigenpy/numpy-map.hpp
117118
include/eigenpy/geometry.hpp
118119
include/eigenpy/geometry-conversion.hpp

include/eigenpy/eigen-typedef.hpp

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
//
2+
// Copyright (c) 2020 INRIA
3+
//
4+
5+
#ifndef __eigenpy_eigen_typedef_hpp__
6+
#define __eigenpy_eigen_typedef_hpp__
7+
8+
#include "eigenpy/fwd.hpp"
9+
10+
#define EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, Size, SizeSuffix) \
11+
/** \ingroup matrixtypedefs */ \
12+
typedef Eigen::Matrix<Type, Size, Size, Options> Matrix##SizeSuffix##TypeSuffix; \
13+
/** \ingroup matrixtypedefs */ \
14+
typedef Eigen::Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; \
15+
/** \ingroup matrixtypedefs */ \
16+
typedef Eigen::Matrix<Type, 1, Size> RowVector##SizeSuffix##TypeSuffix;
17+
18+
#define EIGENPY_MAKE_FIXED_TYPEDEFS(Type, Options, TypeSuffix, Size) \
19+
/** \ingroup matrixtypedefs */ \
20+
typedef Eigen::Matrix<Type, Size, Eigen::Dynamic, Options> Matrix##Size##X##TypeSuffix; \
21+
/** \ingroup matrixtypedefs */ \
22+
typedef Eigen::Matrix<Type, Eigen::Dynamic, Size, Options> Matrix##X##Size##TypeSuffix;
23+
24+
#define EIGENPY_MAKE_TYPEDEFS_ALL_SIZES(Type, Options, TypeSuffix) \
25+
EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, 2, 2) \
26+
EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, 3, 3) \
27+
EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, 4, 4) \
28+
EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, Eigen::Dynamic, X) \
29+
EIGENPY_MAKE_FIXED_TYPEDEFS(Type, Options, TypeSuffix, 2) \
30+
EIGENPY_MAKE_FIXED_TYPEDEFS(Type, Options, TypeSuffix, 3) \
31+
EIGENPY_MAKE_FIXED_TYPEDEFS(Type, Options, TypeSuffix, 4)
32+
33+
#endif // ifndef __eigenpy_eigen_typedef_hpp__

include/eigenpy/eigenpy.hpp

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,11 @@
99
#include "eigenpy/fwd.hpp"
1010
#include "eigenpy/deprecated.hpp"
1111
#include "eigenpy/config.hpp"
12+
#include "eigenpy/eigen-typedef.hpp"
1213

1314
#define ENABLE_SPECIFIC_MATRIX_TYPE(TYPE) \
1415
::eigenpy::enableEigenPySpecific<TYPE>();
1516

16-
#define EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, Size, SizeSuffix) \
17-
/** \ingroup matrixtypedefs */ \
18-
typedef Eigen::Matrix<Type, Size, Size, Options> Matrix##SizeSuffix##TypeSuffix; \
19-
/** \ingroup matrixtypedefs */ \
20-
typedef Eigen::Matrix<Type, Size, 1> Vector##SizeSuffix##TypeSuffix; \
21-
/** \ingroup matrixtypedefs */ \
22-
typedef Eigen::Matrix<Type, 1, Size> RowVector##SizeSuffix##TypeSuffix;
23-
24-
#define EIGENPY_MAKE_FIXED_TYPEDEFS(Type, Options, TypeSuffix, Size) \
25-
/** \ingroup matrixtypedefs */ \
26-
typedef Eigen::Matrix<Type, Size, Eigen::Dynamic, Options> Matrix##Size##X##TypeSuffix; \
27-
/** \ingroup matrixtypedefs */ \
28-
typedef Eigen::Matrix<Type, Eigen::Dynamic, Size, Options> Matrix##X##Size##TypeSuffix;
29-
30-
#define EIGENPY_MAKE_TYPEDEFS_ALL_SIZES(Type, Options, TypeSuffix) \
31-
EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, 2, 2) \
32-
EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, 3, 3) \
33-
EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, 4, 4) \
34-
EIGENPY_MAKE_TYPEDEFS(Type, Options, TypeSuffix, Eigen::Dynamic, X) \
35-
EIGENPY_MAKE_FIXED_TYPEDEFS(Type, Options, TypeSuffix, 2) \
36-
EIGENPY_MAKE_FIXED_TYPEDEFS(Type, Options, TypeSuffix, 3) \
37-
EIGENPY_MAKE_FIXED_TYPEDEFS(Type, Options, TypeSuffix, 4)
38-
3917
namespace eigenpy
4018
{
4119

0 commit comments

Comments
 (0)