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


C++ SpaceList::size方法代码示例

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


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

示例1: activate

 NameSpace *getOne() {
     activate();
     if (spaces.size()==0) {
         return NULL;
     }
     return spaces[0];
 }
开发者ID:JoErNanO,项目名称:yarp,代码行数:7,代码来源:MultiNameSpace.cpp

示例2: getNameServerContact

 Contact getNameServerContact() {
     activate();
     if (spaces.size()>0) {
         return spaces[0]->getNameServerContact();
     }
     return Contact();
 }
开发者ID:JoErNanO,项目名称:yarp,代码行数:7,代码来源:MultiNameSpace.cpp

示例3: scan

 void scan() {
     // reset flags
     _localOnly = true;
     _usesCentralServer = false;
     _serverAllocatesPortNumbers = true;
     // now scan each namespace
     for (int i=0; i<(int)spaces.size(); i++) {
         NameSpace *ns = spaces[i];
         if (!ns) continue;
         // if any namespace is nonlocal, combination is nonlocal
         if (!ns->localOnly()) _localOnly = false;
         // if any namespace uses a central server, combination also does
         if (ns->usesCentralServer()) _usesCentralServer = true;
         // if any namespace doesn't allocate port numbers, combination
         // cannot be relied on to do so either
         if (!ns->serverAllocatesPortNumbers()) {
             _serverAllocatesPortNumbers = false;
         }
         // if any namespace lacks informed connections, combination
         // cannot be relied on to be informed either
         if (!ns->connectionHasNameOfEndpoints()) {
             _connectionHasNameOfEndpoints = false;
         }
     }
 }
开发者ID:BRKMYR,项目名称:yarp,代码行数:25,代码来源:MultiNameSpace.cpp

示例4: getNameServerContact

 Contact getNameServerContact() {
     activate(); // make sure we've loaded namespace(s)
     if (spaces.size()>0) {
         // return first name server
         return spaces[0]->getNameServerContact();
     }
     return Contact();
 }
开发者ID:BRKMYR,项目名称:yarp,代码行数:8,代码来源:MultiNameSpace.cpp

示例5: unregisterContact

Contact MultiNameSpace::unregisterContact(const Contact& contact) {
    SpaceList lst = HELPER(this).getAll();
    Contact result;
    for (int i=0; i<(int)lst.size(); i++) {
        Contact iresult = lst[i]->unregisterContact(contact);
        if (i==0) result = iresult;
    }
    return result;
}
开发者ID:JoErNanO,项目名称:yarp,代码行数:9,代码来源:MultiNameSpace.cpp

示例6: unregisterName

Contact MultiNameSpace::unregisterName(const ConstString& name) {
    SpaceList lst = HELPER(this).getAll();
    Contact result;
    for (int i=0; i<(int)lst.size(); i++) {
        // we unregister in *all* namespaces
        Contact iresult = lst[i]->unregisterName(name);
        if (i==0) result = iresult;
    }
    return result;
}
开发者ID:BRKMYR,项目名称:yarp,代码行数:10,代码来源:MultiNameSpace.cpp

示例7: registerContact

Contact MultiNameSpace::registerContact(const Contact& contact) {
    SpaceList lst = HELPER(this).getAll();
    Contact result;
    for (int i=0; i<(int)lst.size(); i++) {
        // we register in *all* namespaces (and query in *any*)
        Contact iresult = lst[i]->registerContact(contact);
        if (i==0) result = iresult;
    }
    return result;
}
开发者ID:BRKMYR,项目名称:yarp,代码行数:10,代码来源:MultiNameSpace.cpp

示例8: activate

 bool activate(bool force = false) {
     if (force) {
         // wipe if forced
         clear();
     }
     // return if namespaces already present
     if (spaces.size()!=0) return true;
     // read namespace list from config file
     NameConfig conf;
     if (!conf.fromFile()) {
         double now = Time::now();
         static double last_shown = now-10;
         if (now-last_shown>3) {
             last_shown = now;
             fprintf(stderr,"warning: YARP name server(s) not configured, ports will be anonymous\n");
             fprintf(stderr,"warning: check your namespace and settings with 'yarp detect'\n");
         }
         return false;
     }
     Bottle ns = conf.getNamespaces();
     // loop through namespaces
     for (int i=0; i<ns.size(); i++) {
         ConstString n = ns.get(i).asString();
         NameConfig conf2;
         // read configuration of individual namespace
         if (!conf2.fromFile(n.c_str())) {
             fprintf(stderr, "Could not find namespace %s\n",
                     n.c_str());
             continue;
         }
         String mode = conf2.getMode();
         Contact address = conf2.getAddress().addName(n);
         if (mode=="yarp"||mode=="//") {
             // add a yarp namespace
             NameSpace *ns = new YarpNameSpace(address);
             spaces.push_back(ns);
         } else if (mode=="ros") {
             // add a ros namespace
             NameSpace *ns = new RosNameSpace(address);
             spaces.push_back(ns);
         } else if (mode=="local") {
             NameSpace *ns = new YarpDummyNameSpace;
             spaces.push_back(ns);
         } else {
             // shrug
             YARP_SPRINTF1(Logger::get(),error,
                           "cannot deal with namespace of type %s",
                           mode.c_str());
             return false;
         }
     }
     // cache flags
     scan();
     return true;
 }
