YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
RosNameSpace.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef YARP_OS_ROSNAMESPACE_H
7#define YARP_OS_ROSNAMESPACE_H
8
9#include <yarp/os/Bottle.h>
10#include <yarp/os/NameSpace.h>
11#include <yarp/os/Network.h>
12#include <yarp/os/Thread.h>
13
14#include <cstdio>
15#include <mutex>
16
17namespace yarp::os {
18
20{
21public:
22 RosNameSpace(const Contact& contact);
23
24 virtual ~RosNameSpace();
25
26 Contact getNameServerContact() const override;
27
28 Contact queryName(const std::string& name) override;
29 Contact registerName(const std::string& name) override;
30 Contact registerContact(const Contact& contact) override;
31 Contact unregisterName(const std::string& name) override;
32 Contact unregisterContact(const Contact& contact) override;
33 virtual Contact registerAdvanced(const Contact& contact,
34 NameStore* store) override;
35 virtual Contact unregisterAdvanced(const std::string& name,
36 NameStore* store) override;
37
38 virtual bool setProperty(const std::string& name,
39 const std::string& key,
40 const Value& value) override;
41
42 virtual Value* getProperty(const std::string& name,
43 const std::string& key) override;
44
45 virtual bool connectPortToTopic(const Contact& src,
46 const Contact& dest,
47 const ContactStyle& style) override;
48 virtual bool connectTopicToPort(const Contact& src,
49 const Contact& dest,
50 const ContactStyle& style) override;
51 virtual bool disconnectPortFromTopic(const Contact& src,
52 const Contact& dest,
53 const ContactStyle& style) override;
54 virtual bool disconnectTopicFromPort(const Contact& src,
55 const Contact& dest,
56 const ContactStyle& style) override;
57 virtual bool connectPortToPortPersistently(const Contact& src,
58 const Contact& dest,
59 const ContactStyle& style) override;
60 virtual bool disconnectPortToPortPersistently(const Contact& src,
61 const Contact& dest,
62 const ContactStyle& style) override;
63 virtual bool connectTopic(Bottle& cmd,
64 bool srcIsTopic,
65 const Contact& src,
66 const Contact& dest,
67 const ContactStyle& style,
69
70 bool localOnly() const override;
71 bool usesCentralServer() const override;
72 bool serverAllocatesPortNumbers() const override;
73 bool connectionHasNameOfEndpoints() const override;
74
75 virtual Contact detectNameServer(bool useDetectedServer,
76 bool& scanNeeded,
77 bool& serverUsed) override;
78 virtual bool writeToNameServer(PortWriter& cmd,
79 PortReader& reply,
80 const ContactStyle& style) override;
81
82
89 static std::string toRosName(const std::string& name);
90 static std::string fromRosName(const std::string& name);
91 static std::string toRosNodeName(const std::string& name);
92 static std::string fromRosNodeName(const std::string& name);
93 static Contact rosify(const Contact& contact);
94
95 void run() override;
96
97private:
98 Contact contact;
99 Bottle pending;
100 std::mutex mutex;
101};
102
103} // namespace yarp::os
104
105#endif // YARP_OS_ROSNAMESPACE_H
static std::string fromRosName(const std::string &str)
Definition Node.cpp:66
static std::string toRosName(const std::string &str)
Definition Node.cpp:61
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
A mini-server for performing network communication in the background.
Preferences for how to communicate with a contact.
Represents how to reach a part of a YARP network.
Definition Contact.h:33
An abstract name space for ports.
Definition NameSpace.h:22
Abstract interface for a database of port names.
Definition NameStore.h:19
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition PortReader.h:24
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition PortWriter.h:23
An abstraction for a thread of execution.
Definition Thread.h:21
A single value (typically within a Bottle).
Definition Value.h:43
An interface to the operating system, including Port based communication.
#define YARP_os_API
Definition api.h:18