本文整理汇总了C++中yarp::os::ConnectionState::getContactable方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionState::getContactable方法的具体用法?C++ ConnectionState::getContactable怎么用?C++ ConnectionState::getContactable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::os::ConnectionState
的用法示例。
在下文中一共展示了ConnectionState::getContactable方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: configure
// Read connection settings.
bool PortMonitor::configure(yarp::os::ConnectionState& proto)
{
portName = proto.getRoute().getToName();
sourceName = proto.getRoute().getFromName();
group = getPeers().add(portName,this);
if (!group) return false;
Property options;
options.fromString(proto.getSenderSpecifier().c_str());
if(binder) delete binder;
binder = NULL;
ConstString script = options.check("type", Value("lua")).asString();
ConstString filename = options.check("file", Value("modifier")).asString();
ConstString constraint = options.check("constraint", Value("")).asString();
// context is used to find the script files
ConstString context = options.check("context", Value("")).asString();
// check which monitor should be used
if((binder = MonitorBinding::create(script.c_str())) == NULL)
{
yError("Currently only \'lua\' script and \'dll\' object is supported by portmonitor");
return false;
}
// set the acceptance constraint
binder->setAcceptConstraint(constraint.c_str());
ConstString strFile = filename;
if(script != "dll")
{
yarp::os::ResourceFinder rf;
rf.setDefaultContext(context.c_str());
rf.configure(0, NULL);
strFile = rf.findFile(filename.c_str());
if(strFile == "")
strFile = rf.findFile(filename+".lua");
}
// provide some useful information for the monitor object
// which can be accessed in the create() callback.
Property info;
info.clear();
info.put("filename", strFile);
info.put("type", script);
info.put("sender_side",
(proto.getContactable()->getName() == sourceName));
info.put("receiver_side",
(proto.getContactable()->getName() == portName));
info.put("source", sourceName);
info.put("destination", portName);
info.put("carrier", proto.getRoute().getCarrierName());
PortMonitor::lock();
bReady = binder->load(info);
PortMonitor::unlock();
return bReady;
}
示例2: configure
// Read connection settings.
bool PortMonitor::configure(yarp::os::ConnectionState& proto)
{
portName = proto.getRoute().getToName();
sourceName = proto.getRoute().getFromName();
group = getPeers().add(portName,this);
if (!group) return false;
Property options;
options.fromString(proto.getSenderSpecifier().c_str());
options.put("source", sourceName);
options.put("destination", portName);
options.put("sender_side",
(proto.getContactable()->getName() == sourceName) ? 1 : 0);
options.put("receiver_side",
(proto.getContactable()->getName() == portName) ? 1 : 0);
options.put("carrier", proto.getRoute().getCarrierName());
return configureFromProperty(options);
}