RSB  0.12.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 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 <boost/shared_ptr.hpp>
30 #include <boost/enable_shared_from_this.hpp>
31 
32 #include "../Scope.h"
33 #include "../Participant.h"
34 #include "../ParticipantConfig.h"
35 #include "../Listener.h"
36 #include "../Informer.h"
37 #include "../Handler.h"
38 
39 #include "rsb/rsbexports.h"
40 
41 namespace rsb {
42 namespace patterns {
43 
52 class Method : public Participant,
53  public Handler,
54  public boost::enable_shared_from_this<Method> {
55 public:
56  Method(const Scope& scope,
57  const std::string& name,
60  virtual ~Method();
61 
62  // Will override method in Participant.
63  void activate();
64 
65  // Will override method in Participant.
66  void deactivate();
67 
71  const std::string& getName() const;
72 protected:
77 
81  const ParticipantConfig& getListenerConfig() const;
82 
89  virtual ListenerPtr makeListener();
90 
95 
99  const ParticipantConfig& getInformerConfig() const;
100 
107  virtual InformerBasePtr makeInformer();
108 private:
109  std::string name;
110 
113 
116 };
117 
118 typedef boost::shared_ptr<Method> MethodPtr;
119 
120 }
121 }
ListenerPtr listener
Definition: Server.h:114
virtual InformerBasePtr makeInformer()
Creates and returns the Informer participant.
Definition: Server.cpp:93
Method(const Scope &scope, const std::string &name, const ParticipantConfig &listenerConfig, const ParticipantConfig &informerConfig)
Definition: Server.cpp:34
Objects of this class participate in the exchange of notifications on one channel of the bus...
Definition: Participant.h:64
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:115
ParticipantConfig listenerConfig
Definition: Server.h:111
const ParticipantConfig & getInformerConfig() const
Returns the configuration for the Informer participant.
Definition: Server.cpp:89
boost::shared_ptr< Listener > ListenerPtr
Definition: Listener.h:151
boost::shared_ptr< Method > MethodPtr
Definition: Server.h:118
const ParticipantConfig & getListenerConfig() const
Returns the configuration for the Listener participant.
Definition: Server.cpp:72
InformerBasePtr getInformer()
Returns the Informer participant, creating it if necessary.
Definition: Server.cpp:81
virtual ListenerPtr makeListener()
Creates and returns the Listener participant.
Definition: Server.cpp:76
std::string name
Definition: Server.h:109
Base class for method classes.
Definition: Server.h:52
ParticipantConfig informerConfig
Definition: Server.h:112
A class describing the configuration of Participant instances.
boost::shared_ptr< InformerBase > InformerBasePtr
Definition: Informer.h:214
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:64