Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / log / doc / html / boost / log / attribute_value.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Class attribute_value</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.attribute_value_hpp" title="Header &lt;boost/log/attributes/attribute_value.hpp&gt;">
9 <link rel="prev" href="swap_idm45711349124800.html" title="Function swap">
10 <link rel="next" href="attribute_value/impl.html" title="Struct 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="swap_idm45711349124800.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../attributes.html#header.boost.log.attributes.attribute_value_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="attribute_value/impl.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
17 </div>
18 <div class="refentry">
19 <a name="boost.log.attribute_value"></a><div class="titlepage"></div>
20 <div class="refnamediv">
21 <h2><span class="refentrytitle">Class attribute_value</span></h2>
22 <p>boost::log::attribute_value &#8212; An attribute value class. </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.attribute_value_hpp" title="Header &lt;boost/log/attributes/attribute_value.hpp&gt;">boost/log/attributes/attribute_value.hpp</a>&gt;
26
27 </span>
28 <span class="keyword">class</span> <a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">{</span>
29 <span class="keyword">public</span><span class="special">:</span>
30   <span class="comment">// member classes/structs/unions</span>
31
32   <span class="comment">// A base class for an attribute value implementation.</span>
33
34   <span class="keyword">struct</span> <a class="link" href="attribute_value/impl.html" title="Struct 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>
35
36     <span class="comment">// <a class="link" href="attribute_value/impl.html#idm45711349108592-bb">public member functions</a></span>
37     <span class="keyword">virtual</span> <span class="keyword">bool</span> <a class="link" href="attribute_value/impl.html#idm45711349108032-bb"><span class="identifier">dispatch</span></a><span class="special">(</span><span class="identifier">type_dispatcher</span> <span class="special">&amp;</span><span class="special">)</span> <span class="special">=</span> <span class="number">0</span><span class="special">;</span>
38     <span class="keyword">virtual</span> <span class="identifier">intrusive_ptr</span><span class="special">&lt;</span> <a class="link" href="attribute_value/impl.html" title="Struct impl">impl</a> <span class="special">&gt;</span> <a class="link" href="attribute_value/impl.html#idm45711349103680-bb"><span class="identifier">detach_from_thread</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
39     <span class="keyword">virtual</span> <a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <a class="link" href="attribute_value/impl.html#idm45711349100432-bb"><span class="identifier">get_value</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
40     <span class="keyword">virtual</span> <span class="identifier">typeindex</span><span class="special">::</span><span class="identifier">type_index</span> <a class="link" href="attribute_value/impl.html#idm45711349098144-bb"><span class="identifier">get_type</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
41   <span class="special">}</span><span class="special">;</span>
42   <span class="comment">// <a class="link" href="attribute_value.html#boost.log.attribute_valueconstruct-copy-destruct">construct/copy/destruct</a></span>
43   <a class="link" href="attribute_value.html#idm45711349042656-bb"><span class="identifier">attribute_value</span></a><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
44   <a class="link" href="attribute_value.html#idm45711349040368-bb"><span class="identifier">attribute_value</span></a><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
45   <span class="keyword">explicit</span> <a class="link" href="attribute_value.html#idm45711349038416-bb"><span class="identifier">attribute_value</span></a><span class="special">(</span><span class="identifier">intrusive_ptr</span><span class="special">&lt;</span> <a class="link" href="attribute_value/impl.html" title="Struct impl">impl</a> <span class="special">&gt;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
46   <a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;</span> <a class="link" href="attribute_value.html#idm45711349035216-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
47   <a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;</span> <a class="link" href="attribute_value.html#idm45711349032688-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
48
49   <span class="comment">// <a class="link" href="attribute_value.html#idm45711349095584-bb">public member functions</a></span>
50   <span class="keyword">explicit</span> <a class="link" href="attribute_value.html#idm45711349095024-bb"><span class="keyword">operator</span> <span class="keyword">bool</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
51   <span class="keyword">bool</span> <a class="link" href="attribute_value.html#idm45711349093184-bb"><span class="keyword">operator</span><span class="special">!</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
52   <span class="identifier">typeindex</span><span class="special">::</span><span class="identifier">type_index</span> <a class="link" href="attribute_value.html#idm45711349091616-bb"><span class="identifier">get_type</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
53   <span class="keyword">void</span> <a class="link" href="attribute_value.html#idm45711349089824-bb"><span class="identifier">detach_from_thread</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
54   <span class="keyword">bool</span> <a class="link" href="attribute_value.html#idm45711349087488-bb"><span class="identifier">dispatch</span></a><span class="special">(</span><span class="identifier">type_dispatcher</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
55   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span> 
56     <a class="link" href="result_of/extract.html" title="Struct template extract">result_of::extract</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="attribute_value.html#idm45711349082528-bb"><span class="identifier">extract</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
57   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span> 
58     <a class="link" href="result_of/extract_or_throw.html" title="Struct template extract_or_throw">result_of::extract_or_throw</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a class="link" href="attribute_value.html#idm45711349075840-bb"><span class="identifier">extract_or_throw</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
59   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span> 
60     <a class="link" href="result_of/extract_or_default.html" title="Struct template extract_or_default">result_of::extract_or_default</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
61     <a class="link" href="attribute_value.html#idm45711349069120-bb"><span class="identifier">extract_or_default</span></a><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
62   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">,</span> <span class="keyword">typename</span> DefaultT<span class="special">&gt;</span> 
63     <a class="link" href="result_of/extract_or_default.html" title="Struct template extract_or_default">result_of::extract_or_default</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">DefaultT</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
64     <a class="link" href="attribute_value.html#idm45711349061216-bb"><span class="identifier">extract_or_default</span></a><span class="special">(</span><span class="identifier">DefaultT</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
65   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> VisitorT<span class="special">&gt;</span> 
66     <a class="link" href="visitation_result.html" title="Class visitation_result">visitation_result</a> <a class="link" href="attribute_value.html#idm45711349052736-bb"><span class="identifier">visit</span></a><span class="special">(</span><span class="identifier">VisitorT</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
67   <span class="keyword">void</span> <a class="link" href="attribute_value.html#idm45711349045344-bb"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
68 <span class="special">}</span><span class="special">;</span></pre></div>
69 <div class="refsect1">
70 <a name="idm45554753949120"></a><h2>Description</h2>
71 <p>An attribute value is an object that contains a piece of data that represents an attribute state at the point of the value acquisition. All major operations with log records, such as filtering and formatting, involve attribute values contained in a single view. Most likely an attribute value is implemented as a simple holder of some typed value. This holder implements the <code class="computeroutput">attribute_value::implementation</code> interface and acts as a pimpl for the <code class="computeroutput"><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a></code> object. The <code class="computeroutput"><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a></code> class provides type dispatching support in order to allow to extract the value from the holder.</p>
72 <p>Normally, attributes and their values shall be designed in order to exclude as much interference as reasonable. Such approach allows to have more than one attribute value simultaneously, which improves scalability and allows to implement generating attributes.</p>
73 <p>However, there are cases when this approach does not help to achieve the required level of independency of attribute values and attribute itself from each other at a reasonable performance tradeoff. For example, an attribute or its values may use thread-specific data, which is global and shared between all the instances of the attribute/value. Passing such an attribute value to another thread would be a disaster. To solve this the library defines an additional method for attribute values, namely <code class="computeroutput">detach_from_thread</code>. The <code class="computeroutput"><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a></code> class forwards the call to its pimpl, which is supposed to ensure that it no longer refers to any thread-specific data after the call. The pimpl can create a new holder as a result of this method and return it to the <code class="computeroutput"><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a></code> wrapper, which will keep the returned reference for any further calls. This method is called for all attribute values that are passed to another thread. </p>
74 <div class="refsect2">
75 <a name="idm45554753939808"></a><h3>
76 <a name="boost.log.attribute_valueconstruct-copy-destruct"></a><code class="computeroutput">attribute_value</code> 
77         public
78        construct/copy/destruct</h3>
79 <div class="orderedlist"><ol class="orderedlist" type="1">
80 <li class="listitem">
81 <pre class="literallayout"><a name="idm45711349042656-bb"></a><span class="identifier">attribute_value</span><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="keyword">const</span> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
82 <p>Default constructor. Creates an empty (absent) attribute value.</p>
83 <p>Copy constructor </p>
84 </li>
85 <li class="listitem">
86 <pre class="literallayout"><a name="idm45711349040368-bb"></a><span class="identifier">attribute_value</span><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
87 <p>Move constructor </p>
88 </li>
89 <li class="listitem">
90 <pre class="literallayout"><span class="keyword">explicit</span> <a name="idm45711349038416-bb"></a><span class="identifier">attribute_value</span><span class="special">(</span><span class="identifier">intrusive_ptr</span><span class="special">&lt;</span> <a class="link" href="attribute_value/impl.html" title="Struct impl">impl</a> <span class="special">&gt;</span> p<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
91 <p>Initializing constructor. Creates an attribute value that refers to the specified holder.</p>
92 <p>
93 </p>
94 <div class="variablelist"><table border="0" class="variablelist compact">
95 <colgroup>
96 <col align="left" valign="top">
97 <col>
98 </colgroup>
99 <tbody><tr>
100 <td><p><span class="term">Parameters:</span></p></td>
101 <td><div class="variablelist"><table border="0" class="variablelist compact">
102 <colgroup>
103 <col align="left" valign="top">
104 <col>
105 </colgroup>
106 <tbody><tr>
107 <td><p><span class="term"><code class="computeroutput">p</code></span></p></td>
108 <td><p>A pointer to the attribute value holder. </p></td>
109 </tr></tbody>
110 </table></div></td>
111 </tr></tbody>
112 </table></div>
113 </li>
114 <li class="listitem">
115 <pre class="literallayout"><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;</span> <a name="idm45711349035216-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="keyword">const</span> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
116 <p>Copy assignment </p>
117 </li>
118 <li class="listitem">
119 <pre class="literallayout"><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;</span> <a name="idm45711349032688-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
120 <p>Move assignment </p>
121 </li>
122 </ol></div>
123 </div>
124 <div class="refsect2">
125 <a name="idm45554753895696"></a><h3>
126 <a name="idm45711349095584-bb"></a><code class="computeroutput">attribute_value</code> public member functions</h3>
127 <div class="orderedlist"><ol class="orderedlist" type="1">
128 <li class="listitem">
129 <pre class="literallayout"><span class="keyword">explicit</span> <a name="idm45711349095024-bb"></a><span class="keyword">operator</span> <span class="keyword">bool</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
130 <p>The operator checks if the attribute value is empty </p>
131 </li>
132 <li class="listitem">
133 <pre class="literallayout"><span class="keyword">bool</span> <a name="idm45711349093184-bb"></a><span class="keyword">operator</span><span class="special">!</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
134 <p>The operator checks if the attribute value is empty </p>
135 </li>
136 <li class="listitem">
137 <pre class="literallayout"><span class="identifier">typeindex</span><span class="special">::</span><span class="identifier">type_index</span> <a name="idm45711349091616-bb"></a><span class="identifier">get_type</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
138 <p>The method returns the type information of the stored value of the attribute. The returned type info wrapper may be empty if the attribute value is empty or the information cannot be provided. If the returned value is not empty, the type can be used for value extraction. </p>
139 </li>
140 <li class="listitem">
141 <pre class="literallayout"><span class="keyword">void</span> <a name="idm45711349089824-bb"></a><span class="identifier">detach_from_thread</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
142 <p>The method is called when the attribute value is passed to another thread (e.g. in case of asynchronous logging). The value should ensure it properly owns all thread-specific data.</p>
143 <p>
144 </p>
145 <div class="variablelist"><table border="0" class="variablelist compact">
146 <colgroup>
147 <col align="left" valign="top">
148 <col>
149 </colgroup>
150 <tbody><tr>
151 <td><p><span class="term">Postconditions:</span></p></td>
152 <td><p>The attribute value no longer refers to any thread-specific resources. </p></td>
153 </tr></tbody>
154 </table></div>
155 </li>
156 <li class="listitem">
157 <pre class="literallayout"><span class="keyword">bool</span> <a name="idm45711349087488-bb"></a><span class="identifier">dispatch</span><span class="special">(</span><span class="identifier">type_dispatcher</span> <span class="special">&amp;</span> dispatcher<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
158 <p>The method dispatches the value to the given object. This method is a low level interface for attribute value visitation and extraction. For typical usage these interfaces may be more convenient.</p>
159 <p>
160
161 </p>
162 <div class="variablelist"><table border="0" class="variablelist compact">
163 <colgroup>
164 <col align="left" valign="top">
165 <col>
166 </colgroup>
167 <tbody>
168 <tr>
169 <td><p><span class="term">Parameters:</span></p></td>
170 <td><div class="variablelist"><table border="0" class="variablelist compact">
171 <colgroup>
172 <col align="left" valign="top">
173 <col>
174 </colgroup>
175 <tbody><tr>
176 <td><p><span class="term"><code class="computeroutput">dispatcher</code></span></p></td>
177 <td><p>The object that attempts to dispatch the stored value. </p></td>
178 </tr></tbody>
179 </table></div></td>
180 </tr>
181 <tr>
182 <td><p><span class="term">Returns:</span></p></td>
183 <td><p><code class="computeroutput">true</code> if the value is not empty and the <span class="emphasis"><em>dispatcher</em></span> was capable to consume the real attribute value type and <code class="computeroutput">false</code> otherwise. </p></td>
184 </tr>
185 </tbody>
186 </table></div>
187 </li>
188 <li class="listitem">
189 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span> 
190   <a class="link" href="result_of/extract.html" title="Struct template extract">result_of::extract</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a name="idm45711349082528-bb"></a><span class="identifier">extract</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
191 <p>The method attempts to extract the stored value, assuming the value has the specified type. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence.</p>
192 <div class="note"><table border="0" summary="Note">
193 <tr>
194 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
195 <th align="left">Note</th>
196 </tr>
197 <tr><td align="left" valign="top"><p>Include <code class="computeroutput">value_extraction.hpp</code> prior to using this method.</p></td></tr>
198 </table></div>
199 <p>
200
201 </p>
202 <div class="variablelist"><table border="0" class="variablelist compact">
203 <colgroup>
204 <col align="left" valign="top">
205 <col>
206 </colgroup>
207 <tbody><tr>
208 <td><p><span class="term">Returns:</span></p></td>
209 <td><p>The extracted value, if the attribute value is not empty and the value is the same as specified. Otherwise returns an empty value. See description of the <code class="computeroutput"><a class="link" href="result_of/extract.html" title="Struct template extract">result_of::extract</a></code> metafunction for information on the nature of the result value. </p></td>
210 </tr></tbody>
211 </table></div>
212 </li>
213 <li class="listitem">
214 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span> 
215   <a class="link" href="result_of/extract_or_throw.html" title="Struct template extract_or_throw">result_of::extract_or_throw</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> <a name="idm45711349075840-bb"></a><span class="identifier">extract_or_throw</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
216 <p>The method attempts to extract the stored value, assuming the value has the specified type. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence.</p>
217 <div class="note"><table border="0" summary="Note">
218 <tr>
219 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
220 <th align="left">Note</th>
221 </tr>
222 <tr><td align="left" valign="top"><p>Include <code class="computeroutput">value_extraction.hpp</code> prior to using this method.</p></td></tr>
223 </table></div>
224 <p>
225
226 </p>
227 <div class="variablelist"><table border="0" class="variablelist compact">
228 <colgroup>
229 <col align="left" valign="top">
230 <col>
231 </colgroup>
232 <tbody><tr>
233 <td><p><span class="term">Returns:</span></p></td>
234 <td><p>The extracted value, if the attribute value is not empty and the value is the same as specified. Otherwise an exception is thrown. See description of the <code class="computeroutput"><a class="link" href="result_of/extract_or_throw.html" title="Struct template extract_or_throw">result_of::extract_or_throw</a></code> metafunction for information on the nature of the result value. </p></td>
235 </tr></tbody>
236 </table></div>
237 </li>
238 <li class="listitem">
239 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">&gt;</span> 
240   <a class="link" href="result_of/extract_or_default.html" title="Struct template extract_or_default">result_of::extract_or_default</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
241   <a name="idm45711349069120-bb"></a><span class="identifier">extract_or_default</span><span class="special">(</span><span class="identifier">T</span> <span class="keyword">const</span> <span class="special">&amp;</span> def_value<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
242 <p>The method attempts to extract the stored value, assuming the value has the specified type. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence. If extraction fails, the default value is returned.</p>
243 <div class="note"><table border="0" summary="Note">
244 <tr>
245 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
246 <th align="left">Note</th>
247 </tr>
248 <tr><td align="left" valign="top"><p>Include <code class="computeroutput">value_extraction.hpp</code> prior to using this method.</p></td></tr>
249 </table></div>
250 <p>
251
252
253 </p>
254 <div class="variablelist"><table border="0" class="variablelist compact">
255 <colgroup>
256 <col align="left" valign="top">
257 <col>
258 </colgroup>
259 <tbody>
260 <tr>
261 <td><p><span class="term">Parameters:</span></p></td>
262 <td><div class="variablelist"><table border="0" class="variablelist compact">
263 <colgroup>
264 <col align="left" valign="top">
265 <col>
266 </colgroup>
267 <tbody><tr>
268 <td><p><span class="term"><code class="computeroutput">def_value</code></span></p></td>
269 <td><p>Default value.</p></td>
270 </tr></tbody>
271 </table></div></td>
272 </tr>
273 <tr>
274 <td><p><span class="term">Returns:</span></p></td>
275 <td><p>The extracted value, if the attribute value is not empty and the value is the same as specified. Otherwise returns the default value. See description of the <code class="computeroutput"><a class="link" href="result_of/extract_or_default.html" title="Struct template extract_or_default">result_of::extract_or_default</a></code> metafunction for information on the nature of the result value. </p></td>
276 </tr>
277 </tbody>
278 </table></div>
279 </li>
280 <li class="listitem">
281 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> TagT <span class="special">=</span> <span class="keyword">void</span><span class="special">,</span> <span class="keyword">typename</span> DefaultT<span class="special">&gt;</span> 
282   <a class="link" href="result_of/extract_or_default.html" title="Struct template extract_or_default">result_of::extract_or_default</a><span class="special">&lt;</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">DefaultT</span><span class="special">,</span> <span class="identifier">TagT</span> <span class="special">&gt;</span><span class="special">::</span><span class="identifier">type</span> 
283   <a name="idm45711349061216-bb"></a><span class="identifier">extract_or_default</span><span class="special">(</span><span class="identifier">DefaultT</span> <span class="keyword">const</span> <span class="special">&amp;</span> def_value<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
284 <p>The method attempts to extract the stored value, assuming the value has the specified type. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence. If extraction fails, the default value is returned.</p>
285 <div class="note"><table border="0" summary="Note">
286 <tr>
287 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
288 <th align="left">Note</th>
289 </tr>
290 <tr><td align="left" valign="top"><p>Include <code class="computeroutput">value_extraction.hpp</code> prior to using this method.</p></td></tr>
291 </table></div>
292 <p>
293
294
295 </p>
296 <div class="variablelist"><table border="0" class="variablelist compact">
297 <colgroup>
298 <col align="left" valign="top">
299 <col>
300 </colgroup>
301 <tbody>
302 <tr>
303 <td><p><span class="term">Parameters:</span></p></td>
304 <td><div class="variablelist"><table border="0" class="variablelist compact">
305 <colgroup>
306 <col align="left" valign="top">
307 <col>
308 </colgroup>
309 <tbody><tr>
310 <td><p><span class="term"><code class="computeroutput">def_value</code></span></p></td>
311 <td><p>Default value.</p></td>
312 </tr></tbody>
313 </table></div></td>
314 </tr>
315 <tr>
316 <td><p><span class="term">Returns:</span></p></td>
317 <td><p>The extracted value, if the attribute value is not empty and the value is the same as specified. Otherwise returns the default value. See description of the <code class="computeroutput"><a class="link" href="result_of/extract_or_default.html" title="Struct template extract_or_default">result_of::extract_or_default</a></code> metafunction for information on the nature of the result value. </p></td>
318 </tr>
319 </tbody>
320 </table></div>
321 </li>
322 <li class="listitem">
323 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> T<span class="special">,</span> <span class="keyword">typename</span> VisitorT<span class="special">&gt;</span> 
324   <a class="link" href="visitation_result.html" title="Class visitation_result">visitation_result</a> <a name="idm45711349052736-bb"></a><span class="identifier">visit</span><span class="special">(</span><span class="identifier">VisitorT</span> visitor<span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
325 <p>The method attempts to extract the stored value, assuming the value has the specified type, and pass it to the <span class="emphasis"><em>visitor</em></span> function object. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence.</p>
326 <div class="note"><table border="0" summary="Note">
327 <tr>
328 <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../../doc/src/images/note.png"></td>
329 <th align="left">Note</th>
330 </tr>
331 <tr><td align="left" valign="top"><p>Include <code class="computeroutput">value_visitation.hpp</code> prior to using this method.</p></td></tr>
332 </table></div>
333 <p>
334
335
336 </p>
337 <div class="variablelist"><table border="0" class="variablelist compact">
338 <colgroup>
339 <col align="left" valign="top">
340 <col>
341 </colgroup>
342 <tbody>
343 <tr>
344 <td><p><span class="term">Parameters:</span></p></td>
345 <td><div class="variablelist"><table border="0" class="variablelist compact">
346 <colgroup>
347 <col align="left" valign="top">
348 <col>
349 </colgroup>
350 <tbody><tr>
351 <td><p><span class="term"><code class="computeroutput">visitor</code></span></p></td>
352 <td><p>A function object that will be invoked on the extracted attribute value. The visitor should be capable to be called with a single argument of any type of the specified types in <code class="computeroutput">T</code>.</p></td>
353 </tr></tbody>
354 </table></div></td>
355 </tr>
356 <tr>
357 <td><p><span class="term">Returns:</span></p></td>
358 <td><p>The result of visitation. </p></td>
359 </tr>
360 </tbody>
361 </table></div>
362 </li>
363 <li class="listitem">
364 <pre class="literallayout"><span class="keyword">void</span> <a name="idm45711349045344-bb"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="attribute_value.html" title="Class attribute_value">attribute_value</a> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
365 <p>The method swaps two attribute values </p>
366 </li>
367 </ol></div>
368 </div>
369 </div>
370 </div>
371 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
372 <td align="left"></td>
373 <td align="right"><div class="copyright-footer">Copyright &#169; 2007-2016 Andrey Semashev<p>
374         Distributed under the Boost Software License, Version 1.0. (See accompanying
375         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>).
376       </p>
377 </div></td>
378 </tr></table>
379 <hr>
380 <div class="spirit-nav">
381 <a accesskey="p" href="swap_idm45711349124800.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../attributes.html#header.boost.log.attributes.attribute_value_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="attribute_value/impl.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
382 </div>
383 </body>
384 </html>