TypeIdValue.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
6 //
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
11 //
12 
13 
17 #ifndef HH_SENF_Utils_TypeIdValue_
18 #define HH_SENF_Utils_TypeIdValue_ 1
19 
20 // Custom includes
21 #include <typeinfo>
22 #include <string>
23 #include <boost/scoped_ptr.hpp>
24 #include <boost/operators.hpp>
25 
26 //#include "TypeIdValue.mpp"
27 //-/////////////////////////////////////////////////////////////////////////////////////////////////
28 
29 namespace senf {
30 
31 
34  class TypeIdValue : public boost::totally_ordered<TypeIdValue>
35  {
36  public:
37  //-////////////////////////////////////////////////////////////////////////
39  //\{
40 
41  // my default constructor
42  // my copy constructor
43  // my copy assignment
44  // default destructor
45  // no conversion constructors
46 
47  TypeIdValue();
48  TypeIdValue(std::type_info const & v);
49 
50  //\}
51  //-////////////////////////////////////////////////////////////////////////
52 
53  bool operator==(TypeIdValue const & other) const;
54  bool operator<(TypeIdValue const & other) const;
55 
56  std::string name() const;
57  std::string prettyName() const;
58 
59  std::type_info const & id() const;
60 
61  protected:
62 
63  private:
64  std::type_info const * p_;
65  };
66 
70  TypeIdValue const typeIdValue();
71 
75  template <class Type>
76  TypeIdValue const typeIdValue();
77 
81  template <class Type>
82  TypeIdValue const typeIdValue(Type const & ob);
83 
87  std::ostream & operator<<(std::ostream & os, TypeIdValue const & v);
88 }
89 
90 //-/////////////////////////////////////////////////////////////////////////////////////////////////
91 #include "TypeIdValue.cci"
92 //#include "TypeIdValue.ct"
93 #include "TypeIdValue.cti"
94 #endif
95 
96 
97 // Local Variables:
98 // mode: c++
99 // fill-column: 100
100 // c-file-style: "senf"
101 // indent-tabs-mode: nil
102 // ispell-local-dictionary: "american"
103 // compile-command: "scons -u test"
104 // comment-column: 40
105 // End:
std::string prettyName() const
std::type_info const & id() const
std::ostream & operator<<(std::ostream &os, TypeIdValue const &v)
Wrapper to use types as key&#39;s in a map.
Definition: TypeIdValue.hh:34
std::string name() const
bool operator==(TypeIdValue const &other) const
TypeIdValue const typeIdValue()
bool operator<(TypeIdValue const &other) const