Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/libs/property_map/ReadablePropertyMap.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 3.8 KB
Line 
1<HTML>
2<!--
3  -- Copyright (c) Jeremy Siek 2000
4  --
5  -- Permission to use, copy, modify, distribute and sell this software
6  -- and its documentation for any purpose is hereby granted without fee,
7  -- provided that the above copyright notice appears in all copies and
8  -- that both that copyright notice and this permission notice appear
9  -- in supporting documentation.  Silicon Graphics makes no
10  -- representations about the suitability of this software for any
11  -- purpose.  It is provided "as is" without express or implied warranty.
12  -->
13<Head>
14<Title>Readable Property Map</Title>
15<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 
16        ALINK="#ff0000"> 
17<IMG SRC="../../boost.png" 
18     ALT="C++ Boost" width="277" height="86"> 
19
20<BR Clear>
21
22
23<H2><A NAME="concept:ReadablePropertyMap"></A>
24Readable Property Map
25</H2>
26
27A Readable Property Map provides read-access to the value object associated with a given key via a call to the <tt>get()</tt> function.
28The <tt>get()</tt> function returns a copy of the value object.
29
30<h3>Refinement of</h3>
31
32<a href="../utility/CopyConstructible.html">Copy Constructible</a>
33
34<h3>Notation</h3>
35
36<Table>
37<TR>
38<TD><tt>PMap</tt></TD>
39<TD>A type that is a model of Readable Property Map.</TD>
40</TR>
41<TR>
42<TD><tt>pmap</tt></TD>
43<TD>An object of type <tt>PMap</tt>.</td>
44</TR>
45<TR>
46<TD><tt>key</tt></TD>
47<TD>An object of type <tt>boost::property_traits&lt;PMap&gt;::key_type</tt>.</td>
48</TR>
49
50</table>
51
52<h3>Associated Types</h3>
53
54<table border>
55
56<tr>
57<td>Value Type</td>
58<td><TT>boost::property_traits&lt;PMap&gt;::value_type</TT></td> 
59<td>The type of the property.</td>
60</tr>
61
62<tr>
63<td>Reference Type</td>
64<td><TT>boost::property_traits&lt;PMap&gt;::reference</TT></td> 
65<td>
66A type that is convertible to the value type.
67</td>
68</tr>
69
70<tr>
71<td>Key Type</td>
72<td><TT>boost::property_traits&lt;PMap&gt;::key_type</TT></td> 
73<td>
74The type of the key object used to look up the property.  The property
75map may be templated on the key type, in which case this
76typedef can be <TT>void</TT>.
77</td>
78</tr>
79
80<tr>
81<td>Property Map Category</td>
82<td><TT>boost::property_traits&lt;PMap&gt;::category</TT></td>
83<td>
84The category of the property: a type convertible to
85<TT>readable_property_map_tag</TT>.
86</td>
87</tr>
88
89</table>
90
91<h3>Valid Expressions</h3>
92
93<table border>
94<tr>
95<th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
96</tr>
97
98<tr>
99<td>Get Property Value </td>
100<TD><TT>get(pmap, key)</TT></TD>
101<TD><TT>reference</TT></TD>
102<TD>Lookup the property of the object identified by <TT>key</TT>.</TD>
103</TR>
104
105</TABLE>
106
107<h3>Concept Checking Class</h3>
108
109<pre>  template &lt;class PMap, class Key&gt;
110  struct ReadablePropertyMapConcept
111  {
112    typedef typename property_traits&lt;PMap&gt;::key_type key_type;
113    typedef typename property_traits&lt;PMap&gt;::category Category;
114    typedef boost::readable_property_map_tag ReadableTag;
115    void constraints() {
116      function_requires&lt; ConvertibleConcept&lt;Category, ReadableTag&gt; &gt;();
117
118      val = get(pmap, k);
119    }
120    PMap pmap;
121    Key k;
122    typename property_traits&lt;PMap&gt;::value_type val;
123  };</pre>
124
125<h3>See Also</h3>
126
127<a href="./property_map.html">Property map concepts</a>
128
129<h3>Design Notes</h3>
130
131At various times the name &quot;read-only&quot; was considered for
132this concept. However, that name is inappropriate because concepts are
133inherently positive, not negative. This becomes obvious when we define
134the Read Write Property Map, which refines both the Readable Property
135Map and the Writable Property Map concept. It would not make much
136sense to combine &quot;read-only&quot; and &quot;write-only&quot;
137concepts!
138
139<br>
140<HR>
141<TABLE>
142<TR valign=top>
143<TD nowrap>Copyright &copy 2000</TD><TD>
144<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>)
145</TD></TR></TABLE>
146
147</BODY>
148</HTML> 
Note: See TracBrowser for help on using the repository browser.