YARP
Yet Another Robot Platform
NameClient.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef YARP_OS_IMPL_NAMECLIENT_H
8#define YARP_OS_IMPL_NAMECLIENT_H
9
10#include <yarp/os/Contact.h>
12#include <yarp/os/Nodes.h>
13
14namespace yarp::os {
15
16class Bottle;
17class NameStore;
18
19} // namespace yarp::os
20
21namespace yarp::os::impl {
22
23class NameServer;
24
33{
34private:
35 NameClient();
36 NameClient(const NameClient& nic);
37
38public:
42 virtual ~NameClient();
43
51 static NameClient& getNameClient();
52
53 static NameClient* create();
54
59 Contact getAddress();
60
66 Contact queryName(const std::string& name);
67
73 Contact registerName(const std::string& name);
74
81 Contact registerName(const std::string& name, const Contact& suggest);
82
88 Contact unregisterName(const std::string& name);
89
99 Contact probe(const std::string& cmd);
100
108 static Contact extractAddress(const std::string& txt);
109
110 static Contact extractAddress(const Bottle& bot);
111
120 std::string send(const std::string& cmd, bool multi = true, const ContactStyle& style = ContactStyle());
121
131 bool send(yarp::os::Bottle& cmd, yarp::os::Bottle& reply);
132
139 void setFakeMode(bool fake = true);
140
146 bool isFakeMode() const;
147
154 void setScan(bool allow = true);
155
162 void setSave(bool allow = true);
163
170 bool didScan();
171
178 bool didSave();
179
186 bool updateAddress();
187
188 bool setContact(const yarp::os::Contact& contact);
189
190 void queryBypass(NameStore* store);
191
192 NameStore* getQueryBypass();
193
194 std::string getMode();
195
196 yarp::os::Nodes& getNodes();
197
198private:
199 Contact address;
202 bool fake;
203 NameServer* fakeServer;
204 bool allowScan;
205 bool allowSaveScan;
206 bool reportScan;
207 bool reportSaveScan;
208 bool isSetup;
209 NameStore* altStore;
210 yarp::os::Nodes nodes;
211
212 NameServer& getServer();
213 void setup();
214};
215
216} // namespace yarp::os::impl
217
218#endif // YARP_OS_IMPL_NAMECLIENT_H
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:64
Preferences for how to communicate with a contact.
Definition: ContactStyle.h:23
Represents how to reach a part of a YARP network.
Definition: Contact.h:33
Abstract interface for a database of port names.
Definition: NameStore.h:19
The Nodes class.
Definition: Nodes.h:29
Client for YARP name server.
Definition: NameClient.h:33
Implementation of a YARP2-conforming name server.
Definition: NameServer.h:43
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
Definition: system.h:338
#define YARP_os_impl_API
Definition: api.h:46