YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
Contact.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_CONTACT_H
8#define YARP_OS_CONTACT_H
9
10#include <yarp/conf/compiler.h>
11#include <yarp/conf/system.h>
12
14
15#include <string>
16
17namespace yarp::os {
18class Searchable;
19} // namespace yarp::os
20
21
22namespace yarp::os {
23
33{
34public:
45 Contact(const std::string& name = std::string(),
46 const std::string& carrier = std::string(),
47 const std::string& hostname = std::string(),
48 int port = -1);
49
56 Contact(const std::string& hostname,
57 int port);
58
66 Contact(const std::string& carrier,
67 const std::string& hostname,
68 int port);
69
75 Contact(const Contact& rhs);
76
82 Contact(Contact&& rhs) noexcept;
83
87 virtual ~Contact();
88
95 Contact& operator=(const Contact& rhs);
96
103 Contact& operator=(Contact&& rhs) noexcept;
104
118 static Contact fromConfig(const Searchable& config);
119
128 static Contact fromString(const std::string& txt);
129
141 std::string getName() const;
142
148 void setName(const std::string& name);
149
158 std::string getRegName() const;
159
170 std::string getHost() const;
171
177 void setHost(const std::string& hostname);
178
189 int getPort() const;
190
191
197 void setPort(int port);
198
209 std::string getCarrier() const;
210
216 void setCarrier(const std::string& carrier);
217
227 const NestedContact& getNested() const;
228
235 void setNestedContact(const yarp::os::NestedContact& nestedContact);
236
245 bool hasTimeout() const;
246
252 float getTimeout() const;
253
259 void setTimeout(float timeout);
260
273 void setSocket(const std::string& carrier,
274 const std::string& hostname,
275 int port);
276
287 bool isValid() const;
288
294 std::string toString() const;
295
302 std::string toURI(bool includeCarrier = true) const;
303
313 static std::string convertHostToIp(const char* name);
314
317#ifndef DOXYGEN_SHOULD_SKIP_THIS
318private:
319 class Private;
320 Private* mPriv;
321#endif // DOXYGEN_SHOULD_SKIP_THIS
322};
323
324} // namespace yarp::os
325
326#endif // YARP_OS_CONTACT_H
std::string toString(const T &value)
convert an arbitrary type to string.
A mini-server for performing network communication in the background.
Represents how to reach a part of a YARP network.
Definition Contact.h:33
A placeholder for rich contact information.
A base class for nested structures that can be searched.
Definition Searchable.h:31
An interface to the operating system, including Port based communication.
#define YARP_os_API
Definition api.h:18