Skip to content

Commit 171862b

Browse files
committed
Move TypeNameHelper to independant file.
1 parent f1b6da8 commit 171862b

File tree

2 files changed

+53
-23
lines changed

2 files changed

+53
-23
lines changed

src/matrix/operator.cpp

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* François Bleibel,
44
* Olivier Stasse,
55
* Nicolas Mansard
6+
* Joseph Mirabel
67
*
78
* CNRS/AIST
89
*
@@ -35,6 +36,8 @@
3536
#include <boost/numeric/conversion/cast.hpp>
3637
#include <deque>
3738

39+
#include "../tools/type-name-helper.hh"
40+
3841
namespace dg = ::dynamicgraph;
3942

4043
/* ---------------------------------------------------------------------------*/
@@ -43,27 +46,6 @@ namespace dg = ::dynamicgraph;
4346

4447
namespace dynamicgraph {
4548
namespace sot {
46-
template< typename TypeRef >
47-
struct TypeNameHelper
48-
{
49-
static const std::string typeName;
50-
};
51-
template< typename TypeRef >
52-
const std::string TypeNameHelper<TypeRef>::typeName = "unspecified";
53-
54-
#define ADD_KNOWN_TYPE( typeid ) \
55-
template<>const std::string TypeNameHelper<typeid>::typeName = #typeid
56-
57-
ADD_KNOWN_TYPE(bool);
58-
ADD_KNOWN_TYPE(double);
59-
ADD_KNOWN_TYPE(Vector);
60-
ADD_KNOWN_TYPE(Matrix);
61-
ADD_KNOWN_TYPE(MatrixRotation);
62-
ADD_KNOWN_TYPE(MatrixTwist);
63-
ADD_KNOWN_TYPE(MatrixHomogeneous);
64-
ADD_KNOWN_TYPE(VectorQuaternion);
65-
ADD_KNOWN_TYPE(VectorRollPitchYaw);
66-
6749
template< typename TypeIn, typename TypeOut >
6850
struct UnaryOpHeader
6951
{
@@ -81,8 +63,6 @@ namespace dynamicgraph {
8163
std::string ("\n");
8264
}
8365
};
84-
85-
8666
} /* namespace sot */
8767
} /* namespace dynamicgraph */
8868

src/tools/type-name-helper.hh

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* Copyright 2010,
3+
* François Bleibel,
4+
* Olivier Stasse,
5+
* Nicolas Mansard
6+
* Joseph Mirabel
7+
*
8+
* CNRS/AIST
9+
*
10+
* This file is part of sot-core.
11+
* sot-core is free software: you can redistribute it and/or
12+
* modify it under the terms of the GNU Lesser General Public License
13+
* as published by the Free Software Foundation, either version 3 of
14+
* the License, or (at your option) any later version.
15+
* sot-core is distributed in the hope that it will be
16+
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty
17+
* of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+
* GNU Lesser General Public License for more details. You should
19+
* have received a copy of the GNU Lesser General Public License along
20+
* with sot-core. If not, see <http://www.gnu.org/licenses/>.
21+
*/
22+
23+
#include <sot/core/matrix-geometry.hh>
24+
25+
namespace dynamicgraph {
26+
namespace sot {
27+
template< typename TypeRef >
28+
struct TypeNameHelper
29+
{
30+
static const std::string typeName;
31+
};
32+
template< typename TypeRef >
33+
const std::string TypeNameHelper<TypeRef>::typeName = "unspecified";
34+
35+
#define ADD_KNOWN_TYPE( typeid ) \
36+
template<>const std::string TypeNameHelper<typeid>::typeName = #typeid
37+
38+
ADD_KNOWN_TYPE(bool);
39+
ADD_KNOWN_TYPE(double);
40+
ADD_KNOWN_TYPE(Vector);
41+
ADD_KNOWN_TYPE(Matrix);
42+
ADD_KNOWN_TYPE(MatrixRotation);
43+
ADD_KNOWN_TYPE(MatrixTwist);
44+
ADD_KNOWN_TYPE(MatrixHomogeneous);
45+
ADD_KNOWN_TYPE(VectorQuaternion);
46+
ADD_KNOWN_TYPE(VectorRollPitchYaw);
47+
48+
#undef ADD_KNOWN_TYPE
49+
} /* namespace sot */
50+
} /* namespace dynamicgraph */

0 commit comments

Comments
 (0)