Files
utility/UpdatableBuffer.html
Cromwell D. Enage 9ee97bf9a0 Initial revision
[SVN r2109]
2004-04-08 01:30:24 +00:00

97 lines
4.3 KiB
HTML

<?xml version="1.0" encoding="UTF-8" ?>
<!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>
<title>Updatable Buffer Concept</title>
</head>
<body>
<h1><img src="../../c++boost.gif" alt="C++ Boost" width="277" height="86" /><br />Updatable Buffer Concept</h1>
<p>An <tt>UpdatableBuffer</tt> is a special type of <a href="./Buffer.html">Buffer</a> that provides an update operation for when the <tt>Buffer</tt>'s ordering policy changes.</p>
<h3>Notation</h3>
<ul>
<li><tt>B</tt> is a type that models <tt>UpdatableBuffer</tt>.</li>
<li><tt>T</tt> is the value type of <tt>B</tt>.</li>
<li><tt>t</tt> is an object of type <tt>T</tt>.</li>
</ul>
<h3>Members</h3>
<p>For a type to model the <tt>UpdatableBuffer</tt> concept it must have the following members.</p>
<table border="1">
<tr>
<th>Member</th>
<th>Where Defined</th>
<th>Description</th>
</tr>
<tr valign="top">
<td><tt>value_type</tt></td>
<td><a href="./Buffer.html">Buffer</a></td>
<td>The type of object stored in the Buffer. The value type must be <a href="http://www.sgi.com/tech/stl/Assignable.html">Assignable</a>.</td>
</tr>
<tr valign="top">
<td><tt>size_type</tt></td>
<td><a href="./Buffer.html">Buffer</a></td>
<td>An unsigned integral type for representing the number of objects in the Buffer.</td>
</tr>
<tr valign="top">
<td><tt>void update(const T&amp; t)</tt></td>
<td><tt>UpdatableBuffer</tt></td>
<td>Revalidates this Updatable Buffer. An Updatable Buffer is <em>invalidated</em> if its ordering policy changes with respect to <tt>t</tt> but its <em>internal structure</em> does not reflect that change.<br />Precondition: <tt>t</tt> is in the buffer.</td>
</tr>
<tr valign="top">
<td><tt>void push(const T&amp; t)</tt></td>
<td><a href="./Buffer.html">Buffer</a></td>
<td>Inserts <tt>t</tt> into the Buffer. <tt>size()</tt> will be incremented by one.</td>
</tr>
<tr valign="top">
<td><tt>void pop()</tt></td>
<td><a href="./Buffer.html">Buffer</a></td>
<td>Removes an object from the Buffer. <tt>size()</tt> will be decremented by one.<br />Precondition: <tt>empty()</tt> is <tt>false</tt>.</td>
</tr>
<tr valign="top">
<td><tt>T&amp; top()</tt></td>
<td><a href="./Buffer.html">Buffer</a></td>
<td>Returns a mutable reference to some object in the Buffer. Precondition: <tt>empty()</tt> is <tt>false</tt>.</td>
</tr>
<tr valign="top">
<td><tt>const T& top() const</tt></td>
<td><a href="./Buffer.html">Buffer</a></td>
<td>Returns a const reference to some object in the Buffer. Precondition: <tt>empty()</tt> is <tt>false</tt>.</td>
</tr>
<tr valign="top">
<td><tt>void size() const</tt></td>
<td><a href="./Buffer.html">Buffer</a></td>
<td>Returns the number of objects in the Buffer. Invariant: <tt>size() &gt;= 0</tt>.</td>
</tr>
<tr valign="top">
<td><tt>bool empty() const</tt></td>
<td><a href="./Buffer.html">Buffer</a></td>
<td>Equivalent to <tt>b.size() == 0</tt>.</td>
</tr>
</table>
<h3>Complexity Guarantees</h3>
<ul>
<li><tt>push()</tt>, <tt>pop()</tt>, <tt>size()</tt>, and <tt>update()</tt> must be at most linear time complexity in the size of the Generalized Queue.</li>
<li><tt>top()</tt> and <tt>empty()</tt> must be amortized constant time.</li>
</ul>
<h3>Models</h3>
<ul>
<li><a href="../pri_queue/doc/mutable_queue.html"><tt>mutable_queue</tt></a></li>
<li><a href="../pri_queue/doc/fibonacci_heap.html"><tt>fibonacci_heap</tt></a></li>
</ul>
<hr />
<table border="0">
<tr valign="top">
<td>Copyright &copy; 2004</td>
<td><a href="../../people/jeremy_siek.htm">Jeremy Siek</a>, Univ. of Notre Dame (<a href="mailto:jsiek@lsc.nd.edu">jsiek@lsc.nd.edu</a>)</td>
</tr>
</table>
<p>Use, modification, and distribution are subject to the Boost Software License, Version 1.0 at <a href="../../LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a></p>
</body>
</html>