YARP
Yet Another Robot Platform
RosLookup.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2018 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
9 #include <tcpros_carrier_api.h>
10 
11 #include <yarp/os/Contact.h>
12 
13 #include <cstdio>
14 #include <string>
15 
17 public:
18  bool valid;
19  std::string hostname;
20  int portnum;
21  std::string protocol;
22  bool verbose;
23 
24  RosLookup(bool verbose) :
25  valid(false),
26  portnum(-1),
27  verbose(verbose)
28  {}
29 
30  bool lookupCore(const std::string& name);
31 
32  bool lookupTopic(const std::string& name);
33 
34  std::string toString() const {
35  char buf[1000];
36  sprintf(buf,"/%s:%d/", hostname.c_str(), portnum);
37  return buf;
38  }
39 
40  yarp::os::Contact toContact(const char *carrier) {
41  return yarp::os::Contact(carrier,hostname.c_str(), portnum);
42  }
43 
44  static yarp::os::Contact getRosCoreAddressFromEnv();
45  static yarp::os::Contact getRosCoreAddress();
46 };
std::string hostname
Definition: RosLookup.h:19
std::string protocol
Definition: RosLookup.h:21
yarp::os::Contact toContact(const char *carrier)
Definition: RosLookup.h:40
int portnum
Definition: RosLookup.h:20
#define YARP_tcpros_carrier_API
RosLookup(bool verbose)
Definition: RosLookup.h:24
bool valid
Definition: RosLookup.h:18
std::string toString() const
Definition: RosLookup.h:34
Represents how to reach a part of a YARP network.
Definition: Contact.h:38
bool verbose
Definition: RosLookup.h:22