RSB  0.17.0
Listener.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is a part of the RSB project
4  *
5  * Copyright (C) 2010 by Sebastian Wrede <swrede at techfak dot uni-bielefeld dot de>
6  *
7  * This file may be licensed under the terms of the
8  * GNU Lesser General Public License Version 3 (the ``LGPL''),
9  * or (at your option) any later version.
10  *
11  * Software distributed under the License is distributed
12  * on an ``AS IS'' basis, WITHOUT WARRANTY OF ANY KIND, either
13  * express or implied. See the LGPL for the specific language
14  * governing rights and limitations.
15  *
16  * You should have received a copy of the LGPL along with this
17  * program. If not, go to http://www.gnu.org/licenses/lgpl.html
18  * or write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20  *
21  * The development of this software was supported by:
22  * CoR-Lab, Research Institute for Cognition and Robotics
23  * Bielefeld University
24  *
25  * ============================================================ */
26 
27 #pragma once
28 
29 #include <string>
30 #include <set>
31 
32 #include <boost/scoped_ptr.hpp>
33 
34 #include <rsc/logging/Logger.h>
35 
36 #include <boost/shared_ptr.hpp>
37 
38 #include "rsb/rsbexports.h"
39 #include "Participant.h"
40 
41 namespace rsb {
42 
43 class Event;
44 typedef boost::shared_ptr<Event> EventPtr;
45 class Handler;
46 typedef boost::shared_ptr<Handler> HandlerPtr;
47 
48 namespace filter {
49 class Filter;
50 typedef boost::shared_ptr<Filter> FilterPtr;
51 }
52 
53 namespace eventprocessing {
54 class PushInRouteConfigurator;
55 typedef boost::shared_ptr<PushInRouteConfigurator> PushInRouteConfiguratorPtr;
56 }
57 
58 namespace transport {
60 typedef boost::shared_ptr<InPushConnector> InPushConnectorPtr;
61 }
62 
81 class RSB_EXPORT Listener: public Participant {
82 public:
83 
96  Listener(const std::vector<transport::InPushConnectorPtr>& connectors,
97  const Scope& scope, const ParticipantConfig& config);
98 
99  virtual ~Listener();
100 
101  // Overrides method in Participant.
102  virtual std::string getKind() const;
103 
104  // Overrides method in Participant.
105  virtual const std::set<std::string> getTransportURLs() const;
106 
113  void addFilter(filter::FilterPtr filter);
114 
121  void removeFilter(filter::FilterPtr filter);
122 
133  virtual void addHandler(HandlerPtr h, bool wait = true);
134 
143  void removeHandler(HandlerPtr h, bool wait = true);
144 
145 private:
146 
147  class Impl;
148  boost::scoped_ptr<Impl> d;
149 
150  void initialize(const std::vector<transport::InPushConnectorPtr>& connectors,
151  const Scope& scope,
152  const ParticipantConfig& config);
153 };
154 
155 typedef boost::shared_ptr<Listener> ListenerPtr;
156 
157 }
boost::shared_ptr< PushInRouteConfigurator > PushInRouteConfiguratorPtr
Objects of this class participate in the exchange of notifications on one channel of the bus...
Definition: Participant.h:65
boost::shared_ptr< Filter > FilterPtr
boost::scoped_ptr< Impl > d
Definition: Listener.h:147
boost::shared_ptr< Listener > ListenerPtr
Definition: Listener.h:155
boost::shared_ptr< Handler > HandlerPtr
Definition: Handler.h:92
A Listener receives events published by rsb::Informer objects by participating in a channel with a su...
Definition: Listener.h:81
boost::shared_ptr< InPushConnector > InPushConnectorPtr
Definition: Listener.h:59
A class describing the configuration of Participant instances.
Objects of classes which implement this specialized InConnector interface provide the ability to rece...
boost::shared_ptr< Event > EventPtr
Definition: Event.h:264
Scope is a descriptor for a hierarchical channel of the unified bus.
Definition: Scope.h:46