10 #ifndef YARP_OS_NETWORK_H
11 #define YARP_OS_NETWORK_H
31 #define YARP_DECLARE_PLUGINS(name) extern "C" void add_ ## name ## _plugins();
32 #define YARP_REGISTER_PLUGINS(name) add_ ## name ## _plugins();
50 static void initMinimum();
65 static void autoInitMinimum();
96 Clock* custom =
nullptr);
101 static void finiMinimum();
108 static bool isNetworkInitialized();
118 static bool connect(
const std::string& src,
119 const std::string& dest,
120 const std::string& carrier =
"",
129 return connect(std::string(src),
131 std::string((carrier ==
nullptr) ?
"" : carrier),
142 static bool connect(
const std::string& src,
143 const std::string& dest,
153 static bool disconnect(
const std::string& src,
154 const std::string& dest,
164 static bool disconnect(
const std::string& src,
165 const std::string& dest,
176 static bool disconnect(
const std::string& src,
177 const std::string& dest,
178 const std::string& carrier =
"",
187 return disconnect(std::string(src),
189 std::string((carrier ==
nullptr) ?
"" : carrier),
200 static bool isConnected(
const std::string& src,
201 const std::string& dest,
211 static bool isConnected(
const std::string& src,
212 const std::string& dest,
223 static bool isConnected(
const std::string& src,
224 const std::string& dest,
225 const std::string& carrier =
"",
234 return isConnected(std::string(src),
236 std::string((carrier ==
nullptr) ?
"" : carrier),
246 static bool exists(
const std::string& port,
248 bool checkVer =
true);
256 static bool exists(
const std::string& port,
258 bool checkVer =
true);
266 static bool sync(
const std::string& port,
275 static void assertion(
bool shouldBeTrue);
287 static Contact queryName(
const std::string& name);
297 static Contact registerName(
const std::string& name);
316 static Contact unregisterName(
const std::string& name);
338 static bool setProperty(
const char* name,
350 static Value* getProperty(
const char* name,
360 static std::string getNameServerName();
368 static Contact getNameServerContact();
379 static bool setNameServerName(
const std::string& name);
389 static bool setLocalMode(
bool flag);
395 static bool getLocalMode();
397 #ifndef YARP_NO_DEPRECATED
413 static std::string
readString(
bool* eof =
nullptr);
438 double timeout = -1);
466 static bool writeToNameServer(
PortWriter& cmd,
480 static bool write(
const std::string& port_name,
493 static bool checkNetwork();
506 static bool checkNetwork(
double timeout);
516 static bool initialized();
518 #ifndef YARP_NO_DEPRECATED
525 YARP_DEPRECATED_MSG("Use LogComponents instead")
526 static void setVerbosity(
int verbosity);
534 static void queryBypass(
NameStore* store);
538 #ifndef YARP_NO_DEPRECATED
548 YARP_DEPRECATED_MSG("Use yarp::conf::environment::getEnvironment instead")
550 bool* found =
nullptr);
562 const std::
string& val);
576 #ifndef YARP_NO_DEPRECATED
582 YARP_DEPRECATED_MSG("Use yarp::conf::filesystem::preferred_separator instead")
583 static std::string getDirectorySeparator();
591 static std::
string getPathSeparator();
602 static bool registerCarrier(
const char* name,
613 static void unlock();
623 static bool localNetworkAllocation();
636 static Contact detectNameServer(
bool useDetectedServer,
646 static bool setNameServerContact(
Contact& nameServerContact);
657 static std::string getConfigFile(
const char* fname);
669 static int getDefaultPortRange();
679 static bool setConnectionQos(
const std::string& src,
680 const std::string& dest,
692 static bool setConnectionQos(
const std::string& src,
693 const std::string& dest,
705 static bool getConnectionQos(
const std::string& src,
706 const std::string& dest,
716 static bool isValidPortName(
const std::string& portName);
725 static bool waitConnection(
const std::string& source,
726 const std::string& destination,
735 static bool waitPort(
const std::string& target,
bool quiet =
false);
741 static int sendMessage(
const std::string& port,
743 bool silent =
false);
753 static int sendMessage(
const std::string& port,
765 static int disconnectInput(
const std::string& src,
766 const std::string& dest,
767 bool silent =
false);
776 static int poll(
const std::string& target,
bool silent =
false);
829 Clock* custom =
nullptr);
Abstract interface for a database of port names.
Utilities for manipulating the YARP network, excluding initialization and shutdown.
static bool isConnected(const char *src, const char *dest, const char *carrier, bool quiet=true)
static bool connect(const char *src, const char *dest, const char *carrier, bool quiet=true)
static bool disconnect(const char *src, const char *dest, const char *carrier, bool quiet=true)
Utilities for manipulating the YARP network, including initialization and shutdown.
Network(yarp::os::yarpClockType clockType, yarp::os::Clock *custom=nullptr)
Initialize the YARP network using the specified clock.
static void fini()
Deinitialization.
virtual ~Network()
Destructor.
static void init()
Initialization.
static void init(yarp::os::yarpClockType clockType, Clock *custom=nullptr)
Initialization.
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Preferences for the port's Quality of Service.
A single value (typically within a Bottle).
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
void setEnvironment(const std::string &key, const std::string &val)
Set or change an environment variable.
std::string getEnvironment(const char *key, bool *found=nullptr)
Read a variable from the environment.
void unsetEnvironment(const std::string &key)
Remove an environment variable.
std::string readString(bool *eof)
bool write(const ImageOf< PixelRgb > &src, const std::string &dest, image_fileformat format=FORMAT_PPM)
The main, catch-all namespace for YARP.