YARP
Yet Another Robot Platform
yarp::os::NetworkBase Class Reference

Utilities for manipulating the YARP network, excluding initialization and shutdown. More...

#include <yarp/os/Network.h>

+ Inheritance diagram for yarp::os::NetworkBase:

Detailed Description

Utilities for manipulating the YARP network, excluding initialization and shutdown.

Definition at line 43 of file 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 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=true)
 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 isConnected (const std::string &src, const std::string &dest, bool quiet=true)
 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 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 ValuegetProperty (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 NameStoregetQueryBypass ()
 
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...
 

Member Function Documentation

◆ assertion()

void NetworkBase::assertion ( bool  shouldBeTrue)
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.

Parameters
shouldBeTruethe asserted truth value.

Definition at line 978 of file Network.cpp.

◆ autoInitMinimum() [1/2]

void NetworkBase::autoInitMinimum ( )
static

Basic system initialization, not including plugins.

A matching finiMinimum() will be called automatically on program termination.

Definition at line 776 of file Network.cpp.

◆ autoInitMinimum() [2/2]

void NetworkBase::autoInitMinimum ( yarp::os::yarpClockType  clockType,
yarp::os::Clock custom = nullptr 
)
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 780 of file Network.cpp.

◆ checkNetwork() [1/2]

bool NetworkBase::checkNetwork ( )
static

Check if the YARP Network is up and running.

Basically, checks if a yarp name server is running and responding.

Returns
true if the YARP Network is active.

Definition at line 1292 of file Network.cpp.

◆ checkNetwork() [2/2]

bool NetworkBase::checkNetwork ( double  timeout)
static

Check if a name server is running and responding.

Parameters
timeouttime in seconds to wait for a response from a name server.
Returns
true if the name server responds within the given time.

Definition at line 1297 of file Network.cpp.

◆ connect() [1/3]

bool NetworkBase::connect ( const std::string &  src,
const std::string &  dest,
const std::string &  carrier = "",
bool  quiet = true 
)
static

Request that an output port connect to an input port.

Parameters
srcthe name of an output port
destthe name of an input port
carrierthe name of the protocol to use (tcp/udp/mcast)
quietsuppress messages displayed upon success/failure
Returns
true on success, false on failure
Examples:
carrier/carrier_stub.cpp, framerate/main.cpp, os/buffered_port.cpp, os/simple_receiver.cpp, port_power/ex0002_connector.cpp, port_power/ex0502_raw_target_connector.cpp, and portaudio/sound_receiver.cpp.

Definition at line 620 of file Network.cpp.

◆ connect() [2/3]

static bool yarp::os::NetworkBase::connect ( const char *  src,
const char *  dest,
const char *  carrier,
bool  quiet = true 
)
inlinestatic

Definition at line 117 of file Network.h.

◆ connect() [3/3]

bool NetworkBase::connect ( const std::string &  src,
const std::string &  dest,
const ContactStyle style 
)
static

Request that an output port connect to an input port.

Parameters
srcthe name of an output port
destthe name of an input port
styleoptions for connection
Returns
true on success, false on failure

Definition at line 631 of file Network.cpp.

◆ detectNameServer()

Contact NetworkBase::detectNameServer ( bool  useDetectedServer,
bool &  scanNeeded,
bool &  serverUsed 
)
static

Scan for an available name server.

Parameters
useDetectedServerIf a name server is found, use it.
scanNeededTrue if a network scan was done to find server.
serverUsedTrue if a server was found and configured for use.
Returns
address of name server.

Definition at line 1794 of file Network.cpp.

◆ disconnect() [1/2]

bool NetworkBase::disconnect ( const std::string &  src,
const std::string &  dest,
bool  quiet = true 
)
static

Request that an output port disconnect from an input port.

Parameters
srcthe name of an output port
destthe name of an input port
quietsuppress messages displayed upon success/failure
Returns
true on success, false on failure

Definition at line 638 of file Network.cpp.

◆ disconnect() [2/2]

bool NetworkBase::disconnect ( const std::string &  src,
const std::string &  dest,
const ContactStyle style 
)
static

Request that an output port disconnect from an input port.

Parameters
srcthe name of an output port
destthe name of an input port
styleoptions for network communication related to disconnection
Returns
true on success, false on failure

Definition at line 646 of file Network.cpp.

◆ disconnectInput()

int NetworkBase::disconnectInput ( const std::string &  src,
const std::string &  dest,
bool  silent = false 
)
static

Sends a disconnection command to the specified port.

Parameters
srcthe port to send the command to
destthe port that has to be disconnected
silentflag for verbosity
Returns
0 on success

Definition at line 1456 of file Network.cpp.

◆ exists() [1/2]

bool NetworkBase::exists ( const std::string &  port,
bool  quiet = true,
bool  checkVer = true 
)
static

Check for a port to be ready and responsive.

Parameters
portthe name of a port
quietsuppress messages displayed during check
Returns
true on success, false on failure

Definition at line 661 of file Network.cpp.

◆ exists() [2/2]

bool NetworkBase::exists ( const std::string &  port,
const ContactStyle style,
bool  checkVer = true 
)
static

Check for a port to be ready and responsive.

Parameters
portthe name of a port
styleoptions for network communication
Returns
true on success, false on failure

Definition at line 668 of file Network.cpp.

◆ finiMinimum()

void NetworkBase::finiMinimum ( )
static

Deinitialization, excluding plugins.

Definition at line 861 of file Network.cpp.

◆ getConfigFile()

std::string NetworkBase::getConfigFile ( const char *  fname)
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.

Returns
full name of file including path

Definition at line 1827 of file Network.cpp.

◆ getConnectionQos()

bool NetworkBase::getConnectionQos ( const std::string &  src,
const std::string &  dest,
QosStyle srcStyle,
QosStyle destStyle,
bool  quiet = true 
)
static

Gets the Qos preferences of a connection.

Parameters
srcthe name of an output port
destthe name of an input port
srcStylethe Qos preference of the output port
destStylethe Qos preference of the input port
Returns
true if the Qos preferences are gotten correctly

Definition at line 1101 of file Network.cpp.

◆ getDefaultPortRange()

int NetworkBase::getDefaultPortRange ( )
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).

