File: ReadablePropertyMap.html

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (148 lines) | stat: -rw-r--r-- 3,921 bytes parent folder | download
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
<HTML>
<!--
  -- Copyright (c) Jeremy Siek 2000
  --
  -- Permission to use, copy, modify, distribute and sell this software
  -- and its documentation for any purpose is hereby granted without fee,
  -- provided that the above copyright notice appears in all copies and
  -- that both that copyright notice and this permission notice appear
  -- in supporting documentation.  Silicon Graphics makes no
  -- representations about the suitability of this software for any
  -- purpose.  It is provided "as is" without express or implied warranty.
  -->
<Head>
<Title>Readable Property Map</Title>
<BODY BGCOLOR="#ffffff" LINK="#0000ee" TEXT="#000000" VLINK="#551a8b" 
	ALINK="#ff0000"> 
<IMG SRC="../../boost.png" 
     ALT="C++ Boost" width="277" height="86"> 

<BR Clear>


<H2><A NAME="concept:ReadablePropertyMap"></A>
Readable Property Map
</H2>

A Readable Property Map provides read-access to the value object associated with a given key via a call to the <tt>get()</tt> function.
The <tt>get()</tt> function returns a copy of the value object.

<h3>Refinement of</h3>

<a href="../utility/CopyConstructible.html">Copy Constructible</a>

<h3>Notation</h3>

<Table>
<TR>
<TD><tt>PMap</tt></TD>
<TD>A type that is a model of Readable Property Map.</TD>
</TR>
<TR>
<TD><tt>pmap</tt></TD>
<TD>An object of type <tt>PMap</tt>.</td>
</TR>
<TR>
<TD><tt>key</tt></TD>
<TD>An object of type <tt>boost::property_traits&lt;PMap&gt;::key_type</tt>.</td>
</TR>

</table>

<h3>Associated Types</h3>

<table border>

<tr>
<td>Value Type</td>
<td><TT>boost::property_traits&lt;PMap&gt;::value_type</TT></td> 
<td>The type of the property.</td>
</tr>

<tr>
<td>Reference Type</td>
<td><TT>boost::property_traits&lt;PMap&gt;::reference</TT></td> 
<td>
A type that is convertible to the value type.
</td>
</tr>

<tr>
<td>Key Type</td>
<td><TT>boost::property_traits&lt;PMap&gt;::key_type</TT></td> 
<td>
The type of the key object used to look up the property.  The property
map may be templated on the key type, in which case this
typedef can be <TT>void</TT>.
</td>
</tr>

<tr>
<td>Property Map Category</td>
<td><TT>boost::property_traits&lt;PMap&gt;::category</TT></td>
<td>
The category of the property: a type convertible to
<TT>readable_property_map_tag</TT>.
</td>
</tr>

</table>

<h3>Valid Expressions</h3>

<table border>
<tr>
<th>Name</th><th>Expression</th><th>Return Type</th><th>Description</th>
</tr>

<tr>
<td>Get Property Value </td>
<TD><TT>get(pmap, key)</TT></TD>
<TD><TT>reference</TT></TD>
<TD>Lookup the property of the object identified by <TT>key</TT>.</TD>
</TR>

</TABLE>

<h3>Concept Checking Class</h3>

<pre>  template &lt;class PMap, class Key&gt;
  struct ReadablePropertyMapConcept
  {
    typedef typename property_traits&lt;PMap&gt;::key_type key_type;
    typedef typename property_traits&lt;PMap&gt;::category Category;
    typedef boost::readable_property_map_tag ReadableTag;
    void constraints() {
      function_requires&lt; ConvertibleConcept&lt;Category, ReadableTag&gt; &gt;();

      val = get(pmap, k);
    }
    PMap pmap;
    Key k;
    typename property_traits&lt;PMap&gt;::value_type val;
  };</pre>

<h3>See Also</h3>

<a href="./property_map.html">Property map concepts</a>

<h3>Design Notes</h3>

At various times the name &quot;read-only&quot; was considered for
this concept. However, that name is inappropriate because concepts are
inherently positive, not negative. This becomes obvious when we define
the Read Write Property Map, which refines both the Readable Property
Map and the Writable Property Map concept. It would not make much
sense to combine &quot;read-only&quot; and &quot;write-only&quot;
concepts!

<br>
<HR>
<TABLE>
<TR valign=top>
<TD nowrap>Copyright &copy 2000</TD><TD>
<a HREF="http://www.boost.org/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>

</BODY>
</HTML>