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


C++ Contactable类代码示例

本文整理汇总了C++中Contactable的典型用法代码示例。如果您正苦于以下问题:C++ Contactable类的具体用法?C++ Contactable怎么用?C++ Contactable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Contactable类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: clear

 void clear()
 {
     if (!mutex.try_lock()) {
         return;
     }
     while (name_cache.begin() != name_cache.end()) {
         Contactable *c = name_cache.begin()->first;
         if (c) {
             mutex.unlock();
             c->interrupt();
             c->close();
             mutex.lock();
             // Close will remove the Contactable from the map only the first
             // time that a node is found (for example if "/[email protected]/node" and
             // "/[email protected]" are registered, only the first time that "/node"
             // is found it is removed automatically. The second time it must
             // be removed manually.
             if (!name_cache.empty() && name_cache.begin()->first == c) {
                 name_cache.erase(name_cache.begin());
             }
         }
     }
     mutex.unlock();
     port.interrupt();
 }
开发者ID:claudiofantacci,项目名称:yarp,代码行数:25,代码来源:Node.cpp

示例2: shouldInterpretRosMessages

bool XmlRpcCarrier::shouldInterpretRosMessages(ConnectionState& proto) {
    // We need to set the interpretRos flag, which controls
    // whether ROS-style admin messages are treated as
    // admin messages or data messages in YARP.
    // In the future, they should always be data messages.
    // For now, they should be admin messages for all ports
    // except ports tagged as corresponding to ros nodes.

    bool nodelike = false;
    Contactable *port = proto.getContactable();
    Property opt;
    if (port) {
        Property *pport = port->acquireProperties(true);
        if (pport) {
            opt = *pport;
        }
        port->releaseProperties(pport);
    }
    if (opt.check("node_like")) {
        nodelike = true;
    }

    Name n(proto.getRoute().getCarrierName() + "://test");
    ConstString rospass = n.getCarrierModifier("ros");
    interpretRos = !nodelike;
    if (rospass=="1"||rospass=="on") {
        interpretRos = true;
    }
    if (rospass=="0"||rospass=="off") {
        interpretRos = false;
    }
    return interpretRos;
}
开发者ID:JoErNanO,项目名称:yarp,代码行数:33,代码来源:XmlRpcCarrier.cpp

示例3: nc

void yarp::os::Nodes::Private::update(Contactable& contactable)
{
    NestedContact nc(contactable.getName());
    if (!nc.isNested()) {
        return;
    }
    if (!active) {
        return;
    }
    Node* node = getNode(contactable.getName(), true);
    if (node) {
        node->update(contactable);
    }
}
开发者ID:ale-git,项目名称:yarp,代码行数:14,代码来源:Nodes.cpp

示例4: update

void Nodes::update(Contactable& contactable) {
    NestedContact nc(contactable.getName());
    if (!nc.isNested()) return;
    HELPER(this).mutex.unlock();
    HELPER(this).update(contactable);
    HELPER(this).mutex.lock();
}
开发者ID:JoErNanO,项目名称:yarp,代码行数:7,代码来源:Nodes.cpp

示例5: getNode

void yarp::os::Nodes::Private::remove(Contactable& contactable)
{
    if (!active) {
        return;
    }
    Node* node = getNode(contactable.getName(), false);
    if (node) {
        node->remove(contactable);
    }
}
开发者ID:ale-git,项目名称:yarp,代码行数:10,代码来源:Nodes.cpp

示例6: waitForOutput

static bool waitForOutput(Contactable& c,double timeout) {
    double start = Time::now();
    while (Time::now()-start<timeout) {
        if (c.getOutputCount()>0) {
            return true;
        }
        Time::delay(0.1);
    }
    return false;
}
开发者ID:Karma-Revolution,项目名称:yarp,代码行数:10,代码来源:PublisherTest.cpp

示例7:

void yarp::os::Node::Helper::remove(Contactable& contactable)
{
    mutex.lock();
    NodeItem item = name_cache[&contactable];
    name_cache.erase(&contactable);
    std::string nestedName = item.nc.getNestedName();
    for (std::multimap<std::string, NodeItem>::iterator it = by_part_name.begin(); it != by_part_name.end(); ++it) {
        if (it->first == nestedName && it->second.contactable->where().toString() == contactable.where().toString()) {
            by_part_name.erase(it);
            break;
        }
    }
    std::string category = item.nc.getCategory();
    for (std::multimap<std::string, NodeItem>::iterator it = by_category.begin(); it != by_category.end(); ++it) {
        if (it->first == category && it->second.contactable->where().toString() == contactable.where().toString()) {
            by_category.erase(it);
            break;
        }
    }
    mutex.unlock();
}
开发者ID:claudiofantacci,项目名称:yarp,代码行数:21,代码来源:Node.cpp

示例8: add

void NodeHelper::add(Contactable& contactable) {
    NodeItem item;
    item.nc.fromString(contactable.getName());
    if (name=="") name = item.nc.getNodeName();
    if (name!=item.nc.getNodeName()) {
        fprintf(stderr,"Node name mismatch, expected [%s] but got [%s]\n",
                name.c_str(), item.nc.getNodeName().c_str());
        return;
    }
    prepare(name);
    item.contactable = &contactable;
    name_cache[&contactable] = item;
    by_part_name[item.nc.getNestedName()] = item;
    by_category.insert(std::pair<ConstString,NodeItem>(item.nc.getCategory(),item));
}
开发者ID:andreadelprete,项目名称:yarp,代码行数:15,代码来源:Node.cpp

示例9: remove

void NodesHelper::remove(Contactable& contactable) {
    if (!active) return;
    Node *node = getNode(contactable.getName(),false);
    if (node) node->remove(contactable);
}
开发者ID:JoErNanO,项目名称:yarp,代码行数:5,代码来源:Nodes.cpp

示例10: update

 void update() {
     if (nc.getTypeName()=="") {
         if (!contactable) return;
         Type typ = contactable->getType();
         if (typ.isValid()) {
             nc.setTypeName(typ.getName());
         }
     }
 }
开发者ID:andreadelprete,项目名称:yarp,代码行数:9,代码来源:Node.cpp


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