Returns
the beginning of YARP's port range, as specified by the environment variable YARP_PORT_RANGE (or 10000 if not set)

Definition at line 1832 of file Network.cpp.

◆ getDirectorySeparator()

std::string NetworkBase::getDirectorySeparator ( )
static

Get an OS-appropriate directory separator (e.g.

"/" on linux)

Definition at line 1341 of file Network.cpp.

◆ getEnvironment()

std::string NetworkBase::getEnvironment ( const char *  key,
bool *  found = nullptr 
)
static

Read a variable from the environment.

Parameters
keythe variable to read
foundan optional variable to set to true iff variable is found
Returns
the value of the environment variable, or "" if not found

Definition at line 1321 of file Network.cpp.

◆ getLocalMode()

bool NetworkBase::getLocalMode ( )
static

Get current value of flag "localMode", see setLocalMode function.

Returns
state of the flag.

Definition at line 973 of file Network.cpp.

◆ getNameServerContact()

Contact NetworkBase::getNameServerContact ( )
static

Get the contact information for the port associated with the nameserver (usually "/root", but this can be overwritten by the "yarp namespace" command).

Returns
contact informatoin for the port associated with the nameserver

Definition at line 1276 of file Network.cpp.

◆ getNameServerName()

std::string NetworkBase::getNameServerName ( )
static

Get the name of the port associated with the nameserver (usually "/root", but this can be overwritten by the "yarp namespace" command).

Returns
name of the port associated with the nameserver

Definition at line 1269 of file Network.cpp.

◆ getPathSeparator()

std::string NetworkBase::getPathSeparator ( )
static

Get an OS-appropriate path separator (e.g.

":" on linux)

