Menu

[r79]: / docs / html / c___network_library / template.html  Maximize  Restore  History

Download this file

90 lines (86 with data), 6.9 kB

 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
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>The Message Template</title>
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="../index.html" title="C++ Network Library">
<link rel="up" href="../index.html" title="C++ Network Library">
<link rel="prev" href="overview.html" title="Overview">
<link rel="next" href="protocol.html" title="Application Layer Protocols">
</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="http://www.boost.org/boost.png"></td>
<td align="center"><a href="http://www.boost.org/index.html">Home</a></td>
<td align="center"><a href="http://www.boost.org/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="http://www.boost.org/more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="overview.html"><img src="http://www.boost.org/doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="http://www.boost.org/doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="http://www.boost.org/doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="protocol.html"><img src="http://www.boost.org/doc/html/images/next.png" alt="Next"></a>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="c___network_library.template"></a><a class="link" href="template.html" title="The Message Template"> The Message Template</a>
</h2></div></div></div>
<p>
The initial concept behind the C++ Network Library is the message template.
The message template represents common message type used by protocol implementations.
It can therefore be specialized to support different data structures or different
string types.
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="http://www.boost.org/doc/html/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
Add more detailed information about the message template.
</p></td></tr>
</table></div>
<p>
The message template interface is presented below:
</p>
<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">network</span> <span class="special">{</span>
<span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Tag</span><span class="special">&gt;</span>
<span class="keyword">class</span> <span class="identifier">basic_message</span> <span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
<span class="keyword">typedef</span> <span class="identifier">implementation_defined</span> <span class="identifier">headers_container_type</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">implementation_defined</span> <span class="identifier">string_type</span><span class="special">;</span>
<span class="identifier">basic_message</span><span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_message</span> <span class="special">&amp;);</span>
<span class="identifier">basic_message</span> <span class="special">&amp;</span><span class="keyword">operator</span> <span class="special">=</span> <span class="special">(</span><span class="keyword">const</span> <span class="identifier">basic_message</span> <span class="special">&amp;);</span>
<span class="keyword">void</span> <span class="identifier">swap</span><span class="special">(</span><span class="identifier">basic_message</span> <span class="special">&amp;);</span>
<span class="identifier">headers_container_type</span> <span class="special">&amp;</span> <span class="identifier">headers</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
<span class="identifier">string_type</span> <span class="special">&amp;</span> <span class="identifier">body</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
<span class="identifier">string_type</span> <span class="special">&amp;</span> <span class="identifier">source</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
<span class="identifier">string_type</span> <span class="special">&amp;</span> <span class="identifier">destination</span><span class="special">()</span> <span class="keyword">const</span><span class="special">;</span>
<span class="special">};</span>
<span class="keyword">typedef</span> <span class="identifier">basic_message</span><span class="special">&lt;</span><span class="identifier">tags</span><span class="special">::</span><span class="identifier">default_</span><span class="special">&gt;</span> <span class="identifier">message</span><span class="special">;</span> <span class="comment">// default message type
</span><span class="special">}}</span>
</pre>
<a name="c___network_library.template.concepts"></a><h5>
<a name="id2553442"></a>
<a class="link" href="template.html#c___network_library.template.concepts">Concepts</a>
</h5>
<p>
<code class="literal">basic_message</code> supports the CopyConstructible, Assignable
and Swappable concepts, as do all its derivates.
</p>
</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 © 2008 Glyn Matthews<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="overview.html"><img src="http://www.boost.org/doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="http://www.boost.org/doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="http://www.boost.org/doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="protocol.html"><img src="http://www.boost.org/doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>