1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207
|
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Class template offset_ptr</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../../boost_interprocess_reference.html#header.boost.interprocess.offset_ptr_hpp" title="Header <boost/interprocess/offset_ptr.hpp>">
<link rel="prev" href="simple_seq_fit.html" title="Class template simple_seq_fit">
<link rel="next" href="operator___id813866.html" title="Function template operator==">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td>
<td align="center"><a href="../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="simple_seq_fit.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_interprocess_reference.html#header.boost.interprocess.offset_ptr_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="operator___id813866.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
</div>
<div class="refentry" title="Class template offset_ptr">
<a name="boost.interprocess.offset_ptr"></a><div class="titlepage"></div>
<div class="refnamediv">
<h2><span class="refentrytitle">Class template offset_ptr</span></h2>
<p>boost::interprocess::offset_ptr</p>
</div>
<h2 xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv-title">Synopsis</h2>
<div xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" class="refsynopsisdiv"><pre class="synopsis"><span class="emphasis"><em>// In header: <<a class="link" href="../../boost_interprocess_reference.html#header.boost.interprocess.offset_ptr_hpp" title="Header <boost/interprocess/offset_ptr.hpp>">boost/interprocess/offset_ptr.hpp</a>>
</em></span><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> PointedType>
<span class="bold"><strong>class</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> {
<span class="bold"><strong>public</strong></span>:
<span class="emphasis"><em>// types</em></span>
<span class="bold"><strong>typedef</strong></span> PointedType * <a name="boost.interprocess.offset_ptr.pointer"></a>pointer;
<span class="bold"><strong>typedef</strong></span> <span class="emphasis"><em>unspecified</em></span> <a name="boost.interprocess.offset_ptr.reference"></a>reference;
<span class="bold"><strong>typedef</strong></span> PointedType <a name="boost.interprocess.offset_ptr.value_type"></a>value_type;
<span class="bold"><strong>typedef</strong></span> std::ptrdiff_t <a name="boost.interprocess.offset_ptr.difference_type"></a>difference_type;
<span class="bold"><strong>typedef</strong></span> std::random_access_iterator_tag <a name="boost.interprocess.offset_ptr.iterator_category"></a>iterator_category;
<span class="emphasis"><em>// <a class="link" href="offset_ptr.html#boost.interprocess.offset_ptrconstruct-copy-destruct">construct/copy/destruct</a></em></span>
<a class="link" href="offset_ptr.html#id813636-bb">offset_ptr</a>(pointer = 0);
<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T> <a class="link" href="offset_ptr.html#id813650-bb">offset_ptr</a>(T *);
<a class="link" href="offset_ptr.html#id813668-bb">offset_ptr</a>(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &);
<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T2> <a class="link" href="offset_ptr.html#id813682-bb">offset_ptr</a>(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< T2 > &);
<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Y> <a class="link" href="offset_ptr.html#id813705-bb">offset_ptr</a>(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< Y > &, <span class="emphasis"><em>unspecified</em></span>);
<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Y> <a class="link" href="offset_ptr.html#id813733-bb">offset_ptr</a>(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< Y > &, <span class="emphasis"><em>unspecified</em></span>);
<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Y> <a class="link" href="offset_ptr.html#id813761-bb">offset_ptr</a>(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< Y > &, <span class="emphasis"><em>unspecified</em></span>);
<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Y> <a class="link" href="offset_ptr.html#id813789-bb">offset_ptr</a>(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< Y > &, <span class="emphasis"><em>unspecified</em></span>);
offset_ptr& <a class="link" href="offset_ptr.html#id813817-bb"><span class="bold"><strong>operator</strong></span>=</a>(pointer);
offset_ptr& <a class="link" href="offset_ptr.html#id813829-bb"><span class="bold"><strong>operator</strong></span>=</a>(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &);
<span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T2> offset_ptr& <a class="link" href="offset_ptr.html#id813843-bb"><span class="bold"><strong>operator</strong></span>=</a>(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< T2 > &);
<span class="emphasis"><em>// <a class="link" href="offset_ptr.html#id813395-bb">public member functions</a></em></span>
<span class="type">pointer</span> <a class="link" href="offset_ptr.html#id813399-bb">get</a>() <span class="bold"><strong>const</strong></span>;
<span class="type">std::ptrdiff_t</span> <a class="link" href="offset_ptr.html#id813410-bb">get_offset</a>() ;
<span class="type">pointer</span> <a class="link" href="offset_ptr.html#id813418-bb"><span class="bold"><strong>operator</strong></span>-></a>() <span class="bold"><strong>const</strong></span>;
<span class="type">reference</span> <a class="link" href="offset_ptr.html#id813430-bb"><span class="bold"><strong>operator</strong></span>*</a>() <span class="bold"><strong>const</strong></span>;
<span class="type">reference</span> <a class="link" href="offset_ptr.html#id813443-bb"><span class="bold"><strong>operator</strong></span>[]</a>(std::ptrdiff_t) <span class="bold"><strong>const</strong></span>;
<span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a></span> <a class="link" href="offset_ptr.html#id813460-bb"><span class="bold"><strong>operator</strong></span>+</a>(std::ptrdiff_t) <span class="bold"><strong>const</strong></span>;
<span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a></span> <a class="link" href="offset_ptr.html#id813479-bb"><span class="bold"><strong>operator</strong></span>-</a>(std::ptrdiff_t) <span class="bold"><strong>const</strong></span>;
<span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &</span> <a class="link" href="offset_ptr.html#id813497-bb"><span class="bold"><strong>operator</strong></span>+=</a>(std::ptrdiff_t) ;
<span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &</span> <a class="link" href="offset_ptr.html#id813517-bb"><span class="bold"><strong>operator</strong></span>-=</a>(std::ptrdiff_t) ;
<span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &</span> <a class="link" href="offset_ptr.html#id813537-bb"><span class="bold"><strong>operator</strong></span>++</a>(<span class="bold"><strong>void</strong></span>) ;
<span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a></span> <a class="link" href="offset_ptr.html#id813556-bb"><span class="bold"><strong>operator</strong></span>++</a>(<span class="bold"><strong>int</strong></span>) ;
<span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &</span> <a class="link" href="offset_ptr.html#id813574-bb"><span class="bold"><strong>operator</strong></span>--</a>(<span class="bold"><strong>void</strong></span>) ;
<span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a></span> <a class="link" href="offset_ptr.html#id813594-bb"><span class="bold"><strong>operator</strong></span>--</a>(<span class="bold"><strong>int</strong></span>) ;
<a class="link" href="offset_ptr.html#id813612-bb"><span class="bold"><strong>operator</strong></span> unspecified_bool_type</a>() <span class="bold"><strong>const</strong></span>;
<span class="type"><span class="bold"><strong>bool</strong></span></span> <a class="link" href="offset_ptr.html#id813624-bb"><span class="bold"><strong>operator</strong></span>!</a>() <span class="bold"><strong>const</strong></span>;
};</pre></div>
<div class="refsect1" title="Description">
<a name="id1033197"></a><h2>Description</h2>
<p>A smart pointer that stores the offset between between the pointer and the the object it points. This allows offset allows special properties, since the pointer is independent from the address address of the pointee, if the pointer and the pointee are still separated by the same offset. This feature converts offset_ptr in a smart pointer that can be placed in shared memory and memory mapped files mapped in different addresses in every process. </p>
<div class="refsect2" title="offset_ptr public construct/copy/destruct">
<a name="id1033210"></a><h3>
<a name="boost.interprocess.offset_ptrconstruct-copy-destruct"></a><code class="computeroutput">offset_ptr</code>
public
construct/copy/destruct</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><a name="id813636-bb"></a>offset_ptr(pointer ptr = 0);</pre>
<p>Constructor from raw pointer (allows "0" pointer conversion). Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T> <a name="id813650-bb"></a>offset_ptr(T * ptr);</pre>
<p>Constructor from other pointer. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="id813668-bb"></a>offset_ptr(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> & ptr);</pre>
<p>Constructor from other offset_ptr Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T2> <a name="id813682-bb"></a>offset_ptr(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< T2 > & ptr);</pre>
<p>Constructor from other offset_ptr. If pointers of pointee types are convertible, offset_ptrs will be convertibles. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Y> <a name="id813705-bb"></a>offset_ptr(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< Y > & r, <span class="emphasis"><em>unspecified</em></span>);</pre>
<p>Emulates static_cast operator. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Y> <a name="id813733-bb"></a>offset_ptr(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< Y > & r, <span class="emphasis"><em>unspecified</em></span>);</pre>
<p>Emulates const_cast operator. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Y> <a name="id813761-bb"></a>offset_ptr(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< Y > & r, <span class="emphasis"><em>unspecified</em></span>);</pre>
<p>Emulates dynamic_cast operator. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> Y> <a name="id813789-bb"></a>offset_ptr(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< Y > & r, <span class="emphasis"><em>unspecified</em></span>);</pre>
<p>Emulates reinterpret_cast operator. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout">offset_ptr& <a name="id813817-bb"></a><span class="bold"><strong>operator</strong></span>=(pointer from);</pre>
<p>Assignment from pointer (saves extra conversion). Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout">offset_ptr& <a name="id813829-bb"></a><span class="bold"><strong>operator</strong></span>=(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> & pt);</pre>
<p>Assignment from other offset_ptr. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="bold"><strong>template</strong></span><<span class="bold"><strong>typename</strong></span> T2> offset_ptr& <a name="id813843-bb"></a><span class="bold"><strong>operator</strong></span>=(<span class="bold"><strong>const</strong></span> <a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a>< T2 > & pt);</pre>
<p>Assignment from related offset_ptr. If pointers of pointee types are assignable, offset_ptrs will be assignable. Never throws. </p>
</li>
</ol></div>
</div>
<div class="refsect2" title="offset_ptr public member functions">
<a name="id1033634"></a><h3>
<a name="id813395-bb"></a><code class="computeroutput">offset_ptr</code> public member functions</h3>
<div class="orderedlist"><ol class="orderedlist" type="1">
<li class="listitem">
<pre class="literallayout"><span class="type">pointer</span> <a name="id813399-bb"></a>get() <span class="bold"><strong>const</strong></span>;</pre>
<p>Obtains raw pointer from offset. Never throws. </p>
</li>
<li class="listitem"><pre class="literallayout"><span class="type">std::ptrdiff_t</span> <a name="id813410-bb"></a>get_offset() ;</pre></li>
<li class="listitem">
<pre class="literallayout"><span class="type">pointer</span> <a name="id813418-bb"></a><span class="bold"><strong>operator</strong></span>->() <span class="bold"><strong>const</strong></span>;</pre>
<p>Pointer-like -> operator. It can return 0 pointer. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type">reference</span> <a name="id813430-bb"></a><span class="bold"><strong>operator</strong></span>*() <span class="bold"><strong>const</strong></span>;</pre>
<p>Dereferencing operator, if it is a null offset_ptr behavior is undefined. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type">reference</span> <a name="id813443-bb"></a><span class="bold"><strong>operator</strong></span>[](std::ptrdiff_t idx) <span class="bold"><strong>const</strong></span>;</pre>
<p>Indexing operator. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a></span> <a name="id813460-bb"></a><span class="bold"><strong>operator</strong></span>+(std::ptrdiff_t offset) <span class="bold"><strong>const</strong></span>;</pre>
<p>offset_ptr + std::ptrdiff_t. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a></span> <a name="id813479-bb"></a><span class="bold"><strong>operator</strong></span>-(std::ptrdiff_t offset) <span class="bold"><strong>const</strong></span>;</pre>
<p>offset_ptr - std::ptrdiff_t. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &</span> <a name="id813497-bb"></a><span class="bold"><strong>operator</strong></span>+=(std::ptrdiff_t offset) ;</pre>
<p>offset_ptr += std::ptrdiff_t. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &</span> <a name="id813517-bb"></a><span class="bold"><strong>operator</strong></span>-=(std::ptrdiff_t offset) ;</pre>
<p>offset_ptr -= std::ptrdiff_t. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &</span> <a name="id813537-bb"></a><span class="bold"><strong>operator</strong></span>++(<span class="bold"><strong>void</strong></span>) ;</pre>
<p>++offset_ptr. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a></span> <a name="id813556-bb"></a><span class="bold"><strong>operator</strong></span>++(<span class="bold"><strong>int</strong></span>) ;</pre>
<p>offset_ptr++. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a> &</span> <a name="id813574-bb"></a><span class="bold"><strong>operator</strong></span>--(<span class="bold"><strong>void</strong></span>) ;</pre>
<p>--offset_ptr. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><a class="link" href="offset_ptr.html" title="Class template offset_ptr">offset_ptr</a></span> <a name="id813594-bb"></a><span class="bold"><strong>operator</strong></span>--(<span class="bold"><strong>int</strong></span>) ;</pre>
<p>offset_ptr--. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><a name="id813612-bb"></a><span class="bold"><strong>operator</strong></span> unspecified_bool_type() <span class="bold"><strong>const</strong></span>;</pre>
<p>safe bool conversion operator. Never throws. </p>
</li>
<li class="listitem">
<pre class="literallayout"><span class="type"><span class="bold"><strong>bool</strong></span></span> <a name="id813624-bb"></a><span class="bold"><strong>operator</strong></span>!() <span class="bold"><strong>const</strong></span>;</pre>
<p>Not operator. Not needed in theory, but improves portability. Never throws </p>
</li>
</ol></div>
</div>
</div>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright © 2005 - 2008 Ion Gaztanaga<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
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>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="simple_seq_fit.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../../boost_interprocess_reference.html#header.boost.interprocess.offset_ptr_hpp"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="operator___id813866.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>
|