ATLAS Offline Software
AthenaKernel/AthenaKernel/ClassName.icc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: ClassName.icc,v 1.1 2009-01-15 19:07:29 binet Exp $
6 /**
7  * @file AthenaKernel/ClassName.icc
8  * @author scott snyder
9  * @date Jul 2005
10  * @brief An interface for getting the name of a class as a string.
11  * Implementation file.
12  */
13 
14 
15 #include "GaudiKernel/System.h"
16 
17 
18 /**
19  * @brief Return the name of class @c T as a string.
20  */
21 template <class T>
22 std::string ClassName<T>::name()
23 {
24  return System::typeinfoName (typeid (T));
25 }
26 
27 // /**
28 // * @brief Specialization of @c ClassName for @c std::vector.
29 // *
30 // * This overrides the default implementation of @c ClassName
31 // * to hide @c std::vector's second template parameter.
32 // */
33 // #include <vector>
34 // template <class T>
35 // std::string ClassName<std::vector<T> >::name()
36 // {
37 // std::string out = "std::vector<";
38 // out += ClassName<T>::name();
39 // if (out[out.size()-1] == '>')
40 // out += ' ';
41 // out += '>';
42 // return out;
43 // }
44 
45 // /**
46 // * @brief Specialization of @c ClassName for @c std::list.
47 // *
48 // * This overrides the default implementation of @c ClassName
49 // * to hide @c std::list's second template parameter.
50 // */
51 // #include <list>
52 // template <class T>
53 // std::string ClassName<std::list<T> >::name()
54 // {
55 // std::string out = "std::list<";
56 // out += ClassName<T>::name();
57 // if (out[out.size()-1] == '>')
58 // out += ' ';
59 // out += '>';
60 // return out;
61 // }
62 
63 // /**
64 // * @brief Specialization of @c ClassName for @c std::map.
65 // *
66 // * This overrides the default implementation of @c ClassName
67 // * to hide @c std::map's 4th template parameter (and optionally the 3rd too)
68 // */
69 // #include <map>
70 // template <class K, class V, class C>
71 // std::string ClassName<std::map<K, V, C> >::name()
72 // {
73 // std::string out = "std::map<";
74 // out += ClassName<K>::name()+ "," + ClassName<V>::name();
75 // std::string comp = ClassName<C>::name();
76 // if (comp.size() > 10 && comp.substr(0, 10) != "std::less<") {
77 // out += ","+ClassName<C>::name();
78 // }
79 // if (out[out.size()-1] == '>')
80 // out += ' ';
81 // out += '>';
82 // return out;
83 // }
84 
85