Client for YARP name server. More...
#include <yarp/os/impl/NameClient.h>
Public Member Functions | |
virtual | ~NameClient () |
Destructor. More... | |
Contact | getAddress () |
The address of the name server. More... | |
Contact | queryName (const std::string &name) |
Look up the address of a named port. More... | |
Contact | registerName (const std::string &name) |
Register a port with a given name. More... | |
Contact | registerName (const std::string &name, const Contact &suggest) |
Register a port with a given name and a partial address. More... | |
Contact | unregisterName (const std::string &name) |
Register disassociation of name from port. More... | |
Contact | probe (const std::string &cmd) |
Send a message to the name server, and interpret the result as an address. More... | |
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. More... | |
bool | send (yarp::os::Bottle &cmd, yarp::os::Bottle &reply) |
Send a message to the nameserver in Bottle format, and return the result. More... | |
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. More... | |
bool | isFakeMode () const |
Check whether a fake name server is being used. More... | |
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. More... | |
void | setSave (bool allow=true) |
Control whether the name client can save the address of the name server in a cache file. More... | |
bool | didScan () |
Check whether the name client scanned for the address of the name server. More... | |
bool | didSave () |
Check whether the name client saved the address of the name server. More... | |
bool | updateAddress () |
Force the name client to reread the cached location of the name server. More... | |
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. More... | |
static NameClient * | create () |
static Contact | extractAddress (const std::string &txt) |
Extract an address from its text representation. More... | |
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 34 of file NameClient.h.
|
virtual |
Destructor.
Definition at line 120 of file NameClient.cpp.
|
static |
Definition at line 134 of file NameClient.cpp.
bool NameClient::didSave | ( | ) |
Check whether the name client saved the address of the name server.
Definition at line 450 of file NameClient.cpp.
bool NameClient::didScan | ( | ) |
Check whether the name client scanned for the address of the name server.
Definition at line 445 of file NameClient.cpp.
Definition at line 289 of file NameClient.cpp.
|
static |
Extract an address from its text representation.
txt | the text representation of an address |
Definition at line 273 of file NameClient.cpp.
Contact NameClient::getAddress | ( | ) |
The address of the name server.
Definition at line 140 of file NameClient.cpp.
std::string NameClient::getMode | ( | ) |
Definition at line 489 of file NameClient.cpp.
|
static |
Get an instance of the name client.
This is a global singleton, created on demand.
Definition at line 128 of file NameClient.cpp.
yarp::os::Nodes & NameClient::getNodes | ( | ) |
Definition at line 494 of file NameClient.cpp.
NameStore * NameClient::getQueryBypass | ( | ) |
Definition at line 484 of file NameClient.cpp.
bool NameClient::isFakeMode | ( | ) | const |
Check whether a fake name server is being used.
Definition at line 430 of file NameClient.cpp.
Contact NameClient::probe | ( | const std::string & | cmd | ) |
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 267 of file NameClient.cpp.
void NameClient::queryBypass | ( | NameStore * | store | ) |
Definition at line 479 of file NameClient.cpp.
Contact NameClient::queryName | ( | const std::string & | name | ) |
Look up the address of a named port.
name | the name of the port |
Definition at line 146 of file NameClient.cpp.
Contact NameClient::registerName | ( | const std::string & | name | ) |
Register a port with a given name.
name | the name of the port |
Definition at line 166 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 171 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 302 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 407 of file NameClient.cpp.
bool NameClient::setContact | ( | const yarp::os::Contact & | contact | ) |
Definition at line 468 of file NameClient.cpp.
void NameClient::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.
fake | whether to use a fake name server |
Definition at line 425 of file NameClient.cpp.
void NameClient::setSave | ( | bool | allow = true | ) |
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 440 of file NameClient.cpp.
void NameClient::setScan | ( | bool | allow = true | ) |
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 435 of file NameClient.cpp.
Contact NameClient::unregisterName | ( | const std::string & | name | ) |
Register disassociation of name from port.
name | the name to remove |
Definition at line 260 of file NameClient.cpp.
bool NameClient::updateAddress | ( | ) |
Force the name client to reread the cached location of the name server.
Definition at line 455 of file NameClient.cpp.