19 "yarp.portmonitor.rpcMonitor",
25bool split(const
std::
string &s,
std::map<
std::
string,
std::
string>& parameters) {
26 std::istringstream iss(s);
28 while (std::getline(iss, item,
'+')) {
29 const auto point = item.find(
'.');
30 parameters[item.substr(0, point)] = item.substr(point + 1);
42 const std::string source_port = (sender ? source : destination) +
"/monitor";
44 const std::string carrier = options.
find(
"carrier").
asString();
45 std::map<std::string, std::string> parameters;
46 if (!split(carrier, parameters)) {
47 yCError(RPCMONITOR,
"Error parsing the parameters.");
50 const std::string monitor_port = ((parameters.find(
"monitor") != parameters.end()) ? parameters[
"monitor"] :
"/monitor");
53 yCError(RPCMONITOR,
"Attaching on receiver side is not supported yet.");
57 yCError(RPCMONITOR,
"Could not open port %s.", source_port.c_str());
61 yCError(RPCMONITOR,
"Could not connect to port %s.", monitor_port.c_str());
75 msg.
addString(sender ?
"client" :
"server");
78 auto& bargs [[maybe_unused]] = msg.
addList();
79 auto& breply [[maybe_unused]] = msg.
addList();
82 bcmd.
addString(reply->cmd.get(0).toString());
85 bcmd.addString(cmd->get(0).toString());
88 yCWarning(RPCMONITOR) <<
"Sending unknown command";
89 bcmd.addString(
"[unknown]");
104 msg.
addString(sender ?
"rpc client" :
"rpc server");
107 auto& bargs [[maybe_unused]] = msg.
addList();
108 auto& breply [[maybe_unused]] = msg.
addList();
111 bcmd.
addString(reply->cmd.get(0).toString());
117 yCWarning(RPCMONITOR) <<
"Received unknown reply";
118 bcmd.addString(
"[unknown]");
yarp::os::Things & updateReply(yarp::os::Things &thing) override
The updateReply makes it possible to modify a reply from a port when the portmonitor object is attach...
bool create(const yarp::os::Property &options) override
This will be called when the dll is properly loaded by the portmonitor carrier.
yarp::os::Things & update(yarp::os::Things &thing) override
After data get accpeted in the accept() callback, an instance of that is given to the update function...
A simple collection of objects that can be described and transmitted in a portable way.
Bottle & addList()
Places an empty nested list in the bottle, at the end of the list.
void addFloat64(yarp::conf::float64_t x)
Places a 64-bit floating point number in the bottle, at the end of the list.
void addString(const char *str)
Places a string in the bottle, at the end of the list.
std::string toString() const override
Gives a human-readable textual representation of the bottle.
static LogCallback printCallback()
Get current print callback.
static LogType minimumPrintLevel()
Get current minimum print level.
bool write(const PortWriter &writer, const PortWriter *callback=nullptr) const override
Write an object to the port.
bool addOutput(const std::string &name) override
Add an output connection to the specified port.
bool openFake(const std::string &name)
Start port without making it accessible from the network.
static bool copyPortable(const PortWriter &writer, PortReader &reader)
Copy one portable to another, via writing and reading.
A class for storing options and configuration information.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
static double nowSystem()
Base class for generic things.
virtual bool asBool() const
Get boolean value.
virtual std::string asString() const
Get string value.
#define yCError(component,...)
#define yCWarning(component,...)
#define yCDebug(component,...)
#define YARP_LOG_COMPONENT(name,...)