34 group = getPeers().add(portName,
this);
41 options.
put(
"source", sourceName);
42 options.
put(
"destination", portName);
43 options.
put(
"sender_side",
45 options.
put(
"receiver_side",
48 return configureFromProperty(options);
56 std::string script = options.
check(
"type",
Value(
"lua")).asString();
57 std::string filename = options.
check(
"file",
Value(
"modifier")).asString();
58 std::string constraint = options.
check(
"constraint",
Value(
"")).asString();
60 std::string context = options.
check(
"context",
Value(
"")).asString();
70 binder->setAcceptConstraint(constraint.c_str());
72 std::string strFile = filename;
81 strFile = rf.
findFile(filename+
".lua");
89 info.
put(
"filename", strFile);
90 info.
put(
"type", script);
98 bReady = binder->load(info);
109 binder->setParams(params);
119 binder->getParams(params);
134 if(!binder->hasUpdate()) {
145 if(result.
write(con.getWriter())) {
146 con.getReader().setParentConnectionReader(&reader);
147 return con.getReader();
159 localReader = &reader;
161 if(binder->hasAccept())
167 result = binder->acceptData(thing);
181 if(thing.
write(con.getWriter())) {
182 localReader = &con.getReader();
189 result = group->acceptIncomingData(
this);
203 if(!binder->hasUpdate()) {
222 if(!binder->hasAccept()) {
229 bool result = binder->acceptData(thing);
241 if(!binder->hasUpdateReply()) {
247 thing.setPortReader(&reader);
263 if (peers==
nullptr) {
277 for (
auto& it : peerSet)
const yarp::os::LogComponent & PORTMONITORCARRIER()
static MonitorBinding * create(const char *script_type)
factory method
virtual bool canAccept()=0
virtual bool peerTrigged()=0
virtual bool acceptIncomingData(PortMonitor *source)
Allow to monitor and modify port data from Lua script Under development.
void getCarrierParams(yarp::os::Property ¶ms) const override
Get carrier configuration and deliver it by port administrative commands.
yarp::os::ConnectionReader & modifyIncomingData(yarp::os::ConnectionReader &reader) override
Modify incoming payload data, if appropriate.
const yarp::os::PortWriter & modifyOutgoingData(const yarp::os::PortWriter &writer) override
Modify outgoing payload data, if appropriate.
yarp::os::PortReader & modifyReply(yarp::os::PortReader &reader) override
Modify reply payload data, if appropriate.
void setCarrierParams(const yarp::os::Property ¶ms) override
Configure carrier from port administrative commands.
bool configureFromProperty(yarp::os::Property &options) override
bool acceptIncomingData(yarp::os::ConnectionReader &reader) override
Determine whether incoming data should be accepted.
bool acceptOutgoingData(const yarp::os::PortWriter &writer) override
Determine whether outgoing data should be accepted.
MonitorBinding * getBinder()
bool configure(yarp::os::ConnectionState &proto) override
Class PortMonitor.
An interface for reading from a network connection.
virtual void setParentConnectionReader(ConnectionReader *parentConnectionReader)
Set ConnectionReader to be used for reading the envelope.
The basic state of a connection - route, streams in use, etc.
virtual Contactable * getContactable() const =0
Get the port associated with the connection.
virtual const Route & getRoute() const =0
Get the route associated with this connection.
virtual std::string getSenderSpecifier() const =0
Extract a name for the sender, if the connection type supports that.
static void unlock()
Call post() on a global mutual-exclusion semaphore allocated by YARP.
static void lock()
Call wait() on a global mutual-exclusion semaphore allocated by YARP.
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...
A class for storing options and configuration information.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
void fromString(const std::string &txt, bool wipe=true)
Interprets a string as a list of properties.
void put(const std::string &key, const std::string &value)
Associate the given key with the given string.
bool check(const std::string &key) const override
Check if there exists a property of the given name.
void clear()
Remove all associations.
Helper class for finding config files and other external resources.
bool setDefaultContext(const std::string &contextName)
Sets the context for the current ResourceFinder object.
bool configure(int argc, char *argv[], bool skipFirstArgument=true)
Sets up the ResourceFinder.
std::string findFile(const std::string &name)
Find the full path to a file.
const std::string & getToName() const
Get the destination of the route.
const std::string & getCarrierName() const
Get the carrier type of the route.
const std::string & getFromName() const
Get the source of the route.
Base class for generic things.
bool setConnectionReader(yarp::os::ConnectionReader &reader)
set a reference to a ConnectionReader
yarp::os::PortWriter * getPortWriter()
yarp::os::PortReader * getPortReader()
bool write(yarp::os::ConnectionWriter &connection)
void setPortWriter(yarp::os::PortWriter *writer)
Set the reference to a PortWriter object.
A single value (typically within a Bottle).
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual std::string asString() const
Get string value.
#define yCError(component,...)
#define yCAssert(component, x)
An interface to the operating system, including Port based communication.