Definition at line 1351 of file Network.cpp.

◆ getProperty()

Value * NetworkBase::getProperty ( const char *  name,
const char *  key 
)
static

Look up the value associated with a particular key for a named entry registered with the nameserver.

Parameters
nameThe name registered with the nameserver (typically a port).
keyThe key to provide a value for.
Returns
the value associated with the given key.

Definition at line 964 of file Network.cpp.

◆ getQueryBypass()

NameStore * NetworkBase::getQueryBypass ( )
static

Definition at line 1315 of file Network.cpp.

◆ initialized()

bool NetworkBase::initialized ( )
static

Returns true if YARP has been fully initialized.

Returns
true if YARP has been initialized (by creating a yarp::os::Network object or calling yarp::os::Network::init).

Definition at line 1302 of file Network.cpp.

◆ initMinimum() [1/2]

void NetworkBase::initMinimum ( )
static

Basic system initialization, not including plugins.

Must eventually make a matching call to finiMinimum().

Definition at line 788 of file Network.cpp.

◆ initMinimum() [2/2]

void NetworkBase::initMinimum ( yarp::os::yarpClockType  clockType,
yarp::os::Clock custom = nullptr 
)
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 815 of file Network.cpp.

◆ isConnected() [1/2]

bool NetworkBase::isConnected ( const std::string &  src,
const std::string &  dest,
bool  quiet = true 
)
static

Check if a connection exists between two ports.

Parameters
srcthe name of an output port
destthe name of an input port
quietsuppress messages displayed upon success/failure
Returns
true if there is a connection

Definition at line 653 of file Network.cpp.

◆ isConnected() [2/2]

bool NetworkBase::isConnected ( const std::string &  src,
const std::string &  dest,
const ContactStyle style 
)
static

Check if a connection exists between two ports.

Parameters
srcthe name of an output port
destthe name of an input port
styleoptions for network communication
Returns
true if there is a connection

Definition at line 1256 of file Network.cpp.

◆ isValidPortName()

bool NetworkBase::isValidPortName ( const std::string &  portName)
static

Checks that the port has a valid name.

Parameters
portNamethe name of port
Returns
true if portName is valid

Definition at line 1110 of file Network.cpp.

◆ localNetworkAllocation()

bool NetworkBase::localNetworkAllocation ( )
static

Check where the name server in use expects processes to allocate their own network resources.

Returns
true if local network resource allocation is expected.

Definition at line 1788 of file Network.cpp.

◆ lock()

void NetworkBase::lock ( )
static

Call wait() on a global mutual-exclusion semaphore allocated by YARP.

Definition at line 1369 of file Network.cpp.

◆ poll()

int NetworkBase::poll ( const std::string &  target,
bool  silent = false 
)
static

Sends a 'describe yourself' message to a specified port, in order to receive information about the port and its connections.

Parameters
targetthe name of the port to be described
silentflag for verbosity
Returns
0 on success

Definition at line 1451 of file Network.cpp.

◆ queryBypass()

void NetworkBase::queryBypass ( NameStore store)
static

Redirect queries to another source.

Definition at line 1311 of file Network.cpp.

◆ queryName()

Contact NetworkBase::queryName ( const std::string &  name)
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).

Parameters
namethe name to query
Returns
full contact information for the name. If nothing is known about the name, the returned contact is invalid (Contact::isValid returns false)

Definition at line 921 of file Network.cpp.

◆ readString()

std::string NetworkBase::readString ( bool *  eof = nullptr)
static

Read a line of arbitrary length from standard input.

Parameters
eofIf 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.
Returns
A string from standard input, without newline or linefeed characters.
Deprecated:
since YARP 3.0.0

Definition at line 985 of file Network.cpp.

◆ registerCarrier()

bool NetworkBase::registerCarrier ( const char *  name,
const char *  dll 
)
static

Register a carrier to make available at runtime.

Parameters
namename of carrier
dllname of shared library carrier is implemented in
Returns
true if carrier was registered

