Utilities for manipulating the YARP network, excluding initialization and shutdown. More...
#include <yarp/os/Network.h>
Static Public Member Functions | |
static void | initMinimum () |
Basic system initialization, not including plugins. More... | |
static void | initMinimum (yarp::os::yarpClockType clockType, yarp::os::Clock *custom=nullptr) |
Basic system initialization, not including plugins, The clock to be initialized can be specified. More... | |
static void | autoInitMinimum () |
Basic system initialization, not including plugins. More... | |
static void | autoInitMinimum (yarp::os::yarpClockType clockType, yarp::os::Clock *custom=nullptr) |
Basic system initialization, not including plugins. More... | |
static void | yarpClockInit (yarp::os::yarpClockType clockType, Clock *custom=nullptr) |
This function specifically initialize the clock In case clockType is one of the valid cases: YARP_CLOCK_SYSTEM, YARP_CLOCK_NETWORK, YARP_CLOCK_CUSTOM (see yarp::os::Time for more), the corresponding clock will be initialized. More... | |
static void | finiMinimum () |
Deinitialization, excluding plugins. More... | |
static bool | isNetworkInitialized () |
static bool | connect (const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true) |
Request that an output port connect to an input port. More... | |
static bool | connect (const char *src, const char *dest, const char *carrier, bool quiet=true) |
static bool | connect (const std::string &src, const std::string &dest, const ContactStyle &style) |
Request that an output port connect to an input port. More... | |
static bool | disconnect (const std::string &src, const std::string &dest, bool quiet) |
Request that an output port disconnect from an input port. More... | |
static bool | disconnect (const std::string &src, const std::string &dest, const ContactStyle &style) |
Request that an output port disconnect from an input port. More... | |
static bool | disconnect (const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true) |
Request that an output port disconnect from an input port. More... | |
static bool | disconnect (const char *src, const char *dest, const char *carrier, bool quiet=true) |
static bool | isConnected (const std::string &src, const std::string &dest, bool quiet) |
Check if a connection exists between two ports. More... | |
static bool | isConnected (const std::string &src, const std::string &dest, const ContactStyle &style) |
Check if a connection exists between two ports. More... | |
static bool | isConnected (const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true) |
Check if a connection exists between two ports. More... | |
static bool | isConnected (const char *src, const char *dest, const char *carrier, bool quiet=true) |
static bool | exists (const std::string &port, bool quiet=true, bool checkVer=true) |
Check for a port to be ready and responsive. More... | |
static bool | exists (const std::string &port, const ContactStyle &style, bool checkVer=true) |
Check for a port to be ready and responsive. More... | |
static bool | sync (const std::string &port, bool quiet=true) |
Wait for a port to be ready and responsive. More... | |
static void | assertion (bool shouldBeTrue) |
An assertion. More... | |
static Contact | queryName (const std::string &name) |
Find out information about a registered name. More... | |
static Contact | registerName (const std::string &name) |
Register a name with the name server. More... | |
static Contact | registerContact (const Contact &contact) |
Register contact information with the name server. More... | |
static Contact | unregisterName (const std::string &name) |
Removes the registration for a name from the name server. More... | |
static Contact | unregisterContact (const Contact &contact) |
Removes the registration for a contact from the name server. More... | |
static bool | setProperty (const char *name, const char *key, const Value &value) |
Names registered with the nameserver can have arbitrary key->value properties associated with them. More... | |
static Value * | getProperty (const char *name, const char *key) |
Look up the value associated with a particular key for a named entry registered with the nameserver. More... | |
static std::string | getNameServerName () |
Get the name of the port associated with the nameserver (usually "/root", but this can be overwritten by the "yarp namespace" command). More... | |
static Contact | getNameServerContact () |
Get the contact information for the port associated with the nameserver (usually "/root", but this can be overwritten by the "yarp namespace" command). More... | |
static bool | setNameServerName (const std::string &name) |
Set the name of the port associated with the nameserver (usually "/root", but this can be overwritten by the "yarp namespace" command). More... | |
static bool | setLocalMode (bool flag) |
Chooses whether communication is process-local. More... | |
static bool | getLocalMode () |
Get current value of flag "localMode", see setLocalMode function. More... | |
static std::string | readString (bool *eof=nullptr) |
Read a line of arbitrary length from standard input. More... | |
static bool | write (const Contact &contact, PortWriter &cmd, PortReader &reply, bool admin=false, bool quiet=false, double timeout=-1) |
Send a single command to a port and await a single response. More... | |
static bool | write (const Contact &contact, PortWriter &cmd, PortReader &reply, const ContactStyle &style) |
Variant write method with options bundled into a yarp::os::ContactStyle (there was getting to be too many of them). More... | |
static bool | writeToNameServer (PortWriter &cmd, PortReader &reply, const ContactStyle &style) |
Variant write method specialized to name server. More... | |
static bool | write (const std::string &port_name, PortWriter &cmd, PortReader &reply) |
Variant write method with port name specified directly. More... | |
static bool | checkNetwork () |
Check if the YARP Network is up and running. More... | |
static bool | checkNetwork (double timeout) |
Check if a name server is running and responding. More... | |
static bool | initialized () |
Returns true if YARP has been fully initialized. More... | |
static void | setVerbosity (int verbosity) |
Set level of verbosity of YARP messages. More... | |
static void | queryBypass (NameStore *store) |
Redirect queries to another source. More... | |
static NameStore * | getQueryBypass () |
static std::string | getEnvironment (const char *key, bool *found=nullptr) |
Read a variable from the environment. More... | |
static void | setEnvironment (const std::string &key, const std::string &val) |
Set or change an environment variable. More... | |
static void | unsetEnvironment (const std::string &key) |
Remove an environment variable. More... | |
static std::string | getDirectorySeparator () |
Get an OS-appropriate directory separator (e.g. More... | |
static std::string | getPathSeparator () |
Get an OS-appropriate path separator (e.g. More... | |
static bool | registerCarrier (const char *name, const char *dll) |
Register a carrier to make available at runtime. More... | |
static void | lock () |
Call wait() on a global mutual-exclusion semaphore allocated by YARP. More... | |
static void | unlock () |
Call post() on a global mutual-exclusion semaphore allocated by YARP. More... | |
static bool | localNetworkAllocation () |
Check where the name server in use expects processes to allocate their own network resources. More... | |
static Contact | detectNameServer (bool useDetectedServer, bool &scanNeeded, bool &serverUsed) |
Scan for an available name server. More... | |
static bool | setNameServerContact (Contact &nameServerContact) |
Set explicitly the nameserver information. More... | |
static std::string | getConfigFile (const char *fname) |
Search for a configuration file in YARP's standard config file path. More... | |
static int | getDefaultPortRange () |
Under normal operation, YARP has a name server that manages a pool of (socket) ports starting at a point specified by the YARP_PORT_RANGE environment variable (or 10000 if that is not set). More... | |
static bool | setConnectionQos (const std::string &src, const std::string &dest, const QosStyle &srcStyle, const QosStyle &destStyle, bool quiet=true) |
Adjust the Qos preferences of a connection. More... | |
static bool | setConnectionQos (const std::string &src, const std::string &dest, const QosStyle &style, bool quiet=true) |
Adjust the Qos preferences of a connection. More... | |
static bool | getConnectionQos (const std::string &src, const std::string &dest, QosStyle &srcStyle, QosStyle &destStyle, bool quiet=true) |
Gets the Qos preferences of a connection. More... | |
static bool | isValidPortName (const std::string &portName) |
Checks that the port has a valid name. More... | |
static bool | waitConnection (const std::string &source, const std::string &destination, bool quiet=false) |
Delays the system until a specified connection is established. More... | |
static bool | waitPort (const std::string &target, bool quiet=false) |
Delays the system until a specified port is open. More... | |
static int | sendMessage (const std::string &port, yarp::os::PortWriter &writable, bool silent=false) |
Just a reminder to sendMessage with temporary output parameter that will be discarded. More... | |
static int | sendMessage (const std::string &port, yarp::os::PortWriter &writable, std::string &output, bool quiet) |
Sends a message to the specified port. More... | |
static int | disconnectInput (const std::string &src, const std::string &dest, bool silent=false) |
Sends a disconnection command to the specified port. More... | |
static int | poll (const std::string &target, bool silent=false) |
Sends a 'describe yourself' message to a specified port, in order to receive information about the port and its connections. More... | |
Utilities for manipulating the YARP network, excluding initialization and shutdown.
|
static |
An assertion.
Should be true. If false, this will be reported, and YARP will shut down. In general, this is an OS-specific process.
shouldBeTrue | the asserted truth value. |
Definition at line 1063 of file Network.cpp.
|
static |
Basic system initialization, not including plugins.
A matching finiMinimum() will be called automatically on program termination.
Definition at line 860 of file Network.cpp.
|
static |
Basic system initialization, not including plugins.
The clock to be initialized can be specified. A matching finiMinimum() will be called automatically on program termination.
Definition at line 865 of file Network.cpp.
|
static |
Check if the YARP Network is up and running.
Basically, checks if a yarp name server is running and responding.
Definition at line 1380 of file Network.cpp.
|
static |
Check if a name server is running and responding.
timeout | time in seconds to wait for a response from a name server. |
Definition at line 1386 of file Network.cpp.
|
inlinestatic |
|
static |
Request that an output port connect to an input port.
src | the name of an output port |
dest | the name of an input port |
style | options for connection |
Definition at line 695 of file Network.cpp.
|
static |
Request that an output port connect to an input port.
src | the name of an output port |
dest | the name of an input port |
carrier | the name of the protocol to use (tcp/udp/mcast) |
quiet | suppress messages displayed upon success/failure |
Definition at line 685 of file Network.cpp.
|
static |
Scan for an available name server.
useDetectedServer | If a name server is found, use it. |
scanNeeded | True if a network scan was done to find server. |
serverUsed | True if a server was found and configured for use. |
Definition at line 1963 of file Network.cpp.
|
inlinestatic |
|
static |
Request that an output port disconnect from an input port.
src | the name of an output port |
dest | the name of an input port |
quiet | suppress messages displayed upon success/failure |
Definition at line 703 of file Network.cpp.
|
static |
Request that an output port disconnect from an input port.
src | the name of an output port |
dest | the name of an input port |
style | options for network communication related to disconnection |
Definition at line 712 of file Network.cpp.
|
static |
Request that an output port disconnect from an input port.
src | the name of an output port |
dest | the name of an input port |
carrier | the name of the protocol to use (tcp/udp/mcast) |
quiet | suppress messages displayed upon success/failure |
Definition at line 720 of file Network.cpp.
|
static |
Sends a disconnection command to the specified port.
src | the port to send the command to |
dest | the port that has to be disconnected |
silent | flag for verbosity |
Definition at line 1555 of file Network.cpp.
|
static |
Check for a port to be ready and responsive.
port | the name of a port |
quiet | suppress messages displayed during check |
Definition at line 749 of file Network.cpp.
|
static |
Check for a port to be ready and responsive.
port | the name of a port |
style | options for network communication |
Definition at line 756 of file Network.cpp.
|
static |
Deinitialization, excluding plugins.
Definition at line 942 of file Network.cpp.
|
static |
Search for a configuration file in YARP's standard config file path.
Return full name of file including path. File not guaranteed to exist.
Definition at line 1999 of file Network.cpp.
|
static |
Gets the Qos preferences of a connection.
src | the name of an output port |
dest | the name of an input port |
srcStyle | the Qos preference of the output port |
destStyle | the Qos preference of the input port |
Definition at line 1192 of file Network.cpp.
|
static |
Under normal operation, YARP has a name server that manages a pool of (socket) ports starting at a point specified by the YARP_PORT_RANGE environment variable (or 10000 if that is not set).
Definition at line 2005 of file Network.cpp.
|
static |
Get an OS-appropriate directory separator (e.g.
"/" on linux)
Definition at line 1442 of file Network.cpp.
|
static |
Read a variable from the environment.
key | the variable to read |
found | an optional variable to set to true iff variable is found |
Definition at line 1422 of file Network.cpp.
|
static |
Get current value of flag "localMode", see setLocalMode function.
Definition at line 1057 of file Network.cpp.
|
static |
Get the contact information for the port associated with the nameserver (usually "/root", but this can be overwritten by the "yarp namespace" command).
Definition at line 1363 of file Network.cpp.
|
static |
Get the name of the port associated with the nameserver (usually "/root", but this can be overwritten by the "yarp namespace" command).
Definition at line 1355 of file Network.cpp.
|
static |
Get an OS-appropriate path separator (e.g.
":" on linux)
Definition at line 1447 of file Network.cpp.
|
static |
Look up the value associated with a particular key for a named entry registered with the nameserver.
name | The name registered with the nameserver (typically a port). |
key | The key to provide a value for. |
Definition at line 1046 of file Network.cpp.
|
static |
Definition at line 1415 of file Network.cpp.
|
static |
Returns true if YARP has been fully initialized.
Definition at line 1392 of file Network.cpp.
|
static |
Basic system initialization, not including plugins.
Must eventually make a matching call to finiMinimum().
Definition at line 874 of file Network.cpp.
|
static |
Basic system initialization, not including plugins, The clock to be initialized can be specified.
Must eventually make a matching call to finiMinimum().
Definition at line 910 of file Network.cpp.
|
inlinestatic |
|
static |
Check if a connection exists between two ports.
src | the name of an output port |
dest | the name of an input port |
quiet | suppress messages displayed upon success/failure |
Definition at line 730 of file Network.cpp.
|
static |
Check if a connection exists between two ports.
src | the name of an output port |
dest | the name of an input port |
style | options for network communication |
Definition at line 1341 of file Network.cpp.
|
static |
Check if a connection exists between two ports.
src | the name of an output port |
dest | the name of an input port |
carrier | the name of the protocol to use (tcp/udp/mcast) |
quiet | suppress messages displayed upon success/failure |
Definition at line 739 of file Network.cpp.
|
static |
Definition at line 879 of file Network.cpp.
|
static |
Checks that the port has a valid name.
portName | the name of port |
Definition at line 1203 of file Network.cpp.
|
static |
Check where the name server in use expects processes to allocate their own network resources.
Definition at line 1956 of file Network.cpp.
|
static |
Call wait() on a global mutual-exclusion semaphore allocated by YARP.
Definition at line 1462 of file Network.cpp.
|
static |
Sends a 'describe yourself' message to a specified port, in order to receive information about the port and its connections.
target | the name of the port to be described |
silent | flag for verbosity |
Definition at line 1549 of file Network.cpp.
|
static |
Redirect queries to another source.
Definition at line 1410 of file Network.cpp.
|
static |
Find out information about a registered name.
This communicates with the name server to find out what is known about how to contact the entity with the given name (if one exists).
name | the name to query |
Definition at line 998 of file Network.cpp.
|
static |
Read a line of arbitrary length from standard input.
eof | If non-null, this is set to true if standard input has closed. Note that some heuristics are used to guess if someone on windows has hit the equivalent of ctrl-D, the key to close a stream on unix. These heuristics will lead to false detects in some cases if the user hits strange keys. |
Definition at line 1071 of file Network.cpp.
|
static |
Register a carrier to make available at runtime.
name | name of carrier |
dll | name of shared library carrier is implemented in |
Definition at line 1926 of file Network.cpp.
Register contact information with the name server.
The name server will fill in any extra information needed to make the contact information complete..
contact | the proposed contact information (may be incomplete) |
Definition at line 1020 of file Network.cpp.
|
static |
Register a name with the name server.
The name server will allocate a way to contact that name. It is up to you to make sure that this works.
name | the name to register |
Definition at line 1013 of file Network.cpp.
|
static |
Just a reminder to sendMessage with temporary output parameter that will be discarded.
Definition at line 1473 of file Network.cpp.
|
static |
Sends a message to the specified port.
port | name of destination port |
writable | the object to be written to the port |
output | storage string for the output message received from port |
quiet | flag for verbosity |
Definition at line 1481 of file Network.cpp.
|
static |
Adjust the Qos preferences of a connection.
src | the name of an output port |
dest | the name of an input port |
srcStyle | the Qos preference of the output port |
destStyle | the Qos preference of the input port |
Definition at line 1082 of file Network.cpp.
|
static |
Adjust the Qos preferences of a connection.
src | the name of an output port |
dest | the name of an input port |
style | the Qos preference of both input and output ports |
Definition at line 1077 of file Network.cpp.
|
static |
Set or change an environment variable.
key | the variable to set or change |
val | the target value |
Definition at line 1428 of file Network.cpp.
|
static |
Chooses whether communication is process-local.
Call this with flag=true to avoid ever consulting an external nameserver.
flag | true if communication should be local to the calling process. |
Definition at line 1052 of file Network.cpp.
|
static |
Set explicitly the nameserver information.
nameServerContact | the NameServer contact information (e.g. IP, port) |
Definition at line 1972 of file Network.cpp.
|
static |
Set the name of the port associated with the nameserver (usually "/root", but this can be overwritten by the "yarp namespace" command).
This method is not thread-safe. Do not call this command while ports are being registered/unregistered or connections are being made/broken in another thread.
Definition at line 1369 of file Network.cpp.
|
static |
Names registered with the nameserver can have arbitrary key->value properties associated with them.
This method sets a value associated with a particular key for a named entry (typically a port name).
name | The name registered with the nameserver (typically a port). |
key | The key to provide a value for. |
value | The value associated with the key for the named entry. |
Definition at line 1038 of file Network.cpp.
|
static |
Set level of verbosity of YARP messages.
verbosity | -1 inhibits messages, 0 is normal, 1 is verbose |
Definition at line 1398 of file Network.cpp.
|
static |
Wait for a port to be ready and responsive.
port | the name of a port |
quiet | suppress messages displayed during wait |
Definition at line 850 of file Network.cpp.
|
static |
Call post() on a global mutual-exclusion semaphore allocated by YARP.
Definition at line 1467 of file Network.cpp.
Removes the registration for a contact from the name server.
contact | the contact to unregister |
Definition at line 1032 of file Network.cpp.
|
static |
Removes the registration for a name from the name server.
name | the name to unregister |
Definition at line 1026 of file Network.cpp.
|
static |
Remove an environment variable.
key | the variable to remove |
Definition at line 1433 of file Network.cpp.
|
static |
Delays the system until a specified connection is established.
source | name of the source port of the connection |
destination | name of the dest port of the connection |
quiet | flag for verbosity |
Definition at line 806 of file Network.cpp.
|
static |
Delays the system until a specified port is open.
target | name of the port to wait for |
quiet | flag for verbosity |
Definition at line 828 of file Network.cpp.
|
static |
Send a single command to a port and await a single response.
Similar to the "yarp rpc" command line utility. If you want to send several such commands, you'd be better off making a port and using its methods for writing with replies.
contact | the target to communicate with |
cmd | the message to send |
reply | the response is read here |
admin | true for administrative message, false for regular data |
quiet | true to suppress error messages |
timeout | activity timeout in seconds |
Definition at line 1229 of file Network.cpp.
|
static |
Variant write method with options bundled into a yarp::os::ContactStyle (there was getting to be too many of them).
contact | the target to communicate with |
cmd | the message to send |
reply | the response if any is read here |
style | options for the connection |
Definition at line 1244 of file Network.cpp.
|
static |
Variant write method with port name specified directly.
port_name | the target to communicate with |
cmd | the message to send |
reply | the response is read here |
Definition at line 1334 of file Network.cpp.
|
static |
Variant write method specialized to name server.
cmd | the message to send |
reply | the response if any is read here |
style | options for the connection |
Definition at line 1986 of file Network.cpp.
|
static |
This function specifically initialize the clock In case clockType is one of the valid cases: YARP_CLOCK_SYSTEM, YARP_CLOCK_NETWORK, YARP_CLOCK_CUSTOM (see yarp::os::Time for more), the corresponding clock will be initialized.
In case the clockType is YARP_CLOCK_DEFAULT, the environment variable YARP_CLOCK will be used to choose between system or network clock.
See description of yarp::os::Time::useNetworkClock() for more details about the network clock.
This function is called by Network constructor and by Network::init(), and Network::initMinimum().
In case of failure calls YARP_FAIL assert.
Definition at line 961 of file Network.cpp.