Main MRPT website > C++ reference for MRPT 1.4.0
TTypeName_impl.h
Go to the documentation of this file.
1/* +---------------------------------------------------------------------------+
2 | Mobile Robot Programming Toolkit (MRPT) |
3 | http://www.mrpt.org/ |
4 | |
5 | Copyright (c) 2005-2016, Individual contributors, see AUTHORS file |
6 | See: http://www.mrpt.org/Authors - All rights reserved. |
7 | Released under BSD License. See details in http://www.mrpt.org/License |
8 +---------------------------------------------------------------------------+ */
9#ifndef TTYPENAME_IMPL_H
10#define TTYPENAME_IMPL_H
11
13#include <list>
14#include <vector>
15#include <deque>
16#include <set>
17#include <map>
18
19// This file extends TTypeName.h for STL C++ types.
20
21namespace mrpt
22{
23 namespace utils
24 {
25 /** @name Conversion of type to string at compile time
26 @{ */
27
28 MRPT_DECLARE_TTYPENAME(std::string)
29
30 #define MRPT_DECLARE_TTYPENAME_CONTAINER(_CONTAINER) \
31 template< typename V > \
32 struct TTypeName <_CONTAINER<V> > { \
33 static std::string get() { \
34 return std::string( #_CONTAINER )+std::string("<")+std::string( TTypeName<V>::get() ) + std::string(">"); \
35 } \
36 };
37
42
43 #define MRPT_DECLARE_TTYPENAME_CONTAINER_ASSOC(_CONTAINER) \
44 template< typename K, typename V > \
45 struct TTypeName <_CONTAINER<K,V> > { \
46 static std::string get() { \
47 return std::string( #_CONTAINER )+std::string("<")+std::string( TTypeName<K>::get() )+ std::string(",")+std::string( TTypeName<V>::get() )+std::string(">"); \
48 } \
49 };
50
53
54
55 template< typename T1, typename T2 >
56 struct TTypeName <std::pair<T1,T2> > {
57 static std::string get() {
58 return std::string("std::pair<")+std::string( TTypeName<T1>::get() )+ std::string(",")+std::string( TTypeName<T2>::get() )+std::string(">");
59 }
60 };
61
62 /** @} */
63
64 } // End of namespace
65} // End of namespace
66
67#endif
#define MRPT_DECLARE_TTYPENAME(_TYPE)
Definition: TTypeName.h:60
#define MRPT_DECLARE_TTYPENAME_CONTAINER(_CONTAINER)
#define MRPT_DECLARE_TTYPENAME_CONTAINER_ASSOC(_CONTAINER)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
STL namespace.
A template to obtain the type of its argument as a string at compile time.
Definition: TTypeName.h:48



Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Tue Dec 27 00:53:09 UTC 2022