Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / log / doc / html / boost / log / attributes / counter.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Class template counter</title>
5 <link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../../index.html" title="Chapter&#160;1.&#160;Boost.Log v2">
8 <link rel="up" href="../../../attributes.html#header.boost.log.attributes.counter_hpp" title="Header &lt;boost/log/attributes/counter.hpp&gt;">
9 <link rel="prev" href="make_constant.html" title="Function template make_constant">
10 <link rel="next" href="counter/impl.html" title="Class impl">
11 </head>
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td></tr></table>
14 <hr>
15 <div class="spirit-nav">
16 <a accesskey="p" href="make_constant.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../attributes.html#header.boost.log.attributes.counter_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="counter/impl.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
17 </div>
18 <div class="refentry">
19 <a name="boost.log.attributes.counter"></a><div class="titlepage"></div>
20 <div class="refnamediv">
21 <h2><span class="refentrytitle">Class template counter</span></h2>
22 <p>boost::log::attributes::counter &#8212; A class of an attribute that counts an integral value. </p>
23 </div>
24 <h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
25 <div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="comment">// In header: &lt;<a class="link" href="../../../attributes.html#header.boost.log.attributes.counter_hpp" title="Header &lt;boost/log/attributes/counter.hpp&gt;">boost/log/attributes/counter.hpp</a>&gt;
26
27 </span><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">&gt;</span> 
28 <span class="keyword">class</span> <a class="link" href="counter.html" title="Class template counter">counter</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">attribute</span> <span class="special">{</span>
29 <span class="keyword">public</span><span class="special">:</span>
30   <span class="comment">// types</span>
31   <span class="keyword">typedef</span> <span class="identifier">T</span> <a name="boost.log.attributes.counter.value_type"></a><span class="identifier">value_type</span><span class="special">;</span>  <span class="comment">// A counter value type. </span>
32
33   <span class="comment">// member classes/structs/unions</span>
34
35   <span class="comment">// Factory implementation.</span>
36
37   <span class="keyword">class</span> <a class="link" href="counter/impl.html" title="Class impl">impl</a> <span class="special">:</span> <span class="keyword">public</span> <span class="identifier">attribute</span><span class="special">::</span><span class="identifier">impl</span> <span class="special">{</span>
38   <span class="keyword">public</span><span class="special">:</span>
39     <span class="comment">// <a class="link" href="counter/impl.html#boost.log.attributes.counter.implconstruct-copy-destruct">construct/copy/destruct</a></span>
40     <a class="link" href="counter/impl.html#idp61944960-bb"><span class="identifier">impl</span></a><span class="special">(</span><span class="identifier">value_type</span><span class="special">,</span> <span class="identifier">value_type</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
41
42     <span class="comment">// <a class="link" href="counter/impl.html#idp61942064-bb">public member functions</a></span>
43     <span class="keyword">virtual</span> <a class="link" href="../attribute_value.html" title="Class attribute_value">attribute_value</a> <a class="link" href="counter/impl.html#idp61942624-bb"><span class="identifier">get_value</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
44   <span class="special">}</span><span class="special">;</span>
45
46   <span class="comment">// <a class="link" href="counter.html#boost.log.attributes.counterconstruct-copy-destruct">construct/copy/destruct</a></span>
47   <span class="keyword">explicit</span> <a class="link" href="counter.html#idp61948752-bb"><span class="identifier">counter</span></a><span class="special">(</span><span class="identifier">value_type</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">value_type</span><span class="special">)</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">value_type</span> <span class="special">=</span> <span class="special">(</span><span class="identifier">value_type</span><span class="special">)</span> <span class="number">1</span><span class="special">)</span><span class="special">;</span>
48   <span class="keyword">explicit</span> <a class="link" href="counter.html#idp61952928-bb"><span class="identifier">counter</span></a><span class="special">(</span><a class="link" href="cast_source.html" title="Class cast_source">cast_source</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
49 <span class="special">}</span><span class="special">;</span></pre></div>
50 <div class="refsect1">
51 <a name="idp106371440"></a><h2>Description</h2>
52 <p>This attribute acts as a counter - it returns a monotonously changing value each time requested. The attribute value type can be specified as a template parameter. The type must be an integral type. </p>
53 <div class="refsect2">
54 <a name="idp106372320"></a><h3>
55 <a name="boost.log.attributes.counterconstruct-copy-destruct"></a><code class="computeroutput">counter</code> 
56         public
57        construct/copy/destruct</h3>
58 <div class="orderedlist"><ol class="orderedlist" type="1">
59 <li class="listitem">
60 <pre class="literallayout"><span class="keyword">explicit</span> <a name="idp61948752-bb"></a><span class="identifier">counter</span><span class="special">(</span><span class="identifier">value_type</span> initial <span class="special">=</span> <span class="special">(</span><span class="identifier">value_type</span><span class="special">)</span> <span class="number">0</span><span class="special">,</span> 
61                  <span class="identifier">value_type</span> step <span class="special">=</span> <span class="special">(</span><span class="identifier">value_type</span><span class="special">)</span> <span class="number">1</span><span class="special">)</span><span class="special">;</span></pre>
62 <p>Constructor</p>
63 <p>
64 </p>
65 <div class="variablelist"><table border="0" class="variablelist compact">
66 <colgroup>
67 <col align="left" valign="top">
68 <col>
69 </colgroup>
70 <tbody><tr>
71 <td><p><span class="term">Parameters:</span></p></td>
72 <td><div class="variablelist"><table border="0" class="variablelist compact">
73 <colgroup>
74 <col align="left" valign="top">
75 <col>
76 </colgroup>
77 <tbody>
78 <tr>
79 <td><p><span class="term"><code class="computeroutput">initial</code></span></p></td>
80 <td><p>Initial value of the counter </p></td>
81 </tr>
82 <tr>
83 <td><p><span class="term"><code class="computeroutput">step</code></span></p></td>
84 <td><p>Changing step of the counter. Each value acquired from the attribute will be greater than the previous one by this amount. </p></td>
85 </tr>
86 </tbody>
87 </table></div></td>
88 </tr></tbody>
89 </table></div>
90 </li>
91 <li class="listitem">
92 <pre class="literallayout"><span class="keyword">explicit</span> <a name="idp61952928-bb"></a><span class="identifier">counter</span><span class="special">(</span><a class="link" href="cast_source.html" title="Class cast_source">cast_source</a> <span class="keyword">const</span> <span class="special">&amp;</span> source<span class="special">)</span><span class="special">;</span></pre>
93 <p>Constructor for casting support </p>
94 </li>
95 </ol></div>
96 </div>
97 </div>
98 </div>
99 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
100 <td align="left"></td>
101 <td align="right"><div class="copyright-footer">Copyright &#169; 2007-2016 Andrey Semashev<p>
102         Distributed under the Boost Software License, Version 1.0. (See accompanying
103         file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>).
104       </p>
105 </div></td>
106 </tr></table>
107 <hr>
108 <div class="spirit-nav">
109 <a accesskey="p" href="make_constant.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../attributes.html#header.boost.log.attributes.counter_hpp"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="counter/impl.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
110 </div>
111 </body>
112 </html>