YARP
Yet Another Robot Platform
RosLookup.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#include <yarp/os/Contact.h>
7
8#include <cstdio>
9#include <string>
10
12{
13public:
14 bool valid;
15 std::string hostname;
17 std::string protocol;
18
20 valid(false),
21 portnum(-1)
22 {}
23
24 bool lookupCore(const std::string& name);
25
26 bool lookupTopic(const std::string& name);
27
28 std::string toString() const {
29 char buf[1000];
30 sprintf(buf,"/%s:%d/", hostname.c_str(), portnum);
31 return buf;
32 }
33
34 yarp::os::Contact toContact(const char *carrier) {
35 return yarp::os::Contact(carrier,hostname.c_str(), portnum);
36 }
37
40};
static yarp::os::Contact getRosCoreAddress()
Definition: RosLookup.cpp:127
std::string protocol
Definition: RosLookup.h:17
bool lookupTopic(const std::string &name)
Definition: RosLookup.cpp:73
std::string hostname
Definition: RosLookup.h:15
RosLookup()
Definition: RosLookup.h:19
std::string toString() const
Definition: RosLookup.h:28
bool valid
Definition: RosLookup.h:14
yarp::os::Contact toContact(const char *carrier)
Definition: RosLookup.h:34
bool lookupCore(const std::string &name)
Definition: RosLookup.cpp:36
int portnum
Definition: RosLookup.h:16
static yarp::os::Contact getRosCoreAddressFromEnv()
Definition: RosLookup.cpp:118
Represents how to reach a part of a YARP network.
Definition: Contact.h:33