fw4spl
TypeInfo.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2017.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWTOOLS_TYPEINFO_HPP__
8 #define __FWTOOLS_TYPEINFO_HPP__
9 
10 #include "fwTools/config.hpp"
11 
12 #include <typeinfo>
13 
14 namespace fwTools
15 {
22 class FWTOOLS_CLASS_API TypeInfo
23 {
24 public:
25 
27  FWTOOLS_API TypeInfo(); // needed for containers
28 
30  FWTOOLS_API TypeInfo(const std::type_info&); // non-explicit
31 
37  FWTOOLS_API TypeInfo& operator=(const TypeInfo& ti);
38 
43  FWTOOLS_API const std::type_info& type_info() const;
44 
49  FWTOOLS_API operator const std::type_info&() const
50  {
51  return *pInfo_;
52  }
53 
54  // Compatibility functions
59  FWTOOLS_API bool before(const TypeInfo& rhs) const;
60 
65  FWTOOLS_API const char* name() const;
66 
67 private:
68 
70  const std::type_info* pInfo_;
71 };
72 
73 // COMPARISON OPERATOR
78 FWTOOLS_API bool operator==(const TypeInfo& lhs, const TypeInfo& rhs);
79 FWTOOLS_API bool operator<(const TypeInfo& lhs, const TypeInfo& rhs);
80 FWTOOLS_API bool operator!=(const TypeInfo& lhs, const TypeInfo& rhs);
81 FWTOOLS_API bool operator>(const TypeInfo& lhs, const TypeInfo& rhs);
82 FWTOOLS_API bool operator<=(const TypeInfo& lhs, const TypeInfo& rhs);
83 FWTOOLS_API bool operator>=(const TypeInfo& lhs, const TypeInfo& rhs);
85 
86 }
87 
88 #endif /* __FWTOOLS_TYPEINFO_HPP__ */
Purpose: offer a first-class, comparable wrapper over std::type_info ( but copy construcible ) ...
Definition: TypeInfo.hpp:22
The namespace fwTools contains several tools like UUID, factory, dispatche, stringizer, macros, helper.