RSB  0.15.1
Server.h
Go to the documentation of this file.
1 /* ============================================================
2  *
3  * This file is part of the RSB project.
4  *
5  * Copyright (C) 2014, 2015 Jan Moringen <jmoringe@techfak.uni-bielefeld.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/shared_ptr.hpp>
33 #include <boost/enable_shared_from_this.hpp>
34 
35 #include "../Scope.h"
36 #include "../Participant.h"
37 #include "../ParticipantConfig.h"
38 #include "../Listener.h"
39 #include "../Informer.h"
40 #include "../Handler.h"
41 
42 #include "rsb/rsbexports.h"
43 
44 namespace rsb {
45 namespace patterns {
46 
55 class Method : public Participant,
56  public Handler,
57  public boost::enable_shared_from_this<Method> {
58 public:
59  Method(const Scope& scope,
60  const std::string& name,
63  virtual ~Method();
64 
65  // Will override method in Participant.
66  void activate();
67 
68  // Will override method in Participant.
69  void deactivate();
70 
74  const std::string& getName() const;
75 
76  // Overrides method in Participant.
77  virtual const std::set<std::string> getTransportURLs() const;
78 protected:
83 
87  const ParticipantConfig& getListenerConfig() const;
88 
95  virtual ListenerPtr makeListener();
96 
101 
105  const ParticipantConfig& getInformerConfig() const;
106 
113  virtual InformerBasePtr makeInformer();
114 private:
115  std::string name;
116 
119 
122 };
123 
124 typedef boost::shared_ptr<Method> MethodPtr;
125 
126 }
127 }
ListenerPtr listener
Definition: Server.h:120
virtual InformerBasePtr makeInformer()
Creates and returns the Informer participant.
Definition: Server.cpp:97
Method(const Scope &scope, const std::string &name, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
Definition: Server.cpp:34
virtual const std::set< std::string > getTransportURLs() const
TODO.
Definition: Server.cpp:63
Objects of this class participate in the exchange of notifications on one channel of the bus...
Definition: Participant.h:65
const std::string & getName() const
Returns the name of the method.
Definition: Server.cpp:59
Asynchronously called handler interface on the client level.
Definition: Handler.h:53
InformerBasePtr informer
Definition: Server.h:121
ParticipantConfig listenerConfig
Definition: Server.h:117
const ParticipantConfig & getInformerConfig() const
Returns the configuration for the Informer participant.
Definition: Server.cpp:93
boost::shared_ptr< Listener > ListenerPtr
Definition: Listener.h:155
boost::shared_ptr< Method > MethodPtr
Definition: Server.h:124
const ParticipantConfig & getListenerConfig() const
Returns the configuration for the Listener participant.
Definition: Server.cpp:76
InformerBasePtr getInformer()
Returns the Informer participant, creating it if necessary.
Definition: Server.cpp:85
virtual ListenerPtr makeListener()
Creates and returns the Listener participant.
Definition: Server.cpp:80
std::string name
Definition: Server.h:115
Base class for method classes.
Definition: Server.h:55
ParticipantConfig informerConfig
Definition: Server.h:118
A class describing the configuration of Participant instances.
boost::shared_ptr< InformerBase > InformerBasePtr
Definition: Informer.h:217
virtual ~Method()
Definition: Server.cpp:42
Scope is a descriptor for a hierarchical channel of the unified bus.
Definition: Scope.h:46
ListenerPtr getListener()
Returns the Listener participant, creating it if necessary.
Definition: Server.cpp:68