YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
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:

Static Public Member Functions

static void initMinimum ()
 Basic system initialization, not including plugins.
 
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.
 
static void autoInitMinimum ()
 Basic system initialization, not including plugins.
 
static void autoInitMinimum (yarp::os::yarpClockType clockType, yarp::os::Clock *custom=nullptr)
 Basic system initialization, not including plugins.
 
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.
 
static void finiMinimum ()
 Deinitialization, excluding plugins.
 
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.
 
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.
 
static bool disconnect (const std::string &src, const std::string &dest, bool quiet)
 Request that an output port disconnect from an input port.
 
static bool disconnect (const std::string &src, const std::string &dest, const ContactStyle &style)
 Request that an output port disconnect from an input port.
 
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.
 
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 with tcp carrier exists between two ports.
 
static bool isConnected (const std::string &src, const std::string &dest, const ContactStyle &style)
 Check if a connection with tcp carrier exists between two ports.
 
static bool isConnected (const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
 Check if a connection with specified carrier exists between two ports.
 
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.
 
static bool exists (const std::string &port, const ContactStyle &style, bool checkVer=true)
 Check for a port to be ready and responsive.
 
static bool sync (const std::string &port, bool quiet=true)
 Wait for a port to be ready and responsive.
 
static void assertion (bool shouldBeTrue)
 An assertion.
 
static Contact queryName (const std::string &name)
 Find out information about a registered name.
 
static Contact registerName (const std::string &name)
 Register a name with the name server.
 
static Contact registerContact (const Contact &contact)
 Register contact information with the name server.
 
static Contact unregisterName (const std::string &name)
 Removes the registration for a name from the name server.
 
static Contact unregisterContact (const Contact &contact)
 Removes the registration for a contact from the name server.
 
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.
 
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.
 
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).
 
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).
 
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).
 
static bool setLocalMode (bool flag)
 Chooses whether communication is process-local.
 
static bool getLocalMode ()
 Get current value of flag "localMode", see setLocalMode function.
 
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.
 
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).
 
static bool writeToNameServer (PortWriter &cmd, PortReader &reply, const ContactStyle &style)
 Variant write method specialized to name server.
 
static bool write (const std::string &port_name, PortWriter &cmd, PortReader &reply)
 Variant write method with port name specified directly.
 
static bool checkNetwork ()
 Check if the YARP Network is up and running.
 
static bool checkNetwork (double timeout)
 Check if a name server is running and responding.
 
static bool initialized ()
 Returns true if YARP has been fully initialized.
 
static void setVerbosity (int verbosity)
 Set level of verbosity of YARP messages.
 
static void queryBypass (NameStore *store)
 Redirect queries to another source.
 
static NameStoregetQueryBypass ()
 
static bool registerCarrier (const char *name, const char *dll)
 Register a carrier to make available at runtime.
 
static void lock ()
 Call wait() on a global mutual-exclusion semaphore allocated by YARP.
 
static void unlock ()
 Call post() on a global mutual-exclusion semaphore allocated by YARP.
 
static bool localNetworkAllocation ()
 Check where the name server in use expects processes to allocate their own network resources.
 
static Contact detectNameServer (bool useDetectedServer, bool &scanNeeded, bool &serverUsed)
 Scan for an available name server.
 
static bool setNameServerContact (Contact &nameServerContact)
 Set explicitly the nameserver information.
 
static std::string getConfigFile (const char *fname)
 Search for a configuration file in YARP's standard config file path.
 
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).
 
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.
 
static bool setConnectionQos (const std::string &src, const std::string &dest, const QosStyle &style, bool quiet=true)
 Adjust the Qos preferences of a connection.
 
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.
 
static bool isValidPortName (const std::string &portName)
 Checks that the port has a valid name.
 
static bool waitConnection (const std::string &source, const std::string &destination, bool quiet=false)
 Delays the system until a specified connection is established.
 
static bool waitPort (const std::string &target, bool quiet=false)
 Delays the system until a specified port is open.
 
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.
 
static int sendMessage (const std::string &port, yarp::os::PortWriter &writable, std::string &output, bool quiet)
 Sends a message to the specified port.
 
static int disconnectInput (const std::string &src, const std::string &dest, bool silent=false)
 Sends a disconnection command to the specified port.
 
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.
 

Detailed Description

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

Definition at line 37 of file Network.h.

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 1060 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 857 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 862 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 1370 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 1376 of file Network.cpp.

◆ connect() [1/3]

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

Definition at line 118 of file Network.h.

◆ connect() [2/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 692 of file Network.cpp.

◆ connect() [3/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.

Definition at line 682 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 1919 of file Network.cpp.

◆ disconnect() [1/4]

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

Definition at line 176 of file Network.h.

◆ disconnect() [2/4]

bool NetworkBase::disconnect ( const std::string &  src,
const std::string &  dest,
bool  quiet 
)
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 700 of file Network.cpp.

◆ disconnect() [3/4]

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 709 of file Network.cpp.

◆ disconnect() [4/4]

bool NetworkBase::disconnect ( const std::string &  src,
const std::string &  dest,
const std::string &  carrier = "",
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
carrierthe name of the protocol to use (tcp/udp/mcast)
quietsuppress messages displayed upon success/failure
Returns
true on success, false on failure

Definition at line 717 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 1511 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 746 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 753 of file Network.cpp.

◆ finiMinimum()

void NetworkBase::finiMinimum ( )
static

Deinitialization, excluding plugins.

Definition at line 939 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 1955 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 1182 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 1961 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 1054 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 1353 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 1345 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 1043 of file Network.cpp.

◆ getQueryBypass()

NameStore * NetworkBase::getQueryBypass ( )
static

Definition at line 1405 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 1382 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 871 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 907 of file Network.cpp.

◆ isConnected() [1/4]

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

Definition at line 225 of file Network.h.

◆ isConnected() [2/4]

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

Check if a connection with tcp carrier 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 727 of file Network.cpp.

◆ isConnected() [3/4]

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

Check if a connection with tcp carrier 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 1331 of file Network.cpp.

◆ isConnected() [4/4]

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

Check if a connection with specified carrier exists between two ports.

Parameters
srcthe name of an output port
destthe name of an input port
carrierthe name of the protocol to use (tcp/udp/mcast). if a connection exists but using a different carrier, the method will return false
quietsuppress messages displayed upon success/failure
Returns
true if there is a connection

Definition at line 736 of file Network.cpp.

◆ isNetworkInitialized()

bool NetworkBase::isNetworkInitialized ( )
static

Definition at line 876 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 1193 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 1912 of file Network.cpp.

◆ lock()

void NetworkBase::lock ( )
static

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

Definition at line 1418 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 1505 of file Network.cpp.

◆ queryBypass()

void NetworkBase::queryBypass ( NameStore store)
static

Redirect queries to another source.

Definition at line 1400 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 995 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 1882 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 1017 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 1010 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 1429 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 1437 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 1072 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 1067 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.

Definition at line 1049 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 1928 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 1359 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 1035 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
Deprecated:
since YARP 3.4

Definition at line 1388 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 847 of file Network.cpp.

◆ unlock()

void NetworkBase::unlock ( )
static

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

Definition at line 1423 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 1029 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 1023 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 803 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 825 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 1219 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 1234 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 1324 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 1942 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 958 of file Network.cpp.


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