switch to new MPL based Fraunhofer FOKUS Public License
[senf.git] / senf / Utils / StatisticsTargets.hh
1 // $Id$
2 //
3 // Copyright (C) 2009
4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 //
6 // The contents of this file are subject to the Fraunhofer FOKUS Public License
7 // Version 1.0 (the "License"); you may not use this file except in compliance
8 // with the License. You may obtain a copy of the License at 
9 // http://senf.berlios.de/license.html
10 //
11 // The Fraunhofer FOKUS Public License Version 1.0 is based on, 
12 // but modifies the Mozilla Public License Version 1.1.
13 // See the full license text for the amendments.
14 //
15 // Software distributed under the License is distributed on an "AS IS" basis, 
16 // WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
17 // for the specific language governing rights and limitations under the License.
18 //
19 // The Original Code is Fraunhofer FOKUS code.
20 //
21 // The Initial Developer of the Original Code is Fraunhofer-Gesellschaft e.V. 
22 // (registered association), Hansastraße 27 c, 80686 Munich, Germany.
23 // All Rights Reserved.
24 //
25 // Contributor(s):
26 //   Stefan Bund <g0dil@berlios.de>
27
28 /** \file
29     \brief StatisticsTargets public header */
30
31 #ifndef HH_SENF_PPI_Utils_StatisticsTargets_
32 #define HH_SENF_PPI_Utils_StatisticsTargets_ 1
33
34 // Custom includes
35 #include <string>
36 #include <senf/Utils/Logger/Logger.hh>
37
38 //#include "StatisticsTargets.mpp"
39 #include "StatisticsTargets.ih"
40 //-/////////////////////////////////////////////////////////////////////////////////////////////////
41
42 namespace senf {
43
44 #ifdef DOXYGEN
45     /** \brief Logging stream for statistics messages
46         \ingroup senf_statistics
47      */
48     typedef unspecified StatisticsStream;
49 #else
50     SENF_LOG_DEFINE_STREAM(StatisticsStream,
51                            senf::log::MESSAGE, senf::log::MESSAGE, senf::log::MESSAGE);
52 #endif
53
54 #ifdef DOXYGEN
55
56     /** \brief Send statistics to SENF log
57
58         This statistics target will send all statistics values to the SENF log. The template
59         parameters optionally specify the stream, area and/or level to send the messages to. An
60         optional \a label string may be specified which will be added as prefix to all log entries.
61
62         The log stream defaults to senf::StatisticsStream, the level defaults to
63         senf::log::MESSAGE and the area defaults to senf::log::DefaultArea.
64
65         \code
66         // Connect with default parameters
67         stats.output(2u).connect()
68
69         // Send statistics messages to the debug stream at default level (MESSAGE)
70         // Place them in the MyStatistics area. Add 'stat1' prefix to each log message
71         SENF_LOG_DEF_AREA(MyStatistics);
72         stats.output(2u).connect<senf::log::Debug, MyStatistics>("stat1");
73         \endcode
74
75         \ingroup senf_statistics
76      */
77     template <class A1=void, class A2=void, class A3=void>
78     std::auto_ptr< unspecified > StatisticsLogger(std::string const & label="")
79
80 #else
81
82     std::auto_ptr< detail::StatisticsLogger<void,void,void> > StatisticsLogger(
83         std::string const & label="");
84
85     template <class Stream>
86     std::auto_ptr< detail::StatisticsLogger<Stream,void,void> > StatisticsLogger(
87         std::string const & label="");
88
89     template <class Stream, class Area>
90     std::auto_ptr< detail::StatisticsLogger<Stream,Area,void> > StatisticsLogger(
91         std::string const & label="");
92
93     template <class Stream, class Area, class Level>
94     std::auto_ptr< detail::StatisticsLogger<Stream,Area,Level> > StatisticsLogger(
95         std::string const & label="");
96
97 #endif
98
99 }
100
101 //-/////////////////////////////////////////////////////////////////////////////////////////////////
102 #include "StatisticsTargets.cci"
103 #include "StatisticsTargets.ct"
104 #include "StatisticsTargets.cti"
105 #endif
106
107 \f
108 // Local Variables:
109 // mode: c++
110 // fill-column: 100
111 // comment-column: 40
112 // c-file-style: "senf"
113 // indent-tabs-mode: nil
114 // ispell-local-dictionary: "american"
115 // compile-command: "scons -u test"
116 // End: