Program listing for file kernel/src/utils/SiconosTools/TypeName.hpp#
Return to documentation for this file
1#ifndef TypeName_hpp
2#define TypeName_hpp
3
4#include "SiconosVisitor.hpp"
5#include <string>
6namespace Type
7{
8#undef REGISTER
9#define REGISTER(X) case Type:: X : r.reset(new std::string(#X)); break;
10
11#undef REGISTER_STRUCT
12#define REGISTER_STRUCT(X) REGISTER(X)
13#undef REGISTER_BASE
14#undef REGISTER_BASE_EXTERN
15#define REGISTER_BASE(X,Y) REGISTER(X)
16
17#define REGISTER_BASE_EXTERN(X,Y) REGISTER_BASE(X,Y)
18
19inline std::shared_ptr<std::string> str(const Siconos& X)
20{
21 std::shared_ptr<std::string> r;
22
23 switch (X)
24 {
25 SICONOS_VISITABLES()
26 default:
27 assert(0);
28 }
29
30 return(r);
31}
32
33
34template <class C>
35std::string name(const C& c)
36{
37 return *(Type::str(Type::value(c)));
38}
39
40}
41#endif