Imported Upstream version 1.64.0
[platform/upstream/boost.git] / libs / log / doc / html / boost / log / ipc / reliable_message_queue.html
1 <html>
2 <head>
3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Class reliable_message_queue</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="../../../utilities.html#header.boost.log.utility.ipc.reliable_message_queue_hpp" title="Header &lt;boost/log/utility/ipc/reliable_message_queue.hpp&gt;">
9 <link rel="prev" href="object_name.html" title="Class object_name">
10 <link rel="next" href="../add_value_manip.html" title="Class template add_value_manip">
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="object_name.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../utilities.html#header.boost.log.utility.ipc.reliable_message_queue_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="../add_value_manip.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
17 </div>
18 <div class="refentry">
19 <a name="boost.log.ipc.reliable_message_queue"></a><div class="titlepage"></div>
20 <div class="refnamediv">
21 <h2><span class="refentrytitle">Class reliable_message_queue</span></h2>
22 <p>boost::log::ipc::reliable_message_queue &#8212; A reliable interprocess message queue. </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="../../../utilities.html#header.boost.log.utility.ipc.reliable_message_queue_hpp" title="Header &lt;boost/log/utility/ipc/reliable_message_queue.hpp&gt;">boost/log/utility/ipc/reliable_message_queue.hpp</a>&gt;
26
27 </span>
28 <span class="keyword">class</span> <a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <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">uint32_t</span> <a name="boost.log.ipc.reliable_message_queue.size_type"></a><span class="identifier">size_type</span><span class="special">;</span>  <span class="comment">// Queue message size type. </span>
32
33   <span class="comment">// Result codes for various operations on the queue. </span>
34   <span class="keyword">enum</span> <a name="boost.log.ipc.reliable_message_queue.operation_result"></a>operation_result <span class="special">{</span> succeeded, no_space, aborted <span class="special">}</span><span class="special">;</span>
35
36   <span class="comment">// Interprocess queue overflow policies. </span>
37   <span class="keyword">enum</span> <a name="boost.log.ipc.reliable_message_queue.overflow_policy"></a>overflow_policy <span class="special">{</span> block_on_overflow, fail_on_overflow, 
38                          throw_on_overflow <span class="special">}</span><span class="special">;</span>
39
40   <span class="comment">// <a class="link" href="reliable_message_queue.html#boost.log.ipc.reliable_message_queueconstruct-copy-destruct">construct/copy/destruct</a></span>
41   <a class="link" href="reliable_message_queue.html#idp67409744-bb"><span class="identifier">reliable_message_queue</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
42   <a class="link" href="reliable_message_queue.html#idp67411792-bb"><span class="identifier">reliable_message_queue</span></a><span class="special">(</span><a class="link" href="../open_mode/create_only_tag.html" title="Struct create_only_tag">open_mode::create_only_tag</a><span class="special">,</span> <a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">,</span> 
43                          <span class="identifier">uint32_t</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> 
44                          <span class="identifier">overflow_policy</span> <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
45                          <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
46   <a class="link" href="reliable_message_queue.html#idp67421760-bb"><span class="identifier">reliable_message_queue</span></a><span class="special">(</span><a class="link" href="../open_mode/open_or_create_tag.html" title="Struct open_or_create_tag">open_mode::open_or_create_tag</a><span class="special">,</span> <a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">,</span> 
47                          <span class="identifier">uint32_t</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> 
48                          <span class="identifier">overflow_policy</span> <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
49                          <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
50   <a class="link" href="reliable_message_queue.html#idp67431936-bb"><span class="identifier">reliable_message_queue</span></a><span class="special">(</span><a class="link" href="../open_mode/open_only_tag.html" title="Struct open_only_tag">open_mode::open_only_tag</a><span class="special">,</span> <a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">,</span> 
51                          <span class="identifier">overflow_policy</span> <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
52                          <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
53   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span><span class="special">...</span> Args<span class="special">&gt;</span> <span class="keyword">explicit</span> <a class="link" href="reliable_message_queue.html#idp67439776-bb"><span class="identifier">reliable_message_queue</span></a><span class="special">(</span><span class="identifier">Args</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">...</span><span class="special">)</span><span class="special">;</span>
54   <a class="link" href="reliable_message_queue.html#idp67450448-bb"><span class="identifier">reliable_message_queue</span></a><span class="special">(</span><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
55   <a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;</span> <a class="link" href="reliable_message_queue.html#idp67454560-bb"><span class="keyword">operator</span><span class="special">=</span></a><span class="special">(</span><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
56   <a class="link" href="reliable_message_queue.html#idp67449296-bb"><span class="special">~</span><span class="identifier">reliable_message_queue</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
57
58   <span class="comment">// <a class="link" href="reliable_message_queue.html#idp67250144-bb">public member functions</a></span>
59   <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67250704-bb"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
60   <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67254400-bb"><span class="identifier">create</span></a><span class="special">(</span><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">uint32_t</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> 
61               <span class="identifier">overflow_policy</span> <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
62               <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
63   <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67264768-bb"><span class="identifier">open_or_create</span></a><span class="special">(</span><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">uint32_t</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> 
64                       <span class="identifier">overflow_policy</span> <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
65                       <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
66   <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67275376-bb"><span class="identifier">open</span></a><span class="special">(</span><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">,</span> <span class="identifier">overflow_policy</span> <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
67             <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span>
68   <span class="keyword">bool</span> <a class="link" href="reliable_message_queue.html#idp67283632-bb"><span class="identifier">is_open</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span>
69   <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67286688-bb"><span class="identifier">clear</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
70   <a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> <a class="link" href="reliable_message_queue.html#idp67291248-bb"><span class="identifier">name</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
71   <span class="identifier">uint32_t</span> <a class="link" href="reliable_message_queue.html#idp67294384-bb"><span class="identifier">capacity</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
72   <span class="identifier">size_type</span> <a class="link" href="reliable_message_queue.html#idp67297920-bb"><span class="identifier">block_size</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span>
73   <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67301456-bb"><span class="identifier">stop_local</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
74   <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67313184-bb"><span class="identifier">reset_local</span></a><span class="special">(</span><span class="special">)</span><span class="special">;</span>
75   <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67316416-bb"><span class="identifier">close</span></a><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
76   <span class="identifier">operation_result</span> <a class="link" href="reliable_message_queue.html#idp67322080-bb"><span class="identifier">send</span></a><span class="special">(</span><span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
77   <span class="keyword">bool</span> <a class="link" href="reliable_message_queue.html#idp67335536-bb"><span class="identifier">try_send</span></a><span class="special">(</span><span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">)</span><span class="special">;</span>
78   <span class="identifier">operation_result</span> <a class="link" href="reliable_message_queue.html#idp67348496-bb"><span class="identifier">receive</span></a><span class="special">(</span><span class="keyword">void</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
79   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ElementT<span class="special">,</span> <span class="identifier">size_type</span> SizeV<span class="special">&gt;</span> 
80     <span class="identifier">operation_result</span> <a class="link" href="reliable_message_queue.html#idp67358656-bb"><span class="identifier">receive</span></a><span class="special">(</span><span class="identifier">ElementT</span><span class="special">(</span><span class="special">&amp;</span><span class="special">)</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
81   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ContainerT<span class="special">&gt;</span> <span class="identifier">operation_result</span> <a class="link" href="reliable_message_queue.html#idp67369392-bb"><span class="identifier">receive</span></a><span class="special">(</span><span class="identifier">ContainerT</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
82   <span class="keyword">bool</span> <a class="link" href="reliable_message_queue.html#idp67379568-bb"><span class="identifier">try_receive</span></a><span class="special">(</span><span class="keyword">void</span> <span class="special">*</span><span class="special">,</span> <span class="identifier">size_type</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
83   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ElementT<span class="special">,</span> <span class="identifier">size_type</span> SizeV<span class="special">&gt;</span> 
84     <span class="keyword">bool</span> <a class="link" href="reliable_message_queue.html#idp67389376-bb"><span class="identifier">try_receive</span></a><span class="special">(</span><span class="identifier">ElementT</span><span class="special">(</span><span class="special">&amp;</span><span class="special">)</span><span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
85   <span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ContainerT<span class="special">&gt;</span> <span class="keyword">bool</span> <a class="link" href="reliable_message_queue.html#idp67399760-bb"><span class="identifier">try_receive</span></a><span class="special">(</span><span class="identifier">ContainerT</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
86
87   <span class="comment">// <a class="link" href="reliable_message_queue.html#idp67460160-bb">friend functions</a></span>
88   <span class="keyword">friend</span> <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67460720-bb"><span class="identifier">swap</span></a><span class="special">(</span><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;</span><span class="special">,</span> <a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span>
89
90   <span class="comment">// <a class="link" href="reliable_message_queue.html#idp67465104-bb">public static functions</a></span>
91   <span class="keyword">static</span> <span class="keyword">void</span> <a class="link" href="reliable_message_queue.html#idp67465664-bb"><span class="identifier">remove</span></a><span class="special">(</span><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">)</span><span class="special">;</span>
92 <span class="special">}</span><span class="special">;</span></pre></div>
93 <div class="refsect1">
94 <a name="idp134182704"></a><h2>Description</h2>
95 <p>The queue implements a reliable one-way channel of passing messages from one or multiple writers to a single reader. The format of the messages is user-defined and must be consistent across all writers and the reader. The queue does not enforce any specific format of the messages, other than they should be supplied as a contiguous array of bytes.</p>
96 <p>The queue internally uses a process-shared storage identified by an <code class="computeroutput"><a class="link" href="object_name.html" title="Class object_name">object_name</a></code> (the queue name). Refer to <code class="computeroutput"><a class="link" href="object_name.html" title="Class object_name">object_name</a></code> documentation for details on restrictions imposed on object names.</p>
97 <p>The queue storage is organized as a fixed number of blocks of a fixed size. The block size must be an integer power of 2 and is expressed in bytes. Each written message, together with some metadata added by the queue, consumes an integer number of blocks. Each read message received by the reader releases the blocks allocated for that message. As such the maximum size of a message is slightly less than block size times capacity of the queue. For efficiency, it is recommended to choose block size large enough to accommodate most of the messages to be passed through the queue.</p>
98 <p>The queue is considered empty when no messages are enqueued (all blocks are free). The queue is considered full at the point of enqueueing a message when there is not enough free blocks to accommodate the message.</p>
99 <p>The queue is reliable in that it will not drop successfully sent messages that are not received by the reader, other than the case when a non-empty queue is destroyed by the last user. If a message cannot be enqueued by the writer because the queue is full, the queue can either block the writer or return an error or throw an exception, depending on the policy specified at the queue creation. The policy is object local, i.e. different writers and the reader can have different overflow policies.</p>
100 <p>If the queue is empty and the reader attempts to dequeue a message, it will block until a message is enqueued by a writer.</p>
101 <p>A blocked reader or writer can be unblocked by calling <code class="computeroutput">stop_local</code>. After this method is called, all threads blocked on this particular object are released and return <code class="computeroutput">operation_result::aborted</code>. The other instances of the queue (in the current or other processes) are unaffected. In order to restore the normal functioning of the queue instance after the <code class="computeroutput">stop_local</code> call the user has to invoke <code class="computeroutput">reset_local</code>.</p>
102 <p>The queue does not guarantee any particular order of received messages from different writer threads. Messages sent by a particular writer thread will be received in the order of sending.</p>
103 <p>Methods of this class are not thread-safe, unless otherwise specified. </p>
104 <div class="refsect2">
105 <a name="idp134193344"></a><h3>
106 <a name="boost.log.ipc.reliable_message_queueconstruct-copy-destruct"></a><code class="computeroutput">reliable_message_queue</code> 
107         public
108        construct/copy/destruct</h3>
109 <div class="orderedlist"><ol class="orderedlist" type="1">
110 <li class="listitem">
111 <pre class="literallayout"><a name="idp67409744-bb"></a><span class="identifier">reliable_message_queue</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
112 <p>Default constructor. The method constructs an object that is not associated with any message queue.</p>
113 <p>
114 </p>
115 <div class="variablelist"><table border="0" class="variablelist compact">
116 <colgroup>
117 <col align="left" valign="top">
118 <col>
119 </colgroup>
120 <tbody><tr>
121 <td><p><span class="term">Postconditions:</span></p></td>
122 <td><p><code class="computeroutput">is_open() == false</code> </p></td>
123 </tr></tbody>
124 </table></div>
125 </li>
126 <li class="listitem">
127 <pre class="literallayout"><a name="idp67411792-bb"></a><span class="identifier">reliable_message_queue</span><span class="special">(</span><a class="link" href="../open_mode/create_only_tag.html" title="Struct create_only_tag">open_mode::create_only_tag</a><span class="special">,</span> <a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> name<span class="special">,</span> 
128                        <span class="identifier">uint32_t</span> capacity<span class="special">,</span> <span class="identifier">size_type</span> block_size<span class="special">,</span> 
129                        <span class="identifier">overflow_policy</span> oflow_policy <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
130                        <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> perms <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
131 <p>Constructor. The method is used to construct an object and create the associated message queue. The constructed object will be in running state if the message queue is successfully created.</p>
132 <p>
133
134 </p>
135 <div class="variablelist"><table border="0" class="variablelist compact">
136 <colgroup>
137 <col align="left" valign="top">
138 <col>
139 </colgroup>
140 <tbody>
141 <tr>
142 <td><p><span class="term">Parameters:</span></p></td>
143 <td><div class="variablelist"><table border="0" class="variablelist compact">
144 <colgroup>
145 <col align="left" valign="top">
146 <col>
147 </colgroup>
148 <tbody>
149 <tr>
150 <td><p><span class="term"><code class="computeroutput">block_size</code></span></p></td>
151 <td><p>Size in bytes of allocation block. Must be a power of 2. </p></td>
152 </tr>
153 <tr>
154 <td><p><span class="term"><code class="computeroutput">capacity</code></span></p></td>
155 <td><p>Maximum number of allocation blocks the queue can hold. </p></td>
156 </tr>
157 <tr>
158 <td><p><span class="term"><code class="computeroutput">name</code></span></p></td>
159 <td><p>Name of the message queue to be associated with. </p></td>
160 </tr>
161 <tr>
162 <td><p><span class="term"><code class="computeroutput">oflow_policy</code></span></p></td>
163 <td><p>Queue behavior policy in case of overflow. </p></td>
164 </tr>
165 <tr>
166 <td><p><span class="term"><code class="computeroutput">perms</code></span></p></td>
167 <td><p>Access permissions for the associated message queue. </p></td>
168 </tr>
169 </tbody>
170 </table></div></td>
171 </tr>
172 <tr>
173 <td><p><span class="term">Postconditions:</span></p></td>
174 <td><p><code class="computeroutput">is_open() == true</code></p></td>
175 </tr>
176 </tbody>
177 </table></div>
178 </li>
179 <li class="listitem">
180 <pre class="literallayout"><a name="idp67421760-bb"></a><span class="identifier">reliable_message_queue</span><span class="special">(</span><a class="link" href="../open_mode/open_or_create_tag.html" title="Struct open_or_create_tag">open_mode::open_or_create_tag</a><span class="special">,</span> 
181                        <a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> name<span class="special">,</span> <span class="identifier">uint32_t</span> capacity<span class="special">,</span> 
182                        <span class="identifier">size_type</span> block_size<span class="special">,</span> 
183                        <span class="identifier">overflow_policy</span> oflow_policy <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
184                        <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> perms <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
185 <p>Constructor. The method is used to construct an object and create or open the associated message queue. The constructed object will be in running state if the message queue is successfully created or opened. If the message queue that is identified by the name already exists then the other queue parameters are ignored. The actual queue parameters can be obtained with accessors from the constructed object.</p>
186 <p>
187
188 </p>
189 <div class="variablelist"><table border="0" class="variablelist compact">
190 <colgroup>
191 <col align="left" valign="top">
192 <col>
193 </colgroup>
194 <tbody>
195 <tr>
196 <td><p><span class="term">Parameters:</span></p></td>
197 <td><div class="variablelist"><table border="0" class="variablelist compact">
198 <colgroup>
199 <col align="left" valign="top">
200 <col>
201 </colgroup>
202 <tbody>
203 <tr>
204 <td><p><span class="term"><code class="computeroutput">block_size</code></span></p></td>
205 <td><p>Size in bytes of allocation block. Must be a power of 2. </p></td>
206 </tr>
207 <tr>
208 <td><p><span class="term"><code class="computeroutput">capacity</code></span></p></td>
209 <td><p>Maximum number of allocation blocks the queue can hold. </p></td>
210 </tr>
211 <tr>
212 <td><p><span class="term"><code class="computeroutput">name</code></span></p></td>
213 <td><p>Name of the message queue to be associated with. </p></td>
214 </tr>
215 <tr>
216 <td><p><span class="term"><code class="computeroutput">oflow_policy</code></span></p></td>
217 <td><p>Queue behavior policy in case of overflow. </p></td>
218 </tr>
219 <tr>
220 <td><p><span class="term"><code class="computeroutput">perms</code></span></p></td>
221 <td><p>Access permissions for the associated message queue. </p></td>
222 </tr>
223 </tbody>
224 </table></div></td>
225 </tr>
226 <tr>
227 <td><p><span class="term">Postconditions:</span></p></td>
228 <td><p><code class="computeroutput">is_open() == true</code></p></td>
229 </tr>
230 </tbody>
231 </table></div>
232 </li>
233 <li class="listitem">
234 <pre class="literallayout"><a name="idp67431936-bb"></a><span class="identifier">reliable_message_queue</span><span class="special">(</span><a class="link" href="../open_mode/open_only_tag.html" title="Struct open_only_tag">open_mode::open_only_tag</a><span class="special">,</span> <a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> name<span class="special">,</span> 
235                        <span class="identifier">overflow_policy</span> oflow_policy <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
236                        <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> perms <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
237 <p>Constructor. The method is used to construct an object and open the existing message queue. The constructed object will be in running state if the message queue is successfully opened.</p>
238 <p>
239
240 </p>
241 <div class="variablelist"><table border="0" class="variablelist compact">
242 <colgroup>
243 <col align="left" valign="top">
244 <col>
245 </colgroup>
246 <tbody>
247 <tr>
248 <td><p><span class="term">Parameters:</span></p></td>
249 <td><div class="variablelist"><table border="0" class="variablelist compact">
250 <colgroup>
251 <col align="left" valign="top">
252 <col>
253 </colgroup>
254 <tbody>
255 <tr>
256 <td><p><span class="term"><code class="computeroutput">name</code></span></p></td>
257 <td><p>Name of the message queue to be associated with. </p></td>
258 </tr>
259 <tr>
260 <td><p><span class="term"><code class="computeroutput">oflow_policy</code></span></p></td>
261 <td><p>Queue behavior policy in case of overflow. </p></td>
262 </tr>
263 <tr>
264 <td><p><span class="term"><code class="computeroutput">perms</code></span></p></td>
265 <td><p>Access permissions for the associated message queue. The permissions will only be used if the queue implementation has to create system objects while operating. This parameter is currently not used on POSIX systems. </p></td>
266 </tr>
267 </tbody>
268 </table></div></td>
269 </tr>
270 <tr>
271 <td><p><span class="term">Postconditions:</span></p></td>
272 <td><p><code class="computeroutput">is_open() == true</code></p></td>
273 </tr>
274 </tbody>
275 </table></div>
276 </li>
277 <li class="listitem">
278 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span><span class="special">...</span> Args<span class="special">&gt;</span> 
279   <span class="keyword">explicit</span> <a name="idp67439776-bb"></a><span class="identifier">reliable_message_queue</span><span class="special">(</span><span class="identifier">Args</span> <span class="keyword">const</span> <span class="special">&amp;</span><span class="special">...</span> args<span class="special">)</span><span class="special">;</span></pre>
280 <p>Constructor with named parameters. The method is used to construct an object and create or open the associated message queue. The constructed object will be in running state if the message queue is successfully created.</p>
281 <p>The following named parameters are accepted:</p>
282 <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
283 <li class="listitem"><p>open_mode - One of the open mode tags: <code class="computeroutput">open_mode::create_only</code>, <code class="computeroutput">open_mode::open_only</code> or <code class="computeroutput">open_mode::open_or_create</code>.</p></li>
284 <li class="listitem"><p>name - Name of the message queue to be associated with.</p></li>
285 <li class="listitem"><p>capacity - Maximum number of allocation blocks the queue can hold. Used only if the queue is created.</p></li>
286 <li class="listitem"><p>block_size - Size in bytes of allocation block. Must be a power of 2. Used only if the queue is created.</p></li>
287 <li class="listitem"><p>overflow_policy - Queue behavior policy in case of overflow, see <code class="computeroutput">overflow_policy</code>.</p></li>
288 <li class="listitem"><p>permissions - Access permissions for the associated message queue.</p></li>
289 </ul></div>
290 <p>
291 </p>
292 <p>
293 </p>
294 <div class="variablelist"><table border="0" class="variablelist compact">
295 <colgroup>
296 <col align="left" valign="top">
297 <col>
298 </colgroup>
299 <tbody><tr>
300 <td><p><span class="term">Postconditions:</span></p></td>
301 <td><p><code class="computeroutput">is_open() == true</code> </p></td>
302 </tr></tbody>
303 </table></div>
304 </li>
305 <li class="listitem">
306 <pre class="literallayout"><a name="idp67450448-bb"></a><span class="identifier">reliable_message_queue</span><span class="special">(</span><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
307 <p>Move constructor. The method move-constructs an object from <code class="computeroutput">other</code>. After the call, the constructed object becomes <code class="computeroutput">other</code>, while <code class="computeroutput">other</code> is left in default constructed state.</p>
308 <p>
309 </p>
310 <div class="variablelist"><table border="0" class="variablelist compact">
311 <colgroup>
312 <col align="left" valign="top">
313 <col>
314 </colgroup>
315 <tbody><tr>
316 <td><p><span class="term">Parameters:</span></p></td>
317 <td><div class="variablelist"><table border="0" class="variablelist compact">
318 <colgroup>
319 <col align="left" valign="top">
320 <col>
321 </colgroup>
322 <tbody><tr>
323 <td><p><span class="term"><code class="computeroutput">that</code></span></p></td>
324 <td><p>The object to be moved. </p></td>
325 </tr></tbody>
326 </table></div></td>
327 </tr></tbody>
328 </table></div>
329 </li>
330 <li class="listitem">
331 <pre class="literallayout"><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;</span> <a name="idp67454560-bb"></a><span class="keyword">operator</span><span class="special">=</span><span class="special">(</span><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
332 <p>Move assignment operator. If the object is associated with a message queue, <code class="computeroutput">close()</code> is first called and the precondition to calling <code class="computeroutput">close()</code> applies. After the call, the object becomes <span class="emphasis"><em>that</em></span> while <span class="emphasis"><em>that</em></span> is left in default constructed state.</p>
333 <p>
334
335 </p>
336 <div class="variablelist"><table border="0" class="variablelist compact">
337 <colgroup>
338 <col align="left" valign="top">
339 <col>
340 </colgroup>
341 <tbody>
342 <tr>
343 <td><p><span class="term">Parameters:</span></p></td>
344 <td><div class="variablelist"><table border="0" class="variablelist compact">
345 <colgroup>
346 <col align="left" valign="top">
347 <col>
348 </colgroup>
349 <tbody><tr>
350 <td><p><span class="term"><code class="computeroutput">that</code></span></p></td>
351 <td><p>The object to be moved.</p></td>
352 </tr></tbody>
353 </table></div></td>
354 </tr>
355 <tr>
356 <td><p><span class="term">Returns:</span></p></td>
357 <td><p>A reference to the assigned object. </p></td>
358 </tr>
359 </tbody>
360 </table></div>
361 </li>
362 <li class="listitem">
363 <pre class="literallayout"><a name="idp67449296-bb"></a><span class="special">~</span><span class="identifier">reliable_message_queue</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
364 <p>Destructor. Calls <code class="computeroutput">close()</code>. </p>
365 </li>
366 </ol></div>
367 </div>
368 <div class="refsect2">
369 <a name="idp134331840"></a><h3>
370 <a name="idp67250144-bb"></a><code class="computeroutput">reliable_message_queue</code> public member functions</h3>
371 <div class="orderedlist"><ol class="orderedlist" type="1">
372 <li class="listitem">
373 <pre class="literallayout"><span class="keyword">void</span> <a name="idp67250704-bb"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;</span> that<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
374 <p>The method swaps the object with <span class="emphasis"><em>that</em></span>.</p>
375 <p>
376 </p>
377 <div class="variablelist"><table border="0" class="variablelist compact">
378 <colgroup>
379 <col align="left" valign="top">
380 <col>
381 </colgroup>
382 <tbody><tr>
383 <td><p><span class="term">Parameters:</span></p></td>
384 <td><div class="variablelist"><table border="0" class="variablelist compact">
385 <colgroup>
386 <col align="left" valign="top">
387 <col>
388 </colgroup>
389 <tbody><tr>
390 <td><p><span class="term"><code class="computeroutput">that</code></span></p></td>
391 <td><p>The other object to swap with. </p></td>
392 </tr></tbody>
393 </table></div></td>
394 </tr></tbody>
395 </table></div>
396 </li>
397 <li class="listitem">
398 <pre class="literallayout"><span class="keyword">void</span> <a name="idp67254400-bb"></a><span class="identifier">create</span><span class="special">(</span><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> name<span class="special">,</span> <span class="identifier">uint32_t</span> capacity<span class="special">,</span> <span class="identifier">size_type</span> block_size<span class="special">,</span> 
399             <span class="identifier">overflow_policy</span> oflow_policy <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
400             <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> perms <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
401 <p>The method creates the message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully created.</p>
402 <p>
403
404
405 </p>
406 <div class="variablelist"><table border="0" class="variablelist compact">
407 <colgroup>
408 <col align="left" valign="top">
409 <col>
410 </colgroup>
411 <tbody>
412 <tr>
413 <td><p><span class="term">Parameters:</span></p></td>
414 <td><div class="variablelist"><table border="0" class="variablelist compact">
415 <colgroup>
416 <col align="left" valign="top">
417 <col>
418 </colgroup>
419 <tbody>
420 <tr>
421 <td><p><span class="term"><code class="computeroutput">block_size</code></span></p></td>
422 <td><p>Size in bytes of allocation block. Must be a power of 2. </p></td>
423 </tr>
424 <tr>
425 <td><p><span class="term"><code class="computeroutput">capacity</code></span></p></td>
426 <td><p>Maximum number of allocation blocks the queue can hold. </p></td>
427 </tr>
428 <tr>
429 <td><p><span class="term"><code class="computeroutput">name</code></span></p></td>
430 <td><p>Name of the message queue to be associated with. </p></td>
431 </tr>
432 <tr>
433 <td><p><span class="term"><code class="computeroutput">oflow_policy</code></span></p></td>
434 <td><p>Queue behavior policy in case of overflow. </p></td>
435 </tr>
436 <tr>
437 <td><p><span class="term"><code class="computeroutput">perms</code></span></p></td>
438 <td><p>Access permissions for the associated message queue. </p></td>
439 </tr>
440 </tbody>
441 </table></div></td>
442 </tr>
443 <tr>
444 <td><p><span class="term">Requires:</span></p></td>
445 <td><p><code class="computeroutput">is_open() == false</code> </p></td>
446 </tr>
447 <tr>
448 <td><p><span class="term">Postconditions:</span></p></td>
449 <td><p><code class="computeroutput">is_open() == true</code></p></td>
450 </tr>
451 </tbody>
452 </table></div>
453 </li>
454 <li class="listitem">
455 <pre class="literallayout"><span class="keyword">void</span> <a name="idp67264768-bb"></a><span class="identifier">open_or_create</span><span class="special">(</span><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> name<span class="special">,</span> <span class="identifier">uint32_t</span> capacity<span class="special">,</span> 
456                     <span class="identifier">size_type</span> block_size<span class="special">,</span> 
457                     <span class="identifier">overflow_policy</span> oflow_policy <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
458                     <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> perms <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
459 <p>The method creates or opens the message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully created or opened. If the message queue that is identified by the name already exists then the other queue parameters are ignored. The actual queue parameters can be obtained with accessors from this object after this method returns.</p>
460 <p>
461
462
463 </p>
464 <div class="variablelist"><table border="0" class="variablelist compact">
465 <colgroup>
466 <col align="left" valign="top">
467 <col>
468 </colgroup>
469 <tbody>
470 <tr>
471 <td><p><span class="term">Parameters:</span></p></td>
472 <td><div class="variablelist"><table border="0" class="variablelist compact">
473 <colgroup>
474 <col align="left" valign="top">
475 <col>
476 </colgroup>
477 <tbody>
478 <tr>
479 <td><p><span class="term"><code class="computeroutput">block_size</code></span></p></td>
480 <td><p>Size in bytes of allocation block. Must be a power of 2. </p></td>
481 </tr>
482 <tr>
483 <td><p><span class="term"><code class="computeroutput">capacity</code></span></p></td>
484 <td><p>Maximum number of allocation blocks the queue can hold. </p></td>
485 </tr>
486 <tr>
487 <td><p><span class="term"><code class="computeroutput">name</code></span></p></td>
488 <td><p>Name of the message queue to be associated with. </p></td>
489 </tr>
490 <tr>
491 <td><p><span class="term"><code class="computeroutput">oflow_policy</code></span></p></td>
492 <td><p>Queue behavior policy in case of overflow. </p></td>
493 </tr>
494 <tr>
495 <td><p><span class="term"><code class="computeroutput">perms</code></span></p></td>
496 <td><p>Access permissions for the associated message queue. </p></td>
497 </tr>
498 </tbody>
499 </table></div></td>
500 </tr>
501 <tr>
502 <td><p><span class="term">Requires:</span></p></td>
503 <td><p><code class="computeroutput">is_open() == false</code> </p></td>
504 </tr>
505 <tr>
506 <td><p><span class="term">Postconditions:</span></p></td>
507 <td><p><code class="computeroutput">is_open() == true</code></p></td>
508 </tr>
509 </tbody>
510 </table></div>
511 </li>
512 <li class="listitem">
513 <pre class="literallayout"><span class="keyword">void</span> <a name="idp67275376-bb"></a><span class="identifier">open</span><span class="special">(</span><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> name<span class="special">,</span> 
514           <span class="identifier">overflow_policy</span> oflow_policy <span class="special">=</span> <span class="identifier">block_on_overflow</span><span class="special">,</span> 
515           <a class="link" href="../permissions.html" title="Class permissions">permissions</a> <span class="keyword">const</span> <span class="special">&amp;</span> perms <span class="special">=</span> <a class="link" href="../permissions.html" title="Class permissions">permissions</a><span class="special">(</span><span class="special">)</span><span class="special">)</span><span class="special">;</span></pre>
516 <p>The method opens the existing message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully opened.</p>
517 <p>
518
519
520 </p>
521 <div class="variablelist"><table border="0" class="variablelist compact">
522 <colgroup>
523 <col align="left" valign="top">
524 <col>
525 </colgroup>
526 <tbody>
527 <tr>
528 <td><p><span class="term">Parameters:</span></p></td>
529 <td><div class="variablelist"><table border="0" class="variablelist compact">
530 <colgroup>
531 <col align="left" valign="top">
532 <col>
533 </colgroup>
534 <tbody>
535 <tr>
536 <td><p><span class="term"><code class="computeroutput">name</code></span></p></td>
537 <td><p>Name of the message queue to be associated with. </p></td>
538 </tr>
539 <tr>
540 <td><p><span class="term"><code class="computeroutput">oflow_policy</code></span></p></td>
541 <td><p>Queue behavior policy in case of overflow. </p></td>
542 </tr>
543 <tr>
544 <td><p><span class="term"><code class="computeroutput">perms</code></span></p></td>
545 <td><p>Access permissions for the associated message queue. The permissions will only be used if the queue implementation has to create system objects while operating. This parameter is currently not used on POSIX systems. </p></td>
546 </tr>
547 </tbody>
548 </table></div></td>
549 </tr>
550 <tr>
551 <td><p><span class="term">Requires:</span></p></td>
552 <td><p><code class="computeroutput">is_open() == false</code> </p></td>
553 </tr>
554 <tr>
555 <td><p><span class="term">Postconditions:</span></p></td>
556 <td><p><code class="computeroutput">is_open() == true</code></p></td>
557 </tr>
558 </tbody>
559 </table></div>
560 </li>
561 <li class="listitem">
562 <pre class="literallayout"><span class="keyword">bool</span> <a name="idp67283632-bb"></a><span class="identifier">is_open</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
563 <p>Tests whether the object is associated with any message queue.</p>
564 <p>
565 </p>
566 <div class="variablelist"><table border="0" class="variablelist compact">
567 <colgroup>
568 <col align="left" valign="top">
569 <col>
570 </colgroup>
571 <tbody><tr>
572 <td><p><span class="term">Returns:</span></p></td>
573 <td><p><code class="computeroutput">true</code> if the object is associated with a message queue, and <code class="computeroutput">false</code> otherwise. </p></td>
574 </tr></tbody>
575 </table></div>
576 </li>
577 <li class="listitem">
578 <pre class="literallayout"><span class="keyword">void</span> <a name="idp67286688-bb"></a><span class="identifier">clear</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
579 <p>This method empties the associated message queue. Concurrent calls to this method, <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, and <code class="computeroutput">stop_local()</code> are allowed.</p>
580 <p>
581 </p>
582 <div class="variablelist"><table border="0" class="variablelist compact">
583 <colgroup>
584 <col align="left" valign="top">
585 <col>
586 </colgroup>
587 <tbody><tr>
588 <td><p><span class="term">Requires:</span></p></td>
589 <td><p><code class="computeroutput">is_open() == true</code> </p></td>
590 </tr></tbody>
591 </table></div>
592 </li>
593 <li class="listitem">
594 <pre class="literallayout"><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> <a name="idp67291248-bb"></a><span class="identifier">name</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
595 <p>The method returns the name of the associated message queue.</p>
596 <p>
597
598 </p>
599 <div class="variablelist"><table border="0" class="variablelist compact">
600 <colgroup>
601 <col align="left" valign="top">
602 <col>
603 </colgroup>
604 <tbody>
605 <tr>
606 <td><p><span class="term">Requires:</span></p></td>
607 <td><p><code class="computeroutput">is_open() == true</code></p></td>
608 </tr>
609 <tr>
610 <td><p><span class="term">Returns:</span></p></td>
611 <td><p>Name of the associated message queue </p></td>
612 </tr>
613 </tbody>
614 </table></div>
615 </li>
616 <li class="listitem">
617 <pre class="literallayout"><span class="identifier">uint32_t</span> <a name="idp67294384-bb"></a><span class="identifier">capacity</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
618 <p>The method returns the maximum number of allocation blocks the associated message queue can hold. Note that the returned value may be different from the corresponding value passed to the constructor or <code class="computeroutput">open_or_create()</code>, for the message queue may not have been created by this object.</p>
619 <p>
620
621 </p>
622 <div class="variablelist"><table border="0" class="variablelist compact">
623 <colgroup>
624 <col align="left" valign="top">
625 <col>
626 </colgroup>
627 <tbody>
628 <tr>
629 <td><p><span class="term">Requires:</span></p></td>
630 <td><p><code class="computeroutput">is_open() == true</code></p></td>
631 </tr>
632 <tr>
633 <td><p><span class="term">Returns:</span></p></td>
634 <td><p>Maximum number of allocation blocks the associated message queue can hold. </p></td>
635 </tr>
636 </tbody>
637 </table></div>
638 </li>
639 <li class="listitem">
640 <pre class="literallayout"><span class="identifier">size_type</span> <a name="idp67297920-bb"></a><span class="identifier">block_size</span><span class="special">(</span><span class="special">)</span> <span class="keyword">const</span><span class="special">;</span></pre>
641 <p>The method returns the allocation block size, in bytes. Each message in the associated message queue consumes an integer number of allocation blocks. Note that the returned value may be different from the corresponding value passed to the constructor or <code class="computeroutput">open_or_create()</code>, for the message queue may not have been created by this object.</p>
642 <p>
643
644 </p>
645 <div class="variablelist"><table border="0" class="variablelist compact">
646 <colgroup>
647 <col align="left" valign="top">
648 <col>
649 </colgroup>
650 <tbody>
651 <tr>
652 <td><p><span class="term">Requires:</span></p></td>
653 <td><p><code class="computeroutput">is_open() == true</code></p></td>
654 </tr>
655 <tr>
656 <td><p><span class="term">Returns:</span></p></td>
657 <td><p>Allocation block size, in bytes. </p></td>
658 </tr>
659 </tbody>
660 </table></div>
661 </li>
662 <li class="listitem">
663 <pre class="literallayout"><span class="keyword">void</span> <a name="idp67301456-bb"></a><span class="identifier">stop_local</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
664 <p>The method wakes up all threads that are blocked in calls to <code class="computeroutput">send()</code> or <code class="computeroutput">receive()</code>. Those calls would then return <code class="computeroutput">false</code> with <code class="computeroutput">errno</code> <code class="computeroutput">EINTR</code>. Note that, the method does not block until the woken-up threads have actually returned from <code class="computeroutput">send()</code> or <code class="computeroutput">receive()</code>. Other means is needed to ensure that calls to <code class="computeroutput">send()</code> or <code class="computeroutput">receive()</code> have returned, e.g., joining the threads that might be blocking on the calls.</p>
665 <p>The method also puts the object in stopped state. When in stopped state, calls to <code class="computeroutput">send()</code> or <code class="computeroutput">receive()</code> will return immediately with return value <code class="computeroutput">false</code> and <code class="computeroutput">errno</code> <code class="computeroutput">EINTR</code> when they would otherwise block in running state.</p>
666 <p>Concurrent calls to this method, <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
667 <p>
668 </p>
669 <div class="variablelist"><table border="0" class="variablelist compact">
670 <colgroup>
671 <col align="left" valign="top">
672 <col>
673 </colgroup>
674 <tbody><tr>
675 <td><p><span class="term">Requires:</span></p></td>
676 <td><p><code class="computeroutput">is_open() == true</code> </p></td>
677 </tr></tbody>
678 </table></div>
679 </li>
680 <li class="listitem">
681 <pre class="literallayout"><span class="keyword">void</span> <a name="idp67313184-bb"></a><span class="identifier">reset_local</span><span class="special">(</span><span class="special">)</span><span class="special">;</span></pre>
682 <p>The method puts the object in running state where calls to <code class="computeroutput">send()</code> or <code class="computeroutput">receive()</code> may block. This method is not thread-safe.</p>
683 <p>
684 </p>
685 <div class="variablelist"><table border="0" class="variablelist compact">
686 <colgroup>
687 <col align="left" valign="top">
688 <col>
689 </colgroup>
690 <tbody><tr>
691 <td><p><span class="term">Requires:</span></p></td>
692 <td><p><code class="computeroutput">is_open() == true</code> </p></td>
693 </tr></tbody>
694 </table></div>
695 </li>
696 <li class="listitem">
697 <pre class="literallayout"><span class="keyword">void</span> <a name="idp67316416-bb"></a><span class="identifier">close</span><span class="special">(</span><span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>
698 <p>The method disassociates the associated message queue, if any. No other threads should be using this object before calling this method. The <code class="computeroutput">stop_local()</code> method can be used to have any threads currently blocked in <code class="computeroutput">send()</code> or <code class="computeroutput">receive()</code> return, and prevent further calls to them from blocking. Typically, before calling this method, one would first call <code class="computeroutput">stop_local()</code> and then join all threads that might be blocking on <code class="computeroutput">send()</code> or <code class="computeroutput">receive()</code> to ensure that they have returned from the calls. The associated message queue is destroyed if the object represents the last outstanding reference to it.</p>
699 <p>
700 </p>
701 <div class="variablelist"><table border="0" class="variablelist compact">
702 <colgroup>
703 <col align="left" valign="top">
704 <col>
705 </colgroup>
706 <tbody><tr>
707 <td><p><span class="term">Postconditions:</span></p></td>
708 <td><p><code class="computeroutput">is_open() == false</code> </p></td>
709 </tr></tbody>
710 </table></div>
711 </li>
712 <li class="listitem">
713 <pre class="literallayout"><span class="identifier">operation_result</span> <a name="idp67322080-bb"></a><span class="identifier">send</span><span class="special">(</span><span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span> message_data<span class="special">,</span> <span class="identifier">size_type</span> message_size<span class="special">)</span><span class="special">;</span></pre>
714 <p>The method sends a message to the associated message queue. When the object is in running state and the queue has no free space for the message, the method either blocks or throws an exception, depending on the overflow policy that was specified on the queue opening/creation. If blocking policy is in effect, the blocking can be interrupted by calling <code class="computeroutput">stop_local()</code>, in which case the method returns <code class="computeroutput">operation_result::aborted</code>. When the object is already in the stopped state, the method does not block but returns immediately with return value <code class="computeroutput">operation_result::aborted</code>.</p>
715 <p>It is possible to send an empty message by passing <code class="computeroutput">0</code> to the parameter <code class="computeroutput">message_size</code>.</p>
716 <p>Concurrent calls to <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, <code class="computeroutput">stop_local()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
717 <p>
718
719
720 <span class="bold"><strong>Throws:</strong></span> <code class="computeroutput">std::logic_error</code> in case if the message size exceeds the queue capacity, <code class="computeroutput">system_error</code> in case if a native OS method fails. </p>
721 <div class="variablelist"><table border="0" class="variablelist compact">
722 <colgroup>
723 <col align="left" valign="top">
724 <col>
725 </colgroup>
726 <tbody>
727 <tr>
728 <td><p><span class="term">Parameters:</span></p></td>
729 <td><div class="variablelist"><table border="0" class="variablelist compact">
730 <colgroup>
731 <col align="left" valign="top">
732 <col>
733 </colgroup>
734 <tbody>
735 <tr>
736 <td><p><span class="term"><code class="computeroutput">message_data</code></span></p></td>
737 <td><p>The message data to send. Ignored when <code class="computeroutput">message_size</code> is <code class="computeroutput">0</code>. </p></td>
738 </tr>
739 <tr>
740 <td><p><span class="term"><code class="computeroutput">message_size</code></span></p></td>
741 <td><p>Size of the message data in bytes. If the size is larger than the associated message queue capacity, an <code class="computeroutput">std::logic_error</code> exception is thrown.</p></td>
742 </tr>
743 </tbody>
744 </table></div></td>
745 </tr>
746 <tr>
747 <td><p><span class="term">Requires:</span></p></td>
748 <td><p><code class="computeroutput">is_open() == true</code></p></td>
749 </tr>
750 </tbody>
751 </table></div>
752 </li>
753 <li class="listitem">
754 <pre class="literallayout"><span class="keyword">bool</span> <a name="idp67335536-bb"></a><span class="identifier">try_send</span><span class="special">(</span><span class="keyword">void</span> <span class="keyword">const</span> <span class="special">*</span> message_data<span class="special">,</span> <span class="identifier">size_type</span> message_size<span class="special">)</span><span class="special">;</span></pre>
755 <p>The method performs an attempt to send a message to the associated message queue. The method is non-blocking, and always returns immediately. <code class="computeroutput">boost::system::system_error</code> is thrown for errors resulting from native operating system calls. Note that it is possible to send an empty message by passing <code class="computeroutput">0</code> to the parameter <code class="computeroutput">message_size</code>. Concurrent calls to <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, <code class="computeroutput">stop_local()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
756 <p>
757
758
759 <span class="bold"><strong>Throws:</strong></span> <code class="computeroutput">std::logic_error</code> in case if the message size exceeds the queue capacity, <code class="computeroutput">system_error</code> in case if a native OS method fails. </p>
760 <div class="variablelist"><table border="0" class="variablelist compact">
761 <colgroup>
762 <col align="left" valign="top">
763 <col>
764 </colgroup>
765 <tbody>
766 <tr>
767 <td><p><span class="term">Parameters:</span></p></td>
768 <td><div class="variablelist"><table border="0" class="variablelist compact">
769 <colgroup>
770 <col align="left" valign="top">
771 <col>
772 </colgroup>
773 <tbody>
774 <tr>
775 <td><p><span class="term"><code class="computeroutput">message_data</code></span></p></td>
776 <td><p>The message data to send. Ignored when <code class="computeroutput">message_size</code> is <code class="computeroutput">0</code>. </p></td>
777 </tr>
778 <tr>
779 <td><p><span class="term"><code class="computeroutput">message_size</code></span></p></td>
780 <td><p>Size of the message data in bytes. If the size is larger than the maximum size allowed by the associated message queue, an <code class="computeroutput">std::logic_error</code> exception is thrown.</p></td>
781 </tr>
782 </tbody>
783 </table></div></td>
784 </tr>
785 <tr>
786 <td><p><span class="term">Requires:</span></p></td>
787 <td><p><code class="computeroutput">is_open() == true</code></p></td>
788 </tr>
789 <tr>
790 <td><p><span class="term">Returns:</span></p></td>
791 <td><p><code class="computeroutput">true</code> if the message is successfully sent, and <code class="computeroutput">false</code> otherwise (e.g., when the queue is full).</p></td>
792 </tr>
793 </tbody>
794 </table></div>
795 </li>
796 <li class="listitem">
797 <pre class="literallayout"><span class="identifier">operation_result</span> 
798 <a name="idp67348496-bb"></a><span class="identifier">receive</span><span class="special">(</span><span class="keyword">void</span> <span class="special">*</span> buffer<span class="special">,</span> <span class="identifier">size_type</span> buffer_size<span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&amp;</span> message_size<span class="special">)</span><span class="special">;</span></pre>
799 <p>The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when <code class="computeroutput">stop_local()</code> is called, in which case the method returns <code class="computeroutput">operation_result::aborted</code>. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value <code class="computeroutput">operation_result::aborted</code>.</p>
800 <p>Concurrent calls to <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, <code class="computeroutput">stop_local()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
801 <p>
802
803
804 </p>
805 <div class="variablelist"><table border="0" class="variablelist compact">
806 <colgroup>
807 <col align="left" valign="top">
808 <col>
809 </colgroup>
810 <tbody>
811 <tr>
812 <td><p><span class="term">Parameters:</span></p></td>
813 <td><div class="variablelist"><table border="0" class="variablelist compact">
814 <colgroup>
815 <col align="left" valign="top">
816 <col>
817 </colgroup>
818 <tbody>
819 <tr>
820 <td><p><span class="term"><code class="computeroutput">buffer</code></span></p></td>
821 <td><p>The memory buffer to store the received message in. </p></td>
822 </tr>
823 <tr>
824 <td><p><span class="term"><code class="computeroutput">buffer_size</code></span></p></td>
825 <td><p>The size of the buffer, in bytes. </p></td>
826 </tr>
827 <tr>
828 <td><p><span class="term"><code class="computeroutput">message_size</code></span></p></td>
829 <td><p>Receives the size of the received message, in bytes.</p></td>
830 </tr>
831 </tbody>
832 </table></div></td>
833 </tr>
834 <tr>
835 <td><p><span class="term">Requires:</span></p></td>
836 <td><p><code class="computeroutput">is_open() == true</code></p></td>
837 </tr>
838 </tbody>
839 </table></div>
840 </li>
841 <li class="listitem">
842 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ElementT<span class="special">,</span> <span class="identifier">size_type</span> SizeV<span class="special">&gt;</span> 
843   <span class="identifier">operation_result</span> <a name="idp67358656-bb"></a><span class="identifier">receive</span><span class="special">(</span><span class="identifier">ElementT</span><span class="special">(</span><span class="special">&amp;</span><span class="special">)</span> buffer<span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&amp;</span> message_size<span class="special">)</span><span class="special">;</span></pre>
844 <p>The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when <code class="computeroutput">stop_local()</code> is called, in which case the method returns <code class="computeroutput">operation_result::aborted</code>. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value <code class="computeroutput">operation_result::aborted</code>.</p>
845 <p>Concurrent calls to <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, <code class="computeroutput">stop_local()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
846 <p>
847
848
849 </p>
850 <div class="variablelist"><table border="0" class="variablelist compact">
851 <colgroup>
852 <col align="left" valign="top">
853 <col>
854 </colgroup>
855 <tbody>
856 <tr>
857 <td><p><span class="term">Parameters:</span></p></td>
858 <td><div class="variablelist"><table border="0" class="variablelist compact">
859 <colgroup>
860 <col align="left" valign="top">
861 <col>
862 </colgroup>
863 <tbody>
864 <tr>
865 <td><p><span class="term"><code class="computeroutput">buffer</code></span></p></td>
866 <td><p>The memory buffer to store the received message in. </p></td>
867 </tr>
868 <tr>
869 <td><p><span class="term"><code class="computeroutput">message_size</code></span></p></td>
870 <td><p>Receives the size of the received message, in bytes.</p></td>
871 </tr>
872 </tbody>
873 </table></div></td>
874 </tr>
875 <tr>
876 <td><p><span class="term">Requires:</span></p></td>
877 <td><p><code class="computeroutput">is_open() == true</code></p></td>
878 </tr>
879 </tbody>
880 </table></div>
881 </li>
882 <li class="listitem">
883 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ContainerT<span class="special">&gt;</span> <span class="identifier">operation_result</span> <a name="idp67369392-bb"></a><span class="identifier">receive</span><span class="special">(</span><span class="identifier">ContainerT</span> <span class="special">&amp;</span> container<span class="special">)</span><span class="special">;</span></pre>
884 <p>The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when <code class="computeroutput">stop_local()</code> is called, in which case the method returns <code class="computeroutput">operation_result::aborted</code>. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value <code class="computeroutput">operation_result::aborted</code>.</p>
885 <p>Concurrent calls to <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, <code class="computeroutput">stop_local()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
886 <p>
887
888
889 </p>
890 <div class="variablelist"><table border="0" class="variablelist compact">
891 <colgroup>
892 <col align="left" valign="top">
893 <col>
894 </colgroup>
895 <tbody>
896 <tr>
897 <td><p><span class="term">Parameters:</span></p></td>
898 <td><div class="variablelist"><table border="0" class="variablelist compact">
899 <colgroup>
900 <col align="left" valign="top">
901 <col>
902 </colgroup>
903 <tbody><tr>
904 <td><p><span class="term"><code class="computeroutput">container</code></span></p></td>
905 <td><p>The container to store the received message in. The container should have value type of <code class="computeroutput">char</code>, <code class="computeroutput">signed char</code> or <code class="computeroutput">unsigned char</code> and support inserting elements at the end.</p></td>
906 </tr></tbody>
907 </table></div></td>
908 </tr>
909 <tr>
910 <td><p><span class="term">Requires:</span></p></td>
911 <td><p><code class="computeroutput">is_open() == true</code></p></td>
912 </tr>
913 </tbody>
914 </table></div>
915 </li>
916 <li class="listitem">
917 <pre class="literallayout"><span class="keyword">bool</span> <a name="idp67379568-bb"></a><span class="identifier">try_receive</span><span class="special">(</span><span class="keyword">void</span> <span class="special">*</span> buffer<span class="special">,</span> <span class="identifier">size_type</span> buffer_size<span class="special">,</span> 
918                  <span class="identifier">size_type</span> <span class="special">&amp;</span> message_size<span class="special">)</span><span class="special">;</span></pre>
919 <p>The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.</p>
920 <p>Concurrent calls to <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, <code class="computeroutput">stop_local()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
921 <p>
922
923
924 </p>
925 <div class="variablelist"><table border="0" class="variablelist compact">
926 <colgroup>
927 <col align="left" valign="top">
928 <col>
929 </colgroup>
930 <tbody>
931 <tr>
932 <td><p><span class="term">Parameters:</span></p></td>
933 <td><div class="variablelist"><table border="0" class="variablelist compact">
934 <colgroup>
935 <col align="left" valign="top">
936 <col>
937 </colgroup>
938 <tbody>
939 <tr>
940 <td><p><span class="term"><code class="computeroutput">buffer</code></span></p></td>
941 <td><p>The memory buffer to store the received message in. </p></td>
942 </tr>
943 <tr>
944 <td><p><span class="term"><code class="computeroutput">buffer_size</code></span></p></td>
945 <td><p>The size of the buffer, in bytes. </p></td>
946 </tr>
947 <tr>
948 <td><p><span class="term"><code class="computeroutput">message_size</code></span></p></td>
949 <td><p>Receives the size of the received message, in bytes.</p></td>
950 </tr>
951 </tbody>
952 </table></div></td>
953 </tr>
954 <tr>
955 <td><p><span class="term">Requires:</span></p></td>
956 <td><p><code class="computeroutput">is_open() == true</code></p></td>
957 </tr>
958 <tr>
959 <td><p><span class="term">Returns:</span></p></td>
960 <td><p><code class="computeroutput">true</code> if a message is successfully received, and <code class="computeroutput">false</code> otherwise (e.g., when the queue is empty). </p></td>
961 </tr>
962 </tbody>
963 </table></div>
964 </li>
965 <li class="listitem">
966 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ElementT<span class="special">,</span> <span class="identifier">size_type</span> SizeV<span class="special">&gt;</span> 
967   <span class="keyword">bool</span> <a name="idp67389376-bb"></a><span class="identifier">try_receive</span><span class="special">(</span><span class="identifier">ElementT</span><span class="special">(</span><span class="special">&amp;</span><span class="special">)</span> buffer<span class="special">,</span> <span class="identifier">size_type</span> <span class="special">&amp;</span> message_size<span class="special">)</span><span class="special">;</span></pre>
968 <p>The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.</p>
969 <p>Concurrent calls to <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, <code class="computeroutput">stop_local()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
970 <p>
971
972
973 </p>
974 <div class="variablelist"><table border="0" class="variablelist compact">
975 <colgroup>
976 <col align="left" valign="top">
977 <col>
978 </colgroup>
979 <tbody>
980 <tr>
981 <td><p><span class="term">Parameters:</span></p></td>
982 <td><div class="variablelist"><table border="0" class="variablelist compact">
983 <colgroup>
984 <col align="left" valign="top">
985 <col>
986 </colgroup>
987 <tbody>
988 <tr>
989 <td><p><span class="term"><code class="computeroutput">buffer</code></span></p></td>
990 <td><p>The memory buffer to store the received message in. </p></td>
991 </tr>
992 <tr>
993 <td><p><span class="term"><code class="computeroutput">message_size</code></span></p></td>
994 <td><p>Receives the size of the received message, in bytes.</p></td>
995 </tr>
996 </tbody>
997 </table></div></td>
998 </tr>
999 <tr>
1000 <td><p><span class="term">Requires:</span></p></td>
1001 <td><p><code class="computeroutput">is_open() == true</code></p></td>
1002 </tr>
1003 <tr>
1004 <td><p><span class="term">Returns:</span></p></td>
1005 <td><p><code class="computeroutput">true</code> if a message is successfully received, and <code class="computeroutput">false</code> otherwise (e.g., when the queue is empty). </p></td>
1006 </tr>
1007 </tbody>
1008 </table></div>
1009 </li>
1010 <li class="listitem">
1011 <pre class="literallayout"><span class="keyword">template</span><span class="special">&lt;</span><span class="keyword">typename</span> ContainerT<span class="special">&gt;</span> <span class="keyword">bool</span> <a name="idp67399760-bb"></a><span class="identifier">try_receive</span><span class="special">(</span><span class="identifier">ContainerT</span> <span class="special">&amp;</span> container<span class="special">)</span><span class="special">;</span></pre>
1012 <p>The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.</p>
1013 <p>Concurrent calls to <code class="computeroutput">send()</code>, <code class="computeroutput">try_send()</code>, <code class="computeroutput">receive()</code>, <code class="computeroutput">try_receive()</code>, <code class="computeroutput">stop_local()</code>, and <code class="computeroutput">clear()</code> are allowed.</p>
1014 <p>
1015
1016
1017 </p>
1018 <div class="variablelist"><table border="0" class="variablelist compact">
1019 <colgroup>
1020 <col align="left" valign="top">
1021 <col>
1022 </colgroup>
1023 <tbody>
1024 <tr>
1025 <td><p><span class="term">Parameters:</span></p></td>
1026 <td><div class="variablelist"><table border="0" class="variablelist compact">
1027 <colgroup>
1028 <col align="left" valign="top">
1029 <col>
1030 </colgroup>
1031 <tbody><tr>
1032 <td><p><span class="term"><code class="computeroutput">container</code></span></p></td>
1033 <td><p>The container to store the received message in. The container should have value type of <code class="computeroutput">char</code>, <code class="computeroutput">signed char</code> or <code class="computeroutput">unsigned char</code> and support inserting elements at the end.</p></td>
1034 </tr></tbody>
1035 </table></div></td>
1036 </tr>
1037 <tr>
1038 <td><p><span class="term">Requires:</span></p></td>
1039 <td><p><code class="computeroutput">is_open() == true</code></p></td>
1040 </tr>
1041 <tr>
1042 <td><p><span class="term">Returns:</span></p></td>
1043 <td><p><code class="computeroutput">true</code> if a message is successfully received, and <code class="computeroutput">false</code> otherwise (e.g., when the queue is empty). </p></td>
1044 </tr>
1045 </tbody>
1046 </table></div>
1047 </li>
1048 </ol></div>
1049 </div>
1050 <div class="refsect2">
1051 <a name="idp134709616"></a><h3>
1052 <a name="idp67460160-bb"></a><code class="computeroutput">reliable_message_queue</code> friend functions</h3>
1053 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
1054 <pre class="literallayout"><span class="keyword">friend</span> <span class="keyword">void</span> <a name="idp67460720-bb"></a><span class="identifier">swap</span><span class="special">(</span><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;</span> a<span class="special">,</span> <a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a> <span class="special">&amp;</span> b<span class="special">)</span> <span class="keyword">noexcept</span><span class="special">;</span></pre>Swaps the two <code class="computeroutput"><code class="computeroutput"><a class="link" href="reliable_message_queue.html" title="Class reliable_message_queue">reliable_message_queue</a></code></code> objects. </li></ol></div>
1055 </div>
1056 <div class="refsect2">
1057 <a name="idp134723184"></a><h3>
1058 <a name="idp67465104-bb"></a><code class="computeroutput">reliable_message_queue</code> public static functions</h3>
1059 <div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem">
1060 <pre class="literallayout"><span class="keyword">static</span> <span class="keyword">void</span> <a name="idp67465664-bb"></a><span class="identifier">remove</span><span class="special">(</span><a class="link" href="object_name.html" title="Class object_name">object_name</a> <span class="keyword">const</span> <span class="special">&amp;</span> name<span class="special">)</span><span class="special">;</span></pre>
1061 <p>The method frees system-wide resources, associated with the interprocess queue with the supplied name. The queue referred to by the specified name must not be opened in any process at the point of this call. After this call succeeds a new queue with the specified name can be created.</p>
1062 <p>This call can be useful to recover from an earlier process misbehavior (e.g. a crash without properly closing the message queue). In this case resources allocated for the interprocess queue may remain allocated after the last process closed the queue, which in turn may prevent creating a new queue with the same name. By calling this method before creating a queue the application can attempt to ensure it starts with a clean slate.</p>
1063 <p>On some platforms resources associated with the queue are automatically reclaimed by the operating system when the last process using those resources terminates (even if it terminates abnormally). On these platforms this call may be a no-op. However, portable code should still call this method at appropriate places to ensure compatibility with other platforms and future library versions, which may change implementation of the queue.</p>
1064 <p>
1065 </p>
1066 <div class="variablelist"><table border="0" class="variablelist compact">
1067 <colgroup>
1068 <col align="left" valign="top">
1069 <col>
1070 </colgroup>
1071 <tbody><tr>
1072 <td><p><span class="term">Parameters:</span></p></td>
1073 <td><div class="variablelist"><table border="0" class="variablelist compact">
1074 <colgroup>
1075 <col align="left" valign="top">
1076 <col>
1077 </colgroup>
1078 <tbody><tr>
1079 <td><p><span class="term"><code class="computeroutput">name</code></span></p></td>
1080 <td><p>Name of the message queue to be removed. </p></td>
1081 </tr></tbody>
1082 </table></div></td>
1083 </tr></tbody>
1084 </table></div>
1085 </li></ol></div>
1086 </div>
1087 </div>
1088 </div>
1089 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
1090 <td align="left"></td>
1091 <td align="right"><div class="copyright-footer">Copyright &#169; 2007-2016 Andrey Semashev<p>
1092         Distributed under the Boost Software License, Version 1.0. (See accompanying
1093         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>).
1094       </p>
1095 </div></td>
1096 </tr></table>
1097 <hr>
1098 <div class="spirit-nav">
1099 <a accesskey="p" href="object_name.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../../utilities.html#header.boost.log.utility.ipc.reliable_message_queue_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="../add_value_manip.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
1100 </div>
1101 </body>
1102 </html>