YARP  2.3.70.1
Yet Another Robot Platform
yarp::os::Network Class Reference

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

#include <yarp/os/Network.h>

+ Inheritance diagram for yarp::os::Network:

Public Member Functions

 Network ()
 Constructor. More...
 
virtual ~Network ()
 Destructor. More...
 

Static Public Member Functions

static void init ()
 Initialization. More...
 
static void fini ()
 Deinitialization. More...
 
- Static Public Member Functions inherited from yarp::os::NetworkBase
static void initMinimum ()
 Basic system initialization, not including plugins. More...
 
static void autoInitMinimum ()
 Basic system initialization, not including plugins. More...
 
static void finiMinimum ()
 Deinitialization, excluding plugins. More...
 
static bool connect (const ConstString &src, const ConstString &dest, const ConstString &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 ConstString &src, const ConstString &dest, const ContactStyle &style)
 Request that an output port connect to an input port. More...
 
static bool disconnect (const ConstString &src, const ConstString &dest, bool quiet=true)
 Request that an output port disconnect from an input port. More...
 
static bool disconnect (const ConstString &src, const ConstString &dest, const ContactStyle &style)
 Request that an output port disconnect from an input port. More...
 
static bool isConnected (const ConstString &src, const ConstString &dest, bool quiet=true)
 Check if a connection exists between two ports. More...
 
static bool isConnected (const ConstString &src, const ConstString &dest, const ContactStyle &style)
 Check if a connection exists between two ports. More...
 
static bool exists (const ConstString &port, bool quiet=true)
 Check for a port to be ready and responsive. More...
 
static bool exists (const ConstString &port, const ContactStyle &style)
 Check for a port to be ready and responsive. More...
 
static bool sync (const ConstString &port, bool quiet=true)
 Wait for a port to be ready and responsive. More...
 
static int main (int argc, char *argv[])
 The standard main method for the YARP companion utility. More...
 
static int runNameServer (int argc, char *argv[])
 Run a basic YARP name server. More...
 
static void assertion (bool shouldBeTrue)
 An assertion. More...
 
static Contact queryName (const ConstString &name)
 Find out information about a registered name. More...
 
static Contact registerName (const ConstString &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 ConstString &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 ConstString 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 ConstString &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 ConstString readString (bool *eof=YARP_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 ConstString &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 ConstString getEnvironment (const char *key, bool *found=YARP_NULLPTR)
 Read a variable from the environment. More...
 
static void setEnvironment (const ConstString &key, const ConstString &val)
 Set or change an environment variable. More...
 
static void unsetEnvironment (const ConstString &key)
 Remove an environment variable. More...
 
static ConstString getDirectorySeparator ()
 Get an OS-appropriate directory separator (e.g. More...
 
static ConstString 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 ConstString 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 ConstString &src, const ConstString &dest, const QosStyle &srcStyle, const QosStyle &destStyle, bool quiet=true)
 Adjust the Qos preferences of a connection. More...
 
static bool setConnectionQos (const ConstString &src, const ConstString &dest, const QosStyle &style, bool quiet=true)
 Adjust the Qos preferences of a connection. More...
 
static bool getConnectionQos (const ConstString &src, const ConstString &dest, QosStyle &srcStyle, QosStyle &destStyle, bool quiet=true)
 Gets the Qos preferences of a connection. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ Network()

yarp::os::Network::Network ( )

Constructor.

Configures process to use the YARP network. Can be more convenient to use than calling Network::init() directly, since it will clean things up with a call to Network::fini() automatically.

◆ ~Network()

virtual yarp::os::Network::~Network ( )
virtual

Destructor.

Disconnects from the YARP network.

Member Function Documentation

◆ fini()

static void yarp::os::Network::fini ( )
static

Deinitialization.

On some operating systems, there are certain shut-down tasks that need to be performed, and this method does them. It is a good idea to call Netork::init near the start of your program, and to call this method towards the end.

Examples:
dev/motortest.cpp.

◆ init()

static void yarp::os::Network::init ( )
static

Initialization.

On some operating systems, there are certain start-up tasks that need to be performed, and this method does them. It is a good idea to call this method near the start of your program, and to call Network::fini towards the end.


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