开发者ID:BRKMYR,项目名称:yarp,代码行数:55,代码来源:MultiNameSpace.cpp

示例9: queryName

 Contact queryName(const ConstString& name) {
     activate();
     for (int i=0; i<(int)spaces.size(); i++) {
         NameSpace *ns = spaces[i];
         if (!ns) continue;
         if (ns->getNameServerName()==name) {
             return ns->getNameServerContact();
         }
         Contact result = ns->queryName(name);
         if (result.isValid()) return result;
     }
     return Contact();
 }
开发者ID:JoErNanO,项目名称:yarp,代码行数:13,代码来源:MultiNameSpace.cpp

示例10: clear

 void clear() {
     for (int i=0; i<(int)spaces.size(); i++) {
         NameSpace *ns = spaces[i];
         if (ns) {
             delete ns;
             ns = NULL;
         }
     }
     spaces.clear();
     _localOnly = true;
     _usesCentralServer = false;
     _serverAllocatesPortNumbers = false;
     _connectionHasNameOfEndpoints = true;
 }
开发者ID:JoErNanO,项目名称:yarp,代码行数:14,代码来源:MultiNameSpace.cpp

示例11: queryName

 Contact queryName(const char *name) {
     activate();
     for (int i=0; i<(int)spaces.size(); i++) {
         NameSpace *ns = spaces[i];
         if (!ns) continue;
         if (ns->getNameServerName()==name) {
             return ns->getNameServerContact();
         }
         //printf("Query from %s\n", spaces[i]->getNameServerName().c_str());
         Contact result = ns->queryName(name);
         //printf("Got %s\n", result.toString().c_str());
         if (result.isValid()) return result;
     }
     return Contact();
 }
开发者ID:paulfitz,项目名称:yarp,代码行数:15,代码来源:MultiNameSpace.cpp

示例12: registerName

Contact MultiNameSpace::registerName(const ConstString& name) {
    SpaceList lst = HELPER(this).getAll();
    Contact result;
    for (int i=0; i<(int)lst.size(); i++) {
        Contact iresult;
        if (result.getPort()<=0) {
            iresult = lst[i]->registerName(name);
        } else {
            iresult = lst[i]->registerContact(result);
        }
        if (i==0 || result.getPort()<=0) {
            result = iresult;
        }
    }
    return result;
}
开发者ID:JoErNanO,项目名称:yarp,代码行数:16,代码来源:MultiNameSpace.cpp

示例13: activate

 bool activate(bool force = false) {
     if (force) {
         clear();
     }
     if (spaces.size()!=0) return true;
     NameConfig conf;
     if (!conf.fromFile()) {
         return false;
     }
     Bottle ns = conf.getNamespaces();
     for (int i=0; i<ns.size(); i++) {
         ConstString n = ns.get(i).asString();
         //printf("NAMESPACE %s\n", n.c_str());
         NameConfig conf2;
         if (!conf2.fromFile(n.c_str())) {
             fprintf(stderr, "Could not find namespace %s\n",
                     n.c_str());
             continue;
         }
         String mode = conf2.getMode();
         Contact address = conf2.getAddress().toContact().addName(n);
         //printf("ADDRESS %s\n", address.toString().c_str());
         if (mode=="yarp"||mode=="//") {
             NameSpace *ns = new YarpNameSpace(address);
             spaces.push_back(ns);
         } else if (mode=="ros") {
             NameSpace *ns = new RosNameSpace(address);
             spaces.push_back(ns);
         } else {
             YARP_SPRINTF1(Logger::get(),error,
                           "cannot deal with namespace of type %s",
                           mode.c_str());
             return false;
         }
     }
     scan();
     return true;
 }
开发者ID:paulfitz,项目名称:yarp,代码行数:38,代码来源:MultiNameSpace.cpp


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