]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0.1 Transitional//EN"> |
2 | ||
3 | <html> | |
4 | <head> | |
5 | <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
6 | <title>Boost.Flyweight Documentation - Holders reference</title> | |
7 | <link rel="stylesheet" href="../style.css" type="text/css"> | |
8 | <link rel="start" href="../index.html"> | |
9 | <link rel="prev" href="factories.html"> | |
10 | <link rel="up" href="index.html"> | |
11 | <link rel="next" href="locking.html"> | |
12 | </head> | |
13 | ||
14 | <body> | |
15 | <h1><img src="../../../../boost.png" alt="Boost logo" align= | |
16 | "middle" width="277" height="86">Boost.Flyweight | |
17 | Holders reference</h1> | |
18 | ||
19 | <div class="prev_link"><a href="factories.html"><img src="../prev.gif" alt="factories" border="0"><br> | |
20 | Factories | |
21 | </a></div> | |
22 | <div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.Flyweight reference" border="0"><br> | |
23 | Boost.Flyweight reference | |
24 | </a></div> | |
25 | <div class="next_link"><a href="locking.html"><img src="../next.gif" alt="locking policies" border="0"><br> | |
26 | Locking policies | |
27 | </a></div><br clear="all" style="clear: all;"> | |
28 | ||
29 | <hr> | |
30 | ||
31 | <h2>Contents</h2> | |
32 | ||
33 | <ul> | |
34 | <li><a href="#holder">Holders and holder specifiers</a></li> | |
35 | <li><a href="#holder_tag_synopsis">Header | |
36 | <code>"boost/flyweight/holder_tag.hpp"</code> synopsis</a> | |
37 | <ul> | |
38 | <li><a href="#is_holder">Class template <code>is_holder</code></a></li> | |
39 | <li><a href="#holder_construct">Class template <code>holder</code></a></li> | |
40 | </ul> | |
41 | </li> | |
42 | <li><a href="#static_holder_fwd_synopsis">Header | |
43 | <code>"boost/flyweight/static_holder_fwd.hpp"</code> synopsis</a> | |
44 | </li> | |
45 | <li><a href="#static_holder_synopsis">Header | |
46 | <code>"boost/flyweight/static_holder.hpp"</code> synopsis</a> | |
47 | <ul> | |
48 | <li><a href="#static_holder_class">Class template <code>static_holder_class</code></a></li> | |
49 | <li><a href="#static_holder">Class <code>static_holder</code></a></li> | |
50 | </ul> | |
51 | </li> | |
52 | <li><a href="#intermodule_holder_fwd_synopsis">Header | |
53 | <code>"boost/flyweight/intermodule_holder_fwd.hpp"</code> synopsis</a> | |
54 | </li> | |
55 | <li><a href="#intermodule_holder_synopsis">Header | |
56 | <code>"boost/flyweight/intermodule_holder.hpp"</code> synopsis</a> | |
57 | <ul> | |
58 | <li><a href="#intermodule_holder_class">Class template <code>intermodule_holder_class</code></a></li> | |
59 | <li><a href="#intermodule_holder">Class <code>intermodule_holder</code></a></li> | |
60 | </ul> | |
61 | </li> | |
62 | </ul> | |
63 | ||
64 | <h2><a name="holder">Holders and holder specifiers</a></h2> | |
65 | ||
66 | <p> | |
67 | Given a type <code>C</code>, a type <code>Holder</code> is said to be a <i>holder | |
68 | of <code>C</code></i> if the expression <code>Holder::get()</code> returns | |
69 | a reference to a default initialized <code>C</code> object unique to | |
70 | <code>Holder</code>. No invocation of <code>Holder::get()</code>, except possibly | |
71 | the first one in the program, does throw. | |
72 | <a href="flyweight.html#flyweight"><code>flyweight</code></a> | |
73 | privately uses a holder to instantiate a <a href="factories.html#factory">factory</a> | |
74 | and some additional data (like a <a href="locking.html#preliminary">mutex</a> for | |
75 | internal synchronization) unique to each instantiation type of the class template. | |
76 | </p> | |
77 | ||
78 | <p> | |
79 | A type <code>S</code> is a <i>holder specifier</i> if: | |
80 | <ol> | |
81 | <li>One of the following conditions is satisfied: | |
82 | <ol type="a"> | |
83 | <li><a href="#is_holder"><code>is_holder<S>::type</code></a> is | |
84 | <a href="../../../mpl/doc/refmanual/bool.html"><code>boost::mpl::true_</code></a>,</li> | |
85 | <li><code>S</code> is of the form <a href="#holder_construct"><code>holder<S'></code></a>.</li> | |
86 | </ol> | |
87 | </li> | |
88 | <li><code>S</code>, or <code>S'</code> if (b) applies, is an | |
89 | <a href="../../../mpl/doc/refmanual/lambda-expression.html"><code>MPL Lambda | |
90 | Expression</code></a> such that invoking it with type <code>C</code> resolves to | |
91 | a holder of <code>C</code>. | |
92 | </li> | |
93 | </ol> | |
94 | </p> | |
95 | ||
96 | <h2><a name="holder_tag_synopsis">Header | |
97 | <a href="../../../../boost/flyweight/holder_tag.hpp"><code>"boost/flyweight/holder_tag.hpp"</code></a> synopsis</a></h2> | |
98 | ||
99 | <blockquote><pre> | |
100 | <span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span> | |
101 | ||
102 | <span class=keyword>namespace</span> <span class=identifier>flyweights</span><span class=special>{</span> | |
103 | ||
104 | <span class=keyword>struct</span> <span class=identifier>holder_marker</span><span class=special>;</span> | |
105 | ||
106 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T</span><span class=special>></span> | |
107 | <span class=keyword>struct</span> <span class=identifier>is_holder</span><span class=special>;</span> | |
108 | ||
109 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>T</span><span class=special>></span> | |
110 | <span class=keyword>struct</span> <span class=identifier>holder</span><span class=special>;</span> | |
111 | ||
112 | <span class=special>}</span> <span class=comment>// namespace boost::flyweights</span> | |
113 | ||
114 | <span class=special>}</span> <span class=comment>// namespace boost</span> | |
115 | </pre></blockquote> | |
116 | ||
117 | <h3><a name="is_holder">Class template <code>is_holder</code></a></h3> | |
118 | ||
119 | <p> | |
120 | Unless specialized by the user, <code>is_holder<T>::type</code> is | |
121 | <a href="../../../mpl/doc/refmanual/bool.html"><code>boost::mpl::true_</code></a> | |
122 | if <code>T</code> is derived from <code>holder_marker</code>, and it is | |
123 | <a href="../../../mpl/doc/refmanual/bool.html"><code>boost::mpl::false_</code></a> | |
124 | otherwise. | |
125 | </p> | |
126 | ||
127 | <h3><a name="holder_construct">Class template <code>holder</code></a></h3> | |
128 | ||
129 | <p> | |
130 | <code>holder<T></code> is a syntactic construct meant to indicate | |
131 | that <code>T</code> is a holder specifier without resorting to the | |
132 | mechanisms provided by the <code>is_holder</code> class template. | |
133 | </p> | |
134 | ||
135 | <h2><a name="static_holder_fwd_synopsis">Header | |
136 | <a href="../../../../boost/flyweight/static_holder_fwd.hpp"><code>"boost/flyweight/static_holder_fwd.hpp"</code></a> synopsis</a></h2> | |
137 | ||
138 | <blockquote><pre> | |
139 | <span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span> | |
140 | ||
141 | <span class=keyword>namespace</span> <span class=identifier>flyweights</span><span class=special>{</span> | |
142 | ||
143 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>C</span><span class=special>></span> | |
144 | <span class=keyword>struct</span> <span class=identifier>static_holder_class</span><span class=special>;</span> | |
145 | ||
146 | <span class=keyword>struct</span> <span class=identifier>static_holder</span><span class=special>;</span> | |
147 | ||
148 | <span class=special>}</span> <span class=comment>// namespace boost::flyweights</span> | |
149 | ||
150 | <span class=special>}</span> <span class=comment>// namespace boost</span> | |
151 | </pre></blockquote> | |
152 | ||
153 | <p> | |
154 | <code>static_holder_fwd.hpp</code> forward declares | |
155 | <a href="#static_holder_class"><code>static_holder_class</code></a> | |
156 | and <a href="#static_holder"><code>static_holder</code></a>. | |
157 | </p> | |
158 | ||
159 | <h2><a name="static_holder_synopsis">Header | |
160 | <a href="../../../../boost/flyweight/static_holder.hpp"><code>"boost/flyweight/static_holder.hpp"</code></a> synopsis</a></h2> | |
161 | ||
162 | <h3><a name="static_holder_class">Class template <code>static_holder_class</code></a></h3> | |
163 | ||
164 | <p> | |
165 | <code>static_holder_class<C></code> keeps its unique instance of <code>C</code> as a | |
166 | local static object. | |
167 | </p> | |
168 | ||
169 | <h3><a name="static_holder">Class <code>static_holder</code></a></h3> | |
170 | ||
171 | <p> | |
172 | <a href="#holder"><code>Holder Specifier</code></a> for <a href="#static_holder_class"><code>static_holder_class</code></a>. | |
173 | </p> | |
174 | ||
175 | <h2><a name="intermodule_holder_fwd_synopsis">Header | |
176 | <a href="../../../../boost/flyweight/intermodule_holder_fwd.hpp"><code>"boost/flyweight/intermodule_holder_fwd.hpp"</code></a> synopsis</a></h2> | |
177 | ||
178 | <blockquote><pre> | |
179 | <span class=keyword>namespace</span> <span class=identifier>boost</span><span class=special>{</span> | |
180 | ||
181 | <span class=keyword>namespace</span> <span class=identifier>flyweights</span><span class=special>{</span> | |
182 | ||
183 | <span class=keyword>template</span><span class=special><</span><span class=keyword>typename</span> <span class=identifier>C</span><span class=special>></span> | |
184 | <span class=keyword>struct</span> <span class=identifier>intermodule_holder_class</span><span class=special>;</span> | |
185 | ||
186 | <span class=keyword>struct</span> <span class=identifier>intermodule_holder</span><span class=special>;</span> | |
187 | ||
188 | <span class=special>}</span> <span class=comment>// namespace boost::flyweights</span> | |
189 | ||
190 | <span class=special>}</span> <span class=comment>// namespace boost</span> | |
191 | </pre></blockquote> | |
192 | ||
193 | <p> | |
194 | <code>intermodule_holder_fwd.hpp</code> forward declares | |
195 | <a href="#intermodule_holder_class"><code>intermodule_holder_class</code></a> | |
196 | and <a href="#intermodule_holder"><code>intermodule_holder</code></a>. | |
197 | </p> | |
198 | ||
199 | <h2><a name="intermodule_holder_synopsis">Header | |
200 | <a href="../../../../boost/flyweight/intermodule_holder.hpp"><code>"boost/flyweight/intermodule_holder.hpp"</code></a> synopsis</a></h2> | |
201 | ||
202 | <h3><a name="intermodule_holder_class">Class template <code>intermodule_holder_class</code></a></h3> | |
203 | ||
204 | <p> | |
205 | <code>intermodule_holder_class<C></code> maintains a <code>C</code> | |
206 | instance which is unique even across different dynamically linked modules of | |
207 | the program using this same type. In general, this guarantee is not provided by | |
208 | <a href="#static_holder_class"><code>static_holder_class</code></a>, as most | |
209 | C++ implementations are not able to merge duplicates of static variables stored | |
210 | in different dynamic modules of a program. | |
211 | </p> | |
212 | ||
213 | <h3><a name="intermodule_holder">Class <code>intermodule_holder</code></a></h3> | |
214 | ||
215 | <p> | |
216 | <a href="#holder"><code>Holder Specifier</code></a> for <a href="#intermodule_holder_class"><code>intermodule_holder_class</code></a>. | |
217 | </p> | |
218 | ||
219 | <hr> | |
220 | ||
221 | <div class="prev_link"><a href="factories.html"><img src="../prev.gif" alt="factories" border="0"><br> | |
222 | Factories | |
223 | </a></div> | |
224 | <div class="up_link"><a href="index.html"><img src="../up.gif" alt="Boost.Flyweight reference" border="0"><br> | |
225 | Boost.Flyweight reference | |
226 | </a></div> | |
227 | <div class="next_link"><a href="locking.html"><img src="../next.gif" alt="locking policies" border="0"><br> | |
228 | Locking policies | |
229 | </a></div><br clear="all" style="clear: all;"> | |
230 | ||
231 | <br> | |
232 | ||
233 | <p>Revised August 11th 2008</p> | |
234 | ||
235 | <p>© Copyright 2006-2008 Joaquín M López Muñoz. | |
236 | Distributed under the Boost Software | |
237 | License, Version 1.0. (See accompanying file <a href="../../../../LICENSE_1_0.txt"> | |
238 | LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt"> | |
239 | http://www.boost.org/LICENSE_1_0.txt</a>) | |
240 | </p> | |
241 | ||
242 | </body> | |
243 | </html> |