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