Client for YARP name server. More...
#include <yarp/os/impl/NameClient.h>
Public Member Functions | |
virtual | ~NameClient () |
Destructor. | |
Contact | getAddress () |
The address of the name server. | |
Contact | queryName (const std::string &name) |
Look up the address of a named port. | |
Contact | registerName (const std::string &name) |
Register a port with a given name. | |
Contact | registerName (const std::string &name, const Contact &suggest) |
Register a port with a given name and a partial address. | |
Contact | unregisterName (const std::string &name) |
Register disassociation of name from port. | |
Contact | probe (const std::string &cmd) |
Send a message to the name server, and interpret the result as an address. | |
std::string | send (const std::string &cmd, bool multi=true, const ContactStyle &style=ContactStyle()) |
Send a text message to the nameserver, and return the result. | |
bool | send (yarp::os::Bottle &cmd, yarp::os::Bottle &reply) |
Send a message to the nameserver in Bottle format, and return the result. | |
void | setFakeMode (bool fake=true) |
For testing, the nameclient can be set to use a "fake" name server rather than communicating with an external name server. | |
bool | isFakeMode () const |
Check whether a fake name server is being used. | |
void | setScan (bool allow=true) |
Control whether the name client should scan for the name server if the cached connection information for it is inaccurate. | |
void | setSave (bool allow=true) |
Control whether the name client can save the address of the name server in a cache file. | |
bool | didScan () |
Check whether the name client scanned for the address of the name server. | |
bool | didSave () |
Check whether the name client saved the address of the name server. | |
bool | updateAddress () |
Force the name client to reread the cached location of the name server. | |
bool | setContact (const yarp::os::Contact &contact) |
void | queryBypass (NameStore *store) |
NameStore * | getQueryBypass () |
std::string | getMode () |
yarp::os::Nodes & | getNodes () |
Static Public Member Functions | |
static NameClient & | getNameClient () |
Get an instance of the name client. | |
static NameClient * | create () |
static Contact | extractAddress (const std::string &txt) |
Extract an address from its text representation. | |
static Contact | extractAddress (const Bottle &bot) |
Client for YARP name server.
There is one global client available from the getNameClient method. The protocol spoken by the name client is rather old; there are simpler ways of talking to the name server these days - it is now a regular port, that can read and respond to messages in the bottle format.
Definition at line 32 of file NameClient.h.
|
virtual |
Destructor.
Definition at line 117 of file NameClient.cpp.
|
static |
Definition at line 131 of file NameClient.cpp.
bool NameClient::didSave | ( | ) |
Check whether the name client saved the address of the name server.
Definition at line 454 of file NameClient.cpp.
bool NameClient::didScan | ( | ) |
Check whether the name client scanned for the address of the name server.
Definition at line 449 of file NameClient.cpp.
Definition at line 286 of file NameClient.cpp.
Extract an address from its text representation.
txt | the text representation of an address |
Definition at line 270 of file NameClient.cpp.
Contact NameClient::getAddress | ( | ) |
The address of the name server.
Definition at line 137 of file NameClient.cpp.
std::string NameClient::getMode | ( | ) |
Definition at line 493 of file NameClient.cpp.
|
static |
Get an instance of the name client.
This is a global singleton, created on demand.
Definition at line 125 of file NameClient.cpp.
yarp::os::Nodes & NameClient::getNodes | ( | ) |
Definition at line 498 of file NameClient.cpp.
NameStore * NameClient::getQueryBypass | ( | ) |
Definition at line 488 of file NameClient.cpp.
bool NameClient::isFakeMode | ( | ) | const |
Check whether a fake name server is being used.
Definition at line 434 of file NameClient.cpp.
Send a message to the name server, and interpret the result as an address.
cmd | the message to send (in text form) |
Definition at line 264 of file NameClient.cpp.
Definition at line 483 of file NameClient.cpp.
Look up the address of a named port.
name | the name of the port |
Definition at line 143 of file NameClient.cpp.
Register a port with a given name.
name | the name of the port |
Definition at line 163 of file NameClient.cpp.
Register a port with a given name and a partial address.
name | the name of the port |
suggest | a partially completed address |
Definition at line 168 of file NameClient.cpp.
std::string NameClient::send | ( | const std::string & | cmd, |
bool | multi = true , |
||
const ContactStyle & | style = ContactStyle() |
||
) |
Send a text message to the nameserver, and return the result.
cmd | the message to send. |
multi | whether to expect a multi-line response. |
Definition at line 299 of file NameClient.cpp.
bool NameClient::send | ( | yarp::os::Bottle & | cmd, |
yarp::os::Bottle & | reply | ||
) |
Send a message to the nameserver in Bottle format, and return the result.
[in] | cmd | the message to send. |
[out] | the | reply from the name server. |
Definition at line 411 of file NameClient.cpp.
bool NameClient::setContact | ( | const yarp::os::Contact & | contact | ) |
Definition at line 472 of file NameClient.cpp.
For testing, the nameclient can be set to use a "fake" name server rather than communicating with an external name server.
fake | whether to use a fake name server |
Definition at line 429 of file NameClient.cpp.
Control whether the name client can save the address of the name server in a cache file.
allow | true if the name client may save the name server address. |
Definition at line 444 of file NameClient.cpp.
Control whether the name client should scan for the name server if the cached connection information for it is inaccurate.
allow | true if the name client may scan for the name server. |
Definition at line 439 of file NameClient.cpp.
Register disassociation of name from port.
name | the name to remove |
Definition at line 257 of file NameClient.cpp.
bool NameClient::updateAddress | ( | ) |
Force the name client to reread the cached location of the name server.
Definition at line 459 of file NameClient.cpp.