RSB  0.17.0
IntrospectionSender.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 <vector>
30 #include <string>
31 
32 #include <boost/shared_ptr.hpp>
33 
34 #include <boost/thread/mutex.hpp>
35 
36 #include <rsc/logging/Logger.h>
37 
38 #include "../Participant.h"
39 #include "../Listener.h"
40 #include "../Informer.h"
41 #include "../Factory.h"
42 
43 #include "../patterns/LocalServer.h"
44 
45 #include "Model.h"
46 
47 namespace rsb {
48 namespace introspection {
49 
58 friend struct QueryHandler;
59 public:
60  IntrospectionSender(boost::shared_ptr<std::string> processDisplayName,
61  const ParticipantConfig& listenerConfig
62  = getFactory().getDefaultParticipantConfig(),
63  const ParticipantConfig& informerConfig
64  = getFactory().getDefaultParticipantConfig());
65 
66  void addParticipant(ParticipantPtr participant,
67  ParticipantPtr parent);
68 
69  bool removeParticipant(const Participant& participant);
70 private:
71  typedef std::vector<ParticipantInfo> ParticipantList;
72 
73  rsc::logging::LoggerPtr logger;
74 
75  boost::mutex mutex;
76 
77  boost::shared_ptr<std::string> processDisplayName;
78 
79  ParticipantList participants;
82 
85 
87 
88  void sendHello(const ParticipantInfo& participant,
89  EventPtr query = EventPtr());
90 
91  void sendBye(const ParticipantInfo& participant);
92 };
93 
94 typedef boost::shared_ptr<IntrospectionSender> IntrospectionSenderPtr;
95 
96 }
97 }
Instances of this class store information about participants in the current process.
Definition: Model.h:53
Instances of this class store information about the current process.
Definition: Model.h:100
boost::shared_ptr< LocalServer > LocalServerPtr
Definition: LocalServer.h:489
Objects of this class participate in the exchange of notifications on one channel of the bus...
Definition: Participant.h:65
boost::shared_ptr< std::string > processDisplayName
Instances of this class publish information about the local host, the current process and its partici...
void sendHello(const ParticipantInfo &participant, EventPtr query=EventPtr())
boost::shared_ptr< IntrospectionSender > IntrospectionSenderPtr
Factory & getFactory()
Returns a factory for client-level RSB objects.
Definition: Factory.cpp:163
void addParticipant(ParticipantPtr participant, ParticipantPtr parent)
boost::shared_ptr< Listener > ListenerPtr
Definition: Listener.h:155
boost::shared_ptr< Participant > ParticipantPtr
Definition: Participant.h:122
rsb::patterns::LocalServerPtr server
bool removeParticipant(const Participant &participant)
Instances of this class store information about the local host.
Definition: Model.h:157
A class describing the configuration of Participant instances.
boost::shared_ptr< InformerBase > InformerBasePtr
Definition: Informer.h:217
std::vector< ParticipantInfo > ParticipantList
IntrospectionSender(boost::shared_ptr< std::string > processDisplayName, const ParticipantConfig &listenerConfig=getFactory().getDefaultParticipantConfig(), const ParticipantConfig &informerConfig=getFactory().getDefaultParticipantConfig())
boost::shared_ptr< Event > EventPtr
Definition: Event.h:264
void sendBye(const ParticipantInfo &participant)