Definition at line 1761 of file Network.cpp.

◆ registerContact()

Contact NetworkBase::registerContact ( const Contact contact)
static

Register contact information with the name server.

The name server will fill in any extra information needed to make the contact information complete..

Parameters
contactthe proposed contact information (may be incomplete)
Returns
the contact information now associated with a name (in other words, what Contact::queryName would now return)

Definition at line 941 of file Network.cpp.

◆ registerName()

Contact NetworkBase::registerName ( const std::string &  name)
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.

Parameters
namethe name to register
Returns
the contact information now associated with that name (in other words, what Contact::queryName would now return)

Definition at line 935 of file Network.cpp.

◆ sendMessage() [1/2]

int NetworkBase::sendMessage ( const std::string &  port,
yarp::os::PortWriter writable,
bool  silent = false 
)
static

Just a reminder to sendMessage with temporary output parameter that will be discarded.

Definition at line 1378 of file Network.cpp.

◆ sendMessage() [2/2]

int NetworkBase::sendMessage ( const std::string &  port,
yarp::os::PortWriter writable,
std::string &  output,
bool  quiet 
)
static

Sends a message to the specified port.

Parameters
portname of destination port
writablethe object to be written to the port
outputstorage string for the output message received from port
quietflag for verbosity
Returns
0 on success

Definition at line 1386 of file Network.cpp.

◆ setConnectionQos() [1/2]

bool NetworkBase::setConnectionQos ( const std::string &  src,
const std::string &  dest,
const QosStyle srcStyle,
const QosStyle destStyle,
bool  quiet = true 
)
static

Adjust the Qos preferences of a connection.

Parameters
srcthe name of an output port
destthe name of an input port
srcStylethe Qos preference of the output port
destStylethe Qos preference of the input port
Returns
true if the Qos preferences are set correctly

Definition at line 995 of file Network.cpp.

◆ setConnectionQos() [2/2]

bool NetworkBase::setConnectionQos ( const std::string &  src,
const std::string &  dest,
const QosStyle style,
bool  quiet = true 
)
static

Adjust the Qos preferences of a connection.

Parameters
srcthe name of an output port
destthe name of an input port
stylethe Qos preference of both input and output ports
Returns
true if the Qos preferences are set correctly

Definition at line 990 of file Network.cpp.

◆ setEnvironment()

void NetworkBase::setEnvironment ( const std::string &  key,
const std::string &  val 
)
static

Set or change an environment variable.

Parameters
keythe variable to set or change
valthe target value

Definition at line 1333 of file Network.cpp.

◆ setLocalMode()

bool NetworkBase::setLocalMode ( bool  flag)
static

Chooses whether communication is process-local.

Call this with flag=true to avoid ever consulting an external nameserver.

Parameters
flagtrue if communication should be local to the calling process.
Returns
prior state of this flag.
Examples:
os/buffered_port.cpp.

Definition at line 969 of file Network.cpp.

◆ setNameServerContact()

bool NetworkBase::setNameServerContact ( Contact nameServerContact)
static

Set explicitly the nameserver information.

Parameters
nameServerContactthe NameServer contact information (e.g. IP, port)
Returns
true if succeed. False otherwise

Definition at line 1802 of file Network.cpp.

◆ setNameServerName()

bool NetworkBase::setNameServerName ( const std::string &  name)
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.

Returns
true on success

Definition at line 1282 of file Network.cpp.

◆ setProperty()

bool NetworkBase::setProperty ( const char *  name,
const char *  key,
const Value value 
)
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).

Parameters
nameThe name registered with the nameserver (typically a port).
keyThe key to provide a value for.
valueThe value associated with the key for the named entry.
Returns
true on success.

Definition at line 957 of file Network.cpp.

◆ setVerbosity()

void NetworkBase::setVerbosity ( int  verbosity)
static

Set level of verbosity of YARP messages.

Parameters
verbosity-1 inhibits messages, 0 is normal, 1 is verbose

