YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
NameSpace.cpp
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/NameSpace.h>
7
8#include <yarp/os/Carriers.h>
10
11using namespace yarp::os;
12using namespace yarp::os::impl;
13
14
15NameSpace::~NameSpace() = default;
16
18{
19 if (localOnly()) {
20 return true;
21 }
22
24 if (!c.isValid()) {
25 return false;
26 }
27
29 if (out == nullptr) {
30 return false;
31 }
32
33 out->close();
34 delete out;
35 out = nullptr;
36
37 return true;
38}
39
40bool NameSpace::checkNetwork(double timeout)
41{
42 if (localOnly()) {
43 return true;
44 }
45
47 if (!c.isValid()) {
48 return false;
49 }
50
51 c.setTimeout((float)timeout);
53 if (out == nullptr) {
54 return false;
55 }
56
57 out->close();
58 delete out;
59 out = nullptr;
60
61 return true;
62}
63
65{
67}
A mini-server for performing network communication in the background.
std::string getName() const override
Get name of port.
static OutputProtocol * connect(const Contact &address)
Initiate a connection to an address.
Definition Carriers.cpp:282
Represents how to reach a part of a YARP network.
Definition Contact.h:33
virtual bool checkNetwork()
Check if a name space is available.
Definition NameSpace.cpp:17
virtual Contact queryName(const std::string &name)=0
Map from port name to contact information.
virtual Contact getNameServerContact() const =0
Get an address for a name server that manages the name space, if available.
virtual bool localOnly() const =0
Check if the NameSpace is only valid for the current process ("local").
virtual ~NameSpace()
Destructor.
virtual std::string getNameServerName() const
Get the port name of a name server that manages the name space, if available.
Definition NameSpace.cpp:64
The output side of an active connection between two ports.
virtual void close()=0
Negotiate an end to operations.
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.