1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5
<title>peekabot: src/Subscriber.hh Source File</title>
6
<link href="tabs.css" rel="stylesheet" type="text/css"/>
7
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
10
<!-- Generated by Doxygen 1.7.1 -->
11
<div class="navigation" id="top">
14
<li><a href="main.html"><span>Main Page</span></a></li>
15
<li><a href="pages.html"><span>Related Pages</span></a></li>
16
<li><a href="annotated.html"><span>Classes</span></a></li>
17
<li class="current"><a href="files.html"><span>Files</span></a></li>
22
<li><a href="files.html"><span>File List</span></a></li>
26
<div class="headertitle">
27
<h1>src/Subscriber.hh</h1> </div>
29
<div class="contents">
30
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
31
<a name="l00002"></a>00002 <span class="comment"> * This file is part of peekabot.</span>
32
<a name="l00003"></a>00003 <span class="comment"> *</span>
33
<a name="l00004"></a>00004 <span class="comment"> * peekabot is free software; you can redistribute it and/or modify</span>
34
<a name="l00005"></a>00005 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
35
<a name="l00006"></a>00006 <span class="comment"> * the Free Software Foundation; either version 3 of the License, or</span>
36
<a name="l00007"></a>00007 <span class="comment"> * (at your option) any later version.</span>
37
<a name="l00008"></a>00008 <span class="comment"> *</span>
38
<a name="l00009"></a>00009 <span class="comment"> * peekabot is distributed in the hope that it will be useful,</span>
39
<a name="l00010"></a>00010 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
40
<a name="l00011"></a>00011 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</span>
41
<a name="l00012"></a>00012 <span class="comment"> * GNU General Public License for more details.</span>
42
<a name="l00013"></a>00013 <span class="comment"> *</span>
43
<a name="l00014"></a>00014 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
44
<a name="l00015"></a>00015 <span class="comment"> * along with this program. If not, see <http://www.gnu.org/licenses/>.</span>
45
<a name="l00016"></a>00016 <span class="comment"> */</span>
46
<a name="l00017"></a>00017
47
<a name="l00018"></a>00018 <span class="preprocessor">#ifndef __PEEKABOT_SUBSCRIBER_HH</span>
48
<a name="l00019"></a>00019 <span class="preprocessor"></span><span class="preprocessor">#define __PEEKABOT_SUBSCRIBER_HH</span>
49
<a name="l00020"></a>00020 <span class="preprocessor"></span>
50
<a name="l00021"></a>00021
51
<a name="l00022"></a>00022 <span class="preprocessor">#include <set></span>
52
<a name="l00023"></a>00023 <span class="preprocessor">#include <boost/thread/recursive_mutex.hpp></span>
53
<a name="l00024"></a>00024
54
<a name="l00025"></a>00025 <span class="preprocessor">#include "Message.hh"</span>
55
<a name="l00026"></a>00026
56
<a name="l00027"></a>00027
57
<a name="l00028"></a>00028 <span class="keyword">namespace </span>peekabot
58
<a name="l00029"></a>00029 {
59
<a name="l00030"></a>00030
60
<a name="l00031"></a>00031
61
<a name="l00038"></a>00038 <span class="keyword">class </span>Subscriber
62
<a name="l00039"></a>00039 {
63
<a name="l00040"></a>00040 <span class="keyword">friend</span> <span class="keyword">class </span>MessageHub;
64
<a name="l00041"></a>00041
65
<a name="l00042"></a>00042 <span class="keyword">public</span>:
66
<a name="l00046"></a>00046 <span class="keyword">virtual</span> <span class="keywordtype">void</span> handle_message(<span class="keyword">const</span> Message &) throw() = 0;
67
<a name="l00047"></a>00047
68
<a name="l00052"></a>00052 virtual ~Subscriber();
69
<a name="l00053"></a>00053
70
<a name="l00054"></a>00054 private:
71
<a name="l00062"></a>00062 <span class="keywordtype">void</span> add_subscription(MessageType type, MessageHub *hub) throw();
72
<a name="l00063"></a>00063
73
<a name="l00071"></a>00071 <span class="keywordtype">void</span> remove_subscription(MessageType type, MessageHub *hub) throw();
74
<a name="l00072"></a>00072
75
<a name="l00073"></a>00073 private:
76
<a name="l00078"></a>00078 typedef std::set<std::pair<MessageType, MessageHub *> > SubscriptionSet;
77
<a name="l00079"></a>00079
78
<a name="l00085"></a>00085 SubscriptionSet m_subscriptions;
79
<a name="l00086"></a>00086
80
<a name="l00090"></a>00090 mutable boost::recursive_mutex m_mutex;
81
<a name="l00091"></a>00091 };
82
<a name="l00092"></a>00092
83
<a name="l00093"></a>00093 }
84
<a name="l00094"></a>00094
85
<a name="l00095"></a>00095
86
<a name="l00096"></a>00096 <span class="preprocessor">#endif // __PEEKABOT_SUBSCRIBER_HH</span>
89
<hr class="footer"/><address class="footer"><small>Generated on Sun Jan 30 2011 for peekabot by
90
<a href="http://www.doxygen.org/index.html">
91
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>