Definition at line 1307 of file Network.cpp.

◆ sync()

bool NetworkBase::sync ( const std::string &  port,
bool  quiet = true 
)
static

Wait for a port to be ready and responsive.

Parameters
portthe name of a port
quietsuppress messages displayed during wait
Returns
true on success, false on failure

Definition at line 766 of file Network.cpp.

◆ unlock()

void NetworkBase::unlock ( )
static

Call post() on a global mutual-exclusion semaphore allocated by YARP.

Definition at line 1373 of file Network.cpp.

◆ unregisterContact()

Contact NetworkBase::unregisterContact ( const Contact contact)
static

Removes the registration for a contact from the name server.

Parameters
contactthe contact to unregister
Returns
the contact information now associated with its former name (in other words, what Contact::queryName would now return). This will be the invalid contact (Contact::isValid is false).

Definition at line 952 of file Network.cpp.

◆ unregisterName()

Contact NetworkBase::unregisterName ( const std::string &  name)
static

Removes the registration for a name from the name server.

Parameters
namethe name to unregister
Returns
the contact information now associated with that name (in other words, what Contact::queryName would now return). This will be the invalid contact (Contact::isValid is false).

Definition at line 947 of file Network.cpp.

◆ unsetEnvironment()

void NetworkBase::unsetEnvironment ( const std::string &  key)
static

Remove an environment variable.

Parameters
keythe variable to remove

Definition at line 1337 of file Network.cpp.

◆ waitConnection()

bool NetworkBase::waitConnection ( const std::string &  source,
const std::string &  destination,
bool  quiet = false 
)
static

Delays the system until a specified connection is established.

Parameters
sourcename of the source port of the connection
destinationname of the dest port of the connection
quietflag for verbosity
Returns
true when the connection is finally found

Definition at line 721 of file Network.cpp.

◆ waitPort()

bool NetworkBase::waitPort ( const std::string &  target,
bool  quiet = false 
)
static

Delays the system until a specified port is open.

Parameters
targetname of the port to wait for
quietflag for verbosity
Returns
true when the port is finally open

Definition at line 743 of file Network.cpp.

◆ write() [1/3]

bool NetworkBase::write ( const Contact contact,
PortWriter cmd,
PortReader reply,
bool  admin = false,
bool  quiet = false,
double  timeout = -1 
)
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.

Parameters
contactthe target to communicate with
cmdthe message to send
replythe response is read here
admintrue for administrative message, false for regular data
quiettrue to suppress error messages
timeoutactivity timeout in seconds
Returns
true on success

Definition at line 1141 of file Network.cpp.

◆ write() [2/3]

bool NetworkBase::write ( const Contact contact,
PortWriter cmd,
PortReader reply,
const ContactStyle style 
)
static

Variant write method with options bundled into a yarp::os::ContactStyle (there was getting to be too many of them).

Parameters
contactthe target to communicate with
cmdthe message to send
replythe response if any is read here
styleoptions for the connection
Returns
true on success

Definition at line 1155 of file Network.cpp.

◆ write() [3/3]

bool NetworkBase::write ( const std::string &  port_name,
PortWriter cmd,
PortReader reply 
)
static

Variant write method with port name specified directly.

Parameters
port_namethe target to communicate with
cmdthe message to send
replythe response is read here
Returns
true on success

Definition at line 1250 of file Network.cpp.

◆ writeToNameServer()

bool NetworkBase::writeToNameServer ( PortWriter cmd,
PortReader reply,
const ContactStyle style 
)
static

Variant write method specialized to name server.

Parameters
cmdthe message to send
replythe response if any is read here
styleoptions for the connection
Returns
true on success

Definition at line 1815 of file Network.cpp.

◆ yarpClockInit()

void yarp::os::NetworkBase::yarpClockInit ( yarp::os::yarpClockType  clockType,
Clock custom = nullptr 
)
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 881 of file Network.cpp.


The documentation for this class was generated from the following files: