haiku-website/static/legacy-docs/bebook/BMessageQueue.html

45 lines
12 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>The Be Book - Classes And Methods - The Application Kit</title><link rel="stylesheet" href="be_book.css" type="text/css" media="all" /><link rel="shortcut icon" type="image/vnd.microsoft.icon" href="./images/favicon.ico" /><!--[if IE]>
<link rel="stylesheet" type="text/css" href="be_book_ie.css" />
<![endif]--><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><meta name="keywords" content="Access, BeOS, BeBook, API" /><link rel="start" href="index.html" title="The Be Book" /><link rel="up" href="TheApplicationKit.html" title="The Application Kit" /><link rel="prev" href="BMessageFilter.html" title="BMessageFilter" /><link rel="next" href="BMessageRunner.html" title="BMessageRunner" /></head><body><div id="header"><div id="headerT"><div id="headerTL"><a accesskey="p" href="BMessageFilter.html" title="BMessageFilter"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a accesskey="u" href="TheApplicationKit.html" title="The Application Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a accesskey="n" href="BMessageRunner.html" title="BMessageRunner"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="headerTR"><div id="navigpeople"><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div><div class="navigboxed" id="navigindex"><a accesskey="i" href="ClassIndex.html" title="Index">I</a></div><div class="navigboxed" id="naviglang" title="English">en</div></div><div id="headerTC">The Be Book - Classes And Methods - The Application Kit</div></div><div id="headerB">Prev: <a href="BMessageFilter.html">BMessageFilter</a>  Up: <a href="TheApplicationKit.html">The Application Kit</a>  Next: <a href="BMessageRunner.html">BMessageRunner</a></div><hr /></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h2 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue"></a>BMessageQueue</h2></div></div></div><a id="id931385" class="indexterm"></a><div class="classheader"><table border="0"><colgroup><col /><col /></colgroup><tbody><tr><td><table width="100%" border="0"><colgroup><col /><col /></colgroup><tbody><tr><td>Derived From:</td><td></td></tr><tr><td>Mix-in Classes:</td><td></td></tr><tr><td>Declared In:</td><td><code class="filename">app/MessageQueue.h</code></td></tr><tr><td>Library:</td><td><code class="filename">libbe.so</code></td></tr><tr><td>Allocation:</td><td></td></tr></tbody></table></td><td>
<a class="link overview" href="BMessageQueue_Overview.html" title="BMessageQueue">Class Overview</a>
<div class="toc"><ul><li><span class="section"><a href="BMessageQueue.html#BMessageQueue_ConstructorDestructor">Constructor and Destructor</a></span></li><li><span class="section"><a href="BMessageQueue.html#BMessageQueue_MemberFunctions">Member Functions</a></span></li></ul></div>
</td></tr></tbody></table></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_ConstructorDestructor"></a>Constructor and Destructor</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_Constructor"></a>BMessageQueue</h4></div></div></div><code class="constructorsynopsis cpp"><span class="methodname">BMessageQueue</span>();</code><p>
Creates an empty <code class="classname">BMessageQueue</code> object.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_Destructor"></a>~BMessageQueue()</h4></div></div></div><code class="destructorsynopsis cpp"><span class="modifier">virtual </span><span class="methodname">~BMessageQueue</span>();</code><p>Deletes all the objects in the queue and all the data structures used
to manage the queue.</p></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><hr /><div xmlns:d="http://docbook.org/ns/docbook"><h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_MemberFunctions"></a>Member Functions</h3></div></div></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_AddMessage"></a><a id="BMessageQueue_RemoveMessage"></a>
AddMessage(), RemoveMessage()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">void </span><span class="methodname">AddMessage</span>(<span class="methodparam"><span class="type">BMessage* </span><span class="parameter">message</span></span>);</code><code class="methodsynopsis cpp"><span class="type">void </span><span class="methodname">RemoveMessage</span>(<span class="methodparam"><span class="type">BMessage* </span><span class="parameter">message</span></span>);</code><p>
<code class="methodname">AddMessage()</code> adds message to the far end of the
queue. <code class="methodname">RemoveMessage()</code> removes a particular
message from the queue and deletes it.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_CountMessages"></a><a id="BMessageQueue_IsEmpty"></a>
CountMessages(), IsEmpty()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">int32 </span><span class="methodname">CountMessages</span>() <span class="modifier">const</span>;</code><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">IsEmpty</span>() <span class="modifier">const</span>;</code><p><code class="methodname">CountMessages()</code> returns the number of
messages currently in the queue.</p><p><code class="methodname">IsEmpty()</code> returns <code class="constant">true</code> if the
object doesn't contain any messages, and <code class="constant">false</code>
otherwise.</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_FindMessage"></a>FindMessage()</h4></div></div></div><div class="synopsisgroup">
<code class="methodsynopsis cpp"><span class="type">BMessage* </span><span class="methodname">FindMessage</span>(<span class="methodparam"><span class="type">int32 </span><span class="parameter">index</span></span>) <span class="modifier">const</span>;</code>
<code class="methodsynopsis cpp"><span class="type">BMessage* </span><span class="methodname">FindMessage</span>(<span class="methodparam"><span class="type">uint32 </span><span class="parameter">what</span></span>,<br />                      <span class="methodparam"><span class="type">int32 </span><span class="parameter">index</span><span class="initializer"> = 0</span></span>) <span class="modifier">const</span>;</code>
</div><p><code class="methodname">FindMessage()</code> returns a pointer to the
<code class="parameter">index</code>'th
<a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a> in the
queue, where index 0 signifies the message that's been in the queue the
longest. The second version lets you specify a <code class="parameter">what</code>
field value; in this case, only messages that match the <code class="parameter">what</code> argument are
counted. If no message matches the criteria, the functions return
<code class="constant">NULL</code>.</p><p>
The message is not removed from the message queue.
</p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_Lock"></a><a id="BMessageQueue_Unlock"></a>
Lock(), Unlock()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type">bool </span><span class="methodname">Lock</span>();</code><code class="methodsynopsis cpp"><span class="void">void </span><span class="methodname">Unlock</span>();</code><p>These functions lock and unlock the <code class="classname">BMessageQueue</code>,
so that another thread won't alter the contents of the queue while it's
being read. <code class="methodname">Lock()</code> doesn't return until it has
the queue locked; it always returns <code class="constant">true</code>.
<code class="methodname">Unlock()</code> releases the lock so that someone else
can lock it. Calls to these functions can be nested.</p><p>See also:
<a class="link" href="BLooper.html#BLooper_Lock" title="Lock(), LockWithTimeout(), Unlock()"><code class="methodname">BLooper::Lock()</code></a></p></div><div class="section"><div xmlns="" xmlns:d="http://docbook.org/ns/docbook" class="titlepage"><div><div xmlns:d="http://docbook.org/ns/docbook"><h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a id="BMessageQueue_NextMessage"></a>NextMessage()</h4></div></div></div><code class="methodsynopsis cpp"><span class="type"><a class="link" href="BMessage.html" title="BMessage"><code class="classname">BMessage</code></a>* </span><span class="methodname">NextMessage</span>();</code><p>Removes and returns the oldest message from the queue. If the queue is
empty, the function returns <code class="constant">NULL</code>.</p><p>See also:
<a class="link" href="BMessageQueue.html#BMessageQueue_FindMessage" title="FindMessage()"><code class="methodname">FindMessage()</code></a></p></div></div></div><div id="footer"><hr /><div id="footerT">Prev: <a href="BMessageFilter.html">BMessageFilter</a>  Up: <a href="TheApplicationKit.html">The Application Kit</a>  Next: <a href="BMessageRunner.html">BMessageRunner</a> </div><div id="footerB"><div id="footerBL"><a href="BMessageFilter.html" title="BMessageFilter"><img src="./images/navigation/prev.png" alt="Prev" /></a> <a href="TheApplicationKit.html" title="The Application Kit"><img src="./images/navigation/up.png" alt="Up" /></a> <a href="BMessageRunner.html" title="BMessageRunner"><img src="./images/navigation/next.png" alt="Next" /></a></div><div id="footerBR"><div><a href="http://www.haiku-os.org"><img src="./images/People_24.png" alt="haiku-os.org" title="Visit The Haiku Website" /></a></div><div class="navighome" title="Home"><a accesskey="h" href="index.html"><img src="./images/navigation/home.png" alt="Home" /></a></div></div><div id="footerBC"><a href="http://www.access-company.com/home.html" title="ACCESS Co."><img alt="Access Company" src="./images/access_logo.png" /></a></div></div></div><div id="licenseFooter"><div id="licenseFooterBL"><a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/" title="Creative Commons License"><img alt="Creative Commons License" style="border-width:0" src="https://licensebuttons.net/l/by-nc-nd/3.0/88x31.png" /></a></div><div id="licenseFooterBR"><a href="./LegalNotice.html">Legal Notice</a></div><div id="licenseFooterBC"><span id="licenseText">This work is licensed under a
<a rel="license" href="http://creativecommons.org/licenses/by-nc-nd/3.0/">Creative
Commons Attribution-Non commercial-No Derivative Works 3.0 License</a>.</span></div></div></body></html>