YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
NameSpace.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_NAMESPACE_H
7#define YARP_OS_NAMESPACE_H
8
9#include <yarp/os/Contact.h>
10#include <yarp/os/NameStore.h>
11#include <yarp/os/Network.h>
12#include <yarp/os/Value.h>
13
14namespace yarp::os {
15
22{
23public:
27 virtual ~NameSpace();
28
33 virtual bool checkNetwork();
34
43 virtual bool checkNetwork(double timeout);
44
49 virtual Contact getNameServerContact() const = 0;
50
55 virtual std::string getNameServerName() const;
56
60 virtual Contact queryName(const std::string& name) = 0;
61
65 virtual Contact registerName(const std::string& name) = 0;
66
70 virtual Contact registerContact(const Contact& contact) = 0;
71
75 virtual Contact unregisterName(const std::string& name) = 0;
76
80 virtual Contact unregisterContact(const Contact& contact) = 0;
81
92 virtual Contact registerAdvanced(const Contact& contact,
93 NameStore* store)
94 {
95 YARP_UNUSED(store);
96 return registerContact(contact);
97 }
98
103 virtual Contact unregisterAdvanced(const std::string& name,
104 NameStore* store)
105 {
106 YARP_UNUSED(store);
107 return unregisterName(name);
108 }
109
113 virtual bool setProperty(const std::string& name,
114 const std::string& key,
115 const Value& value) = 0;
116
122 virtual Value *getProperty(const std::string& name,
123 const std::string& key) = 0;
124
128 virtual bool connectPortToTopic(const Contact& src,
129 const Contact& dest,
130 const ContactStyle& style) = 0;
131
135 virtual bool connectTopicToPort(const Contact& src,
136 const Contact& dest,
137 const ContactStyle& style) = 0;
138
142 virtual bool disconnectPortFromTopic(const Contact& src,
143 const Contact& dest,
144 const ContactStyle& style) = 0;
145
149 virtual bool disconnectTopicFromPort(const Contact& src,
150 const Contact& dest,
151 const ContactStyle& style) = 0;
152
156 virtual bool connectPortToPortPersistently(const Contact& src,
157 const Contact& dest,
158 const ContactStyle& style) = 0;
159
164 const Contact& dest,
165 const ContactStyle& style) = 0;
166
171 virtual bool localOnly() const = 0;
172
176 virtual bool usesCentralServer() const = 0;
177
182 virtual bool serverAllocatesPortNumbers() const = 0;
183
189 virtual bool connectionHasNameOfEndpoints() const = 0;
190
201 bool& scanNeeded,
202 bool& serverUsed) = 0;
203
208 virtual bool writeToNameServer(PortWriter& cmd,
209 PortReader& reply,
210 const ContactStyle& style) = 0;
211
212};
213
214} // namespace yarp::os
215
216#endif // YARP_OS_NAMESPACE_H
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
virtual bool usesCentralServer() const =0
Check if a central server is involved in managing the NameSpace.
virtual Contact registerName(const std::string &name)=0
Record contact information to tie to a port name.
virtual Contact detectNameServer(bool useDetectedServer, bool &scanNeeded, bool &serverUsed)=0
Find a name server for this NameSpace, if applicable.
virtual Contact unregisterAdvanced(const std::string &name, NameStore *store)
Remove contact information, with access to the contact information of other ports for cross-referenci...
Definition NameSpace.h:103
virtual Contact queryName(const std::string &name)=0
Map from port name to contact information.
virtual Contact getNameServerContact() const =0
Get an address for a name server that manages the name space, if available.
virtual bool serverAllocatesPortNumbers() const =0
Check if a central server is responsible for allocating port numbers, or if this should be left up to...
virtual bool disconnectTopicFromPort(const Contact &src, const Contact &dest, const ContactStyle &style)=0
Stop subscribing a port to a topic.
virtual bool localOnly() const =0
Check if the NameSpace is only valid for the current process ("local").
virtual bool disconnectPortFromTopic(const Contact &src, const Contact &dest, const ContactStyle &style)=0
Stop publishing a port to a topic.
virtual bool connectPortToPortPersistently(const Contact &src, const Contact &dest, const ContactStyle &style)=0
Connect two ports with persistence.
virtual ~NameSpace()
Destructor.
virtual bool connectionHasNameOfEndpoints() const =0
When connections are made involving ports managed by this NameSpace do the ports involved end up know...
virtual Contact unregisterContact(const Contact &contact)=0
Disassociate contact information (should include a port name).
virtual Contact registerAdvanced(const Contact &contact, NameStore *store)
Record contact information, with access to the contact information of other ports for cross-referenci...
Definition NameSpace.h:92
virtual bool connectTopicToPort(const Contact &src, const Contact &dest, const ContactStyle &style)=0
Subscribe a port to a topic.
virtual Contact unregisterName(const std::string &name)=0
Disassociate contact information from a port name.
virtual bool writeToNameServer(PortWriter &cmd, PortReader &reply, const ContactStyle &style)=0
Write a message to a name server for this NameSpace, if applicable.
virtual bool connectPortToTopic(const Contact &src, const Contact &dest, const ContactStyle &style)=0
Publish a port to a topic.
virtual Contact registerContact(const Contact &contact)=0
Record contact information (should include a port name).
virtual bool setProperty(const std::string &name, const std::string &key, const Value &value)=0
Associate a key/value pair with a named port.
virtual Value * getProperty(const std::string &name, const std::string &key)=0
Get the value of a named key from a named port.
virtual bool disconnectPortToPortPersistently(const Contact &src, const Contact &dest, const ContactStyle &style)=0
Disconnect two ports, removing any persistence.
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
A single value (typically within a Bottle).
Definition Value.h:43
An interface to the operating system, including Port based communication.
#define YARP_UNUSED(var)
Definition api.h:162
#define YARP_os_API
Definition api.h:18