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 1. Boost.Log v2">
8 <link rel="up" href="../../../attributes.html#header.boost.log.attributes.counter_hpp" title="Header <boost/log/attributes/counter.hpp>">
9 <link rel="prev" href="make_constant.html" title="Function template make_constant">
10 <link rel="next" href="counter/impl.html" title="Class impl">
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>
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>
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 — A class of an attribute that counts an integral value. </p>
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: <<a class="link" href="../../../attributes.html#header.boost.log.attributes.counter_hpp" title="Header <boost/log/attributes/counter.hpp>">boost/log/attributes/counter.hpp</a>>
27 </span><span class="keyword">template</span><span class="special"><</span><span class="keyword">typename</span> T<span class="special">></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>
33 <span class="comment">// member classes/structs/unions</span>
35 <span class="comment">// Factory implementation.</span>
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>
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>
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">&</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>
57 construct/copy/destruct</h3>
58 <div class="orderedlist"><ol class="orderedlist" type="1">
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>
65 <div class="variablelist"><table border="0" class="variablelist compact">
67 <col align="left" valign="top">
71 <td><p><span class="term">Parameters:</span></p></td>
72 <td><div class="variablelist"><table border="0" class="variablelist compact">
74 <col align="left" valign="top">
79 <td><p><span class="term"><code class="computeroutput">initial</code></span></p></td>
80 <td><p>Initial value of the counter </p></td>
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>
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">&</span> source<span class="special">)</span><span class="special">;</span></pre>
93 <p>Constructor for casting support </p>
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 © 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>).
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>