Fix documentation build under maverick (doxygen 1.7.1)
[senf.git] / senf / Utils / singleton.cti
1 // $Id$
2 //
3 // Copyright (C) 2007
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 //     Stefan Bund <g0dil@berlios.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 singleton inline template implementation */
25
26 //#include "singleton.ih"
27
28 // Custom includes
29
30 #define prefix_ inline
31 //-/////////////////////////////////////////////////////////////////////////////////////////////////
32
33 template <class Self>
34 prefix_ senf::singleton<Self>::singleton()
35 {
36     alive_ = true;
37 }
38
39 template <class Self>
40 prefix_ senf::singleton<Self>::~singleton()
41 {
42     alive_ = false;
43 }
44
45 template <class Self>
46 bool senf::singleton<Self>::alive_ (false);
47
48 template <class Self>
49 prefix_ Self & senf::singleton<Self>::instance()
50 {
51     static Self instance_;
52     // Force instantiation of force_creation (at static object creation time)
53     creator_.nop();
54     return instance_;
55 }
56
57 template <class Self>
58 prefix_ bool senf::singleton<Self>::alive()
59 {
60     return alive_;
61 }
62
63 template <class Self>
64 prefix_ senf::singleton<Self>::force_creation::force_creation()
65 {
66     // Force execution of instance() thereby creating instance
67     senf::singleton<Self>::instance();
68 }
69
70 template <class Self>
71 prefix_ void senf::singleton<Self>::force_creation::nop()
72     const
73 {
74     // No operation ...
75 }
76
77 template <class Self>
78 typename senf::singleton<Self>::force_creation senf::singleton<Self>::creator_;
79
80 //-/////////////////////////////////////////////////////////////////////////////////////////////////
81 #undef prefix_
82
83 \f
84 // Local Variables:
85 // mode: c++
86 // fill-column: 100
87 // c-file-style: "senf"
88 // indent-tabs-mode: nil
89 // ispell-local-dictionary: "american"
90 // compile-command: "scons -u test"
91 // comment-column: 40
92 // End: