当前位置: 首页>>代码示例>>C++>>正文


C++ ConnectionState::getContactable方法代码示例

本文整理汇总了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;
}
开发者ID:BRKMYR,项目名称:yarp,代码行数:61,代码来源:PortMonitor.cpp

示例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);
}
开发者ID:silasxue,项目名称:yarp,代码行数:19,代码来源:PortMonitor.cpp


注:本文中的yarp::os::ConnectionState::getContactable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。