19#define HELPER(x) (*((NameClient*)((x)->system_resource)))
28 yAssert(system_resource !=
nullptr);
29 HELPER(
this).setContact(contact);
30 this->contact = contact;
35 if (system_resource !=
nullptr) {
37 system_resource =
nullptr;
44 return nic.queryName(name);
66 bool publish = (
cat.find(
'+') != std::string::npos);
91 bool publish = (
cat.find(
'+') != std::string::npos);
104 return nic.unregisterName(name);
124 nic.send(command, reply);
125 return reply.
size() > 0;
137 nic.send(command, reply);
147 nic.setFakeMode(
false);
153 nic.send(
"ping",
false);
174 std::string
cmd0 =
"NAME_SERVER";
180 for (
size_t i = 0;
i < in.
size();
i++) {
185 std::string result =
nic.send(
cmd0,
true, style);
187 reply2.addString(result.c_str());
191 return !result.empty();
void cat(Vector &a, const Vector &b)
A simple collection of objects that can be described and transmitted in a portable way.
void add(const Value &value)
Add a Value to the bottle, at the end of the list.
size_type size() const
Gets the number of elements in the bottle.
bool read(ConnectionReader &reader) override
Set the bottle's value based on input from a network connection.
Value & get(size_type index) const
Reads a Value v from a certain part of the list.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
A mini-server for performing network communication in the background.
void write(bool forceStrict=false)
Write the current object being returned by BufferedPort::prepare.
A dummy connection to test yarp::os::Portable implementations.
ConnectionWriter & getWriter()
Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was las...
ConnectionReader & getReader(ConnectionWriter *replyWriter=nullptr)
Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was las...
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
virtual bool read(ConnectionReader &reader)=0
Read this object from a network connection.
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
virtual bool write(ConnectionWriter &writer) const =0
Write this object to a network connection.
A single value (typically within a Bottle).
static Value * makeValue(const std::string &txt)
Create a Value from a text description.
std::string toString() const override
Return a standard text representation of the content of the object.
Contact registerName(const std::string &name) override
Record contact information to tie to a port name.
virtual bool disconnectPortFromTopic(const Contact &src, const Contact &dest, const ContactStyle &style) override
Stop publishing a port to a topic.
virtual Value * getProperty(const std::string &name, const std::string &key) override
Get the value of a named key from a named port.
Contact unregisterName(const std::string &name) override
Disassociate contact information from a port name.
Contact unregisterContact(const Contact &contact) override
Disassociate contact information (should include a port name).
Contact registerContact(const Contact &contact) override
Record contact information (should include a port name).
Contact getNameServerContact() const override
Get an address for a name server that manages the name space, if available.
virtual Contact detectNameServer(bool useDetectedServer, bool &scanNeeded, bool &serverUsed) override
Find a name server for this NameSpace, if applicable.
virtual bool setProperty(const std::string &name, const std::string &key, const Value &value) override
Associate a key/value pair with a named port.
Contact queryName(const std::string &name) override
Map from port name to contact information.
virtual bool connectPortToTopic(const Contact &src, const Contact &dest, const ContactStyle &style) override
Publish a port to a topic.
virtual bool writeToNameServer(PortWriter &cmd, PortReader &reply, const ContactStyle &style) override
Write a message to a name server for this NameSpace, if applicable.
YarpNameSpace(const Contact &contact)
Client for YARP name server.
static NameClient * create()
Small helper class to help deal with legacy YARP configuration files.
std::string getNamespace(bool refresh=false)
#define yCDebug(component,...)
#define YARP_OS_LOG_COMPONENT(name, name_string)
The components from which ports and connections are built.
An interface to the operating system, including Port based communication.