Add missing doxygen \file comments
[senf.git] / Utils / TypeIdValue.hh
1 // $Id$
2 //
3 // Copyright (C) 2006
4 // Fraunhofer Institut fuer offene Kommunikationssysteme (FOKUS)
5 // Kompetenzzentrum fuer Satelitenkommunikation (SatCom)
6 //     Stefan Bund <stefan.bund@fokus.fraunhofer.de>
7 //
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
22
23 /** \file
24     \brief TypeIdValue public header */
25
26 #ifndef HH_TypeIdValue_
27 #define HH_TypeIdValue_ 1
28
29 // Custom includes
30 #include <typeinfo>
31 #include <string>
32 #include <boost/scoped_ptr.hpp>
33 #include <boost/operators.hpp>
34
35 //#include "TypeIdValue.mpp"
36 ///////////////////////////////hh.p////////////////////////////////////////
37
38 namespace senf {
39
40
41     /** \brief Wrapper to use types as key's in a map
42       */
43     class TypeIdValue : public boost::totally_ordered<TypeIdValue>
44     {
45     public:
46         ///////////////////////////////////////////////////////////////////////////
47         ///\name Structors and default members
48         ///@{
49
50         // my default constructor
51         // my copy constructor
52         // my copy assignment
53         // default destructor
54         // no conversion constructors
55
56         TypeIdValue();
57         TypeIdValue(TypeIdValue const & other);
58         TypeIdValue const & operator=(TypeIdValue const & other);
59
60         ///@}
61         ///////////////////////////////////////////////////////////////////////////
62
63         bool operator==(TypeIdValue const & other) const;
64         bool operator<(TypeIdValue const & other) const;
65
66         std::string name() const;
67
68     protected:
69
70     private:
71         template <class Type> TypeIdValue(Type *);
72
73         struct Value {
74             virtual ~Value() {}
75             virtual std::type_info const & id() = 0;
76             virtual Value * clone() = 0;
77         };
78
79         template <class Type>
80         struct ValueImpl : public Value {
81             virtual std::type_info const & id();
82             virtual Value * clone();
83         };
84
85         boost::scoped_ptr<Value> value_;
86
87         template <class Type> friend TypeIdValue const typeIdValue();
88     };
89
90     TypeIdValue const typeIdValue();
91
92     template <class Type>
93     TypeIdValue const typeIdValue();
94
95 }
96
97 ///////////////////////////////hh.e////////////////////////////////////////
98 #include "TypeIdValue.cci"
99 //#include "TypeIdValue.ct"
100 #include "TypeIdValue.cti"
101 #endif
102
103 \f
104 // Local Variables:
105 // mode: c++
106 // fill-column: 100
107 // c-file-style: "senf"
108 // indent-tabs-mode: nil
109 // ispell-local-dictionary: "american"
110 // compile-command: "scons -u test"
111 // comment-column: 40
112 // End: