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


C++ c_iterInsert函数代码示例

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


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

示例1: collect_readers

static void
collect_readers(
    c_voidp object,
    c_voidp arg)
{
    struct collect_readers_arg *a = (struct collect_readers_arg *)arg;
    u_reader r = (u_reader)object;
    c_char *name;

    if (a->topic_name == NULL) {
        a->readers = c_iterInsert(a->readers, r);
    } else {
        name = NULL;
        u_dataReaderTopicName(u_dataReader(r),&name);
        if (name) {
            if (strcmp(name, a->topic_name) == 0)
            {
                /* Expect to have a u_entityKeep(r); at this point as
                 * soon as GAPI redesign is finished.
                */
                a->readers = c_iterInsert(a->readers, r);
            }
            os_free(name);
        }
    }
}
开发者ID:diorahman,项目名称:opensplice,代码行数:26,代码来源:u_subscriber.c

示例2: jni_createTopic

/**This function only works if the topic already exists.
 * In the future this must be extended.
 */
jni_topic
jni_createTopic(
    jni_participant p,
    const char* name,
    const char* typeName,
    v_topicQos qos)
{
    jni_topic topic;
    u_result result;
    struct jni_topicArg arg;
    
    topic = NULL;
    
    if((p != NULL) && (jni_lookupTopic(p, name) == NULL)){
        arg.topicName = name;
        arg.keyExpr = NULL;
        arg.result = U_RESULT_ILL_PARAM;
        result = u_entityAction(u_entity(p->uparticipant), jni_getTopicKeyExpression, &arg);       
                
        if((result == U_RESULT_OK) && (arg.result == U_RESULT_OK)){
            topic = jni_topicNew(p, name, typeName, arg.keyExpr, qos);
            
            if(arg.keyExpr != NULL){
                os_free(arg.keyExpr);
            }
            
            if(topic != NULL){
                p->topics = c_iterInsert(p->topics, topic);
            }
        }
       
    }
    return topic;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:37,代码来源:jni_participant.c

示例3: cmx_readerSnapshotNew

c_char*
cmx_readerSnapshotNew(
    const c_char* reader)
{
    u_entity e;
    c_char* result;
    struct cmx_readerSnapshotArg arg;
    os_mutex m;
    
    arg.success = FALSE;
    result = NULL;
    e = cmx_entityUserEntity(reader);
    
    if(e != NULL){    
        u_entityAction(e, cmx_readerSnapshotNewAction, &arg);
        
        if(arg.success == TRUE){
            m = cmx_getReaderSnapshotMutex();
            os_mutexLock(&m);
            readerSnapshots = c_iterInsert(readerSnapshots, arg.snapshot);
            os_mutexUnlock(&m);
            
            result = (c_char*)(os_malloc(60));
            os_sprintf(result, "<readerSnapshot><id>"PA_ADDRFMT"</id></readerSnapshot>", (c_address)(arg.snapshot));
        }
    }
    return result;
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:28,代码来源:cmx_readerSnapshot.c

示例4: v_serviceTakeNewGroups

c_iter
v_serviceTakeNewGroups(
    v_service service)
{
    c_iter result;
    v_group group;
    c_set newGroups;

    assert(service != NULL);
    assert(C_TYPECHECK(service, v_service));

    result = c_iterNew(NULL);

    v_observerLock(v_observer(service));
    newGroups = (c_set)v_observer(service)->eventData;
    if (newGroups != NULL) {
        group = v_group(c_take(newGroups));
        while (group != NULL) {
            c_iterInsert(result, group);
            group = v_group(c_take(newGroups));
        }
    }
    v_observerUnlock(v_observer(service));

    return result;
}
开发者ID:S73417H,项目名称:opensplice,代码行数:26,代码来源:v_service.c

示例5: q_countVarWalk

static void
q_countVarWalk(
    q_expr e,
    c_iter list)
{
    q_list l;
    q_expr found;

    if (e != NULL) {
        switch(e->kind) {
        case T_VAR:
            found = c_iterResolve(list,compareVar,e);
            if (found == NULL) {
                list = c_iterInsert(list,e);
            }
        break;
        case T_FNC:
            if (e->info.function->tag == Q_EXPR_CALLBACK) {
                q_countVarWalk(q_getPar(e,2),list);
            } else {
                l = e->info.function->params;
                while (l != NULL) {
                    q_countVarWalk(l->expr,list);
                    l = l->next;
                }
            }
        break;
        default:
        break;
        }
    }
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:32,代码来源:q_expr.c

示例6: u_userKeep

/* This method registers a database object to be managed by the user-layer.
 * Once a process has registered an object it can free its reference.
 * The user-layer will keep the registered object alive until it is deregistered
 * using the u_userFree method.
 * The user-layer will free all references of registered objects on process
 * termination via the installed exit handler (u_userExit).
 */
c_object
u_userKeep(
    c_object o)
{
    u_user u;
    u_domainAdmin ka;
    c_long i;

    if (o) {
        u = u__userLock();
        if (u) {
            /* the user-layer object exists so now find the domain that holds
             * the given object.
             */
            for (i=1; i <= u->domainCount; i++) {
                ka = &u->domainList[i];
                if (ka->domain) {
                    /* A valid domain admin exists, now check if the objects
                     * address is in the domains address range.
                     */
                    if (((c_address)o >= ka->lowerBound) &&
                        ((c_address)o <= ka->upperBound))
                    {
                        c_keep(o);
                        ka->keepList = c_iterInsert(ka->keepList,o);
                        i = u->domainCount + 1; /* jump out of the loop */
                    }
                }
            }
            u__userUnlock();
        }
    }
    return o;
}
开发者ID:cynron,项目名称:opensplice,代码行数:41,代码来源:u_user.c

示例7: cmx_readerSnapshotNew

c_char*
cmx_readerSnapshotNew(
    const c_char* reader)
{
    cmx_entity ce;
    c_char* result;
    struct cmx_readerSnapshotArg arg;
    os_mutex m;

    arg.success = FALSE;
    result = NULL;

    ce = cmx_entityClaim(reader);
    if(ce != NULL){
        if (u_observableAction(u_observable(ce->uentity),
                               cmx_readerSnapshotNewAction,
                               &arg) == U_RESULT_OK)
        {
            if(arg.success == TRUE){
                m = cmx_getReaderSnapshotMutex();
                os_mutexLock(&m);
                readerSnapshots = c_iterInsert(readerSnapshots, arg.snapshot);
                os_mutexUnlock(&m);

                result = (c_char*)(os_malloc(60));
                os_sprintf(result,
                           "<readerSnapshot><id>"PA_ADDRFMT"</id></readerSnapshot>",
                           (c_address)(arg.snapshot));
            }
        }
        cmx_entityRelease(ce);
    }
    return result;
}
开发者ID:osrf,项目名称:opensplice,代码行数:34,代码来源:cmx_readerSnapshot.c

示例8: c_bindAttributes

c_iter
c_bindAttributes(
    c_metaObject scope,
    c_iter declarations,
    c_type type,
    c_bool isReadOnly)
{
    c_iter attributes;
    c_declarator d;
    c_metaObject o;

    if (isReadOnly) {
        /* suppress warnings */
    }
    attributes = NULL;
    d = (c_declarator)c_iterTakeFirst(declarations);
    while (d != NULL) {
        o = c_metaDefine(scope,M_ATTRIBUTE);
        c_property(o)->type = c_declaratorType(d,type);
        c_metaFinalize(o);
        c_metaBind(scope,d->name,o);
        attributes = c_iterInsert(attributes,o);
        os_free(d);
        d = (c_declarator)c_iterTakeFirst(declarations);
    }
    c_iterFree(declarations);
    return attributes;
}
开发者ID:osrf,项目名称:opensplice,代码行数:28,代码来源:c_metafactory.c

示例9: cmx_participantFindTopicAction

void
cmx_participantFindTopicAction(
    v_public p,
    c_voidp args)
{
    cmx_walkEntityArg arg;
    c_iter topics;
    v_entity topic;
    c_bool proceed;
    c_char* xmlEntity;

    arg = cmx_walkEntityArg(args);
    topics = v_resolveTopics(v_objectKernel(p), cmx_walkParticipantArg(arg)->topicName);
    topic = v_entity(c_iterTakeFirst(topics));

    while(topic != NULL){
        proceed = cmx_entityNewFromWalk(v_public(topic), &arg->entityArg);

        if(proceed == TRUE){
            xmlEntity = arg->entityArg.result;
            arg->list = c_iterInsert(arg->list, xmlEntity);
            arg->length += strlen(xmlEntity);
        }
        c_free(topic);
        topic = v_entity(c_iterTakeFirst(topics));
    }
    c_iterFree(topics);
}
开发者ID:osrf,项目名称:opensplice,代码行数:28,代码来源:cmx_participant.c

示例10: v_serviceTakeNewGroups

c_iter
v_serviceTakeNewGroups(
    v_service service)
{
    c_iter result;
    v_group group;
    c_set newGroups;

    assert(service != NULL);
    assert(C_TYPECHECK(service, v_service));

    result = c_iterNew(NULL);

    OSPL_BLOCK_EVENTS(service);
    newGroups = service->newGroups;
    if (newGroups != NULL) {
        group = v_group(c_take(newGroups));
        while (group != NULL) {
            c_iterInsert(result, group);
            group = v_group(c_take(newGroups));
        }
    }
    OSPL_UNBLOCK_EVENTS(service);

    return result;
}
开发者ID:osrf,项目名称:opensplice,代码行数:26,代码来源:v_service.c

示例11: getKnownServices

static c_iter
getKnownServices(cf_element root)
{
   c_iter services;
   cf_element domain;
   cf_element el;
   cf_element cmd;
   cf_data data;
   c_iter children;
   cf_attribute attr;
   struct serviceInfo *si;

   assert(root);

   services = NULL;
   if (root
       && (domain = (cf_element)cf_elementChild(root, "Domain")) )
   {
      children = cf_elementGetChilds(domain);
      while ( (el = c_iterTakeFirst(children)) != NULL)
      {
         if ( strcmp(cf_nodeGetName(cf_node(el)), "Service") == 0
              && (cmd = (cf_element)cf_elementChild(el, "Command"))
              && (data = cf_data(cf_elementChild(cmd, "#text")))
              && (si = os_malloc(sizeof(struct serviceInfo))))
         {

            si->command = cf_dataValue(data).is.String;

            attr = cf_elementAttribute(el, "name");
            if (attr)
            {
               si->name = cf_attributeValue(attr).is.String;
            }
            else
            {
               si->name = si->command;
            }

            if (!si->name || !si->command)
            {
               /* detected an invalid service configuration, report and skip */
               fprintf(stderr,
                       "Warning: detected invalid 'Service'"
                       " element (name = %s; command = %s) -> skip\n",
                       (si->name?si->name:"<null>"),
                       (si->command?si->command:"<null>"));
               os_free(si);
               si = NULL;
            }
            else
            {
               services = c_iterInsert(services, si);
            }
         }
      }
      c_iterFree(children);
   }
   return services;
}
开发者ID:S73417H,项目名称:opensplice,代码行数:60,代码来源:osplconf2c.c

示例12: cmx_participantDomainsAction

void
cmx_participantDomainsAction(
    v_public p,
    c_voidp args)
{
    cmx_walkEntityArg arg;
    c_iter partitions;
    v_entity partition;
    c_bool proceed;
    c_char* xmlEntity;

    arg = cmx_walkEntityArg(args);
    partitions = v_resolvePartitions(v_objectKernel(p), "*");
    partition = v_entity(c_iterTakeFirst(partitions));

    while(partition != NULL){
        proceed = cmx_entityNewFromWalk(v_public(partition), &arg->entityArg);

        if(proceed == TRUE){
            xmlEntity = arg->entityArg.result;
            arg->list = c_iterInsert(arg->list, xmlEntity);
            arg->length += strlen(xmlEntity);
        }
        c_free(partition);
        partition = v_entity(c_iterTakeFirst(partitions));
    }
    c_iterFree(partitions);
}
开发者ID:osrf,项目名称:opensplice,代码行数:28,代码来源:cmx_participant.c

示例13: u_readerAddQuery

u_result
u_readerAddQuery(
    u_reader _this,
    u_query query)
{
    os_result r;
    u_result result = U_RESULT_PRECONDITION_NOT_MET;

    if (_this && query) {
        if(u_entityOwner(u_entity(_this))) {
            r = os_mutexLock(&_this->mutex);
            if (r == os_resultSuccess) {
                _this->queries = c_iterInsert(_this->queries, query);
                os_mutexUnlock(&_this->mutex);
                result = U_RESULT_OK;
            } else {
                OS_REPORT(OS_WARNING,
                          "u_readerAddQuery",0,
                          "Failed to lock Reader.");
                result = U_RESULT_ILL_PARAM;
            }
        } else {
            result = U_RESULT_OK;
        }
    } else {
        OS_REPORT(OS_WARNING,
                  "u_readerAddQuery",0,
                  "Illegal parameter.");
        result = U_RESULT_ILL_PARAM;
    }
    return result;
}
开发者ID:S73417H,项目名称:opensplice,代码行数:32,代码来源:u_reader.c

示例14: u_cfElementGetAttributes

c_iter
u_cfElementGetAttributes(
    u_cfElement element)
{
    u_result      r;
    v_cfElement   ke;
    v_cfAttribute attr;
    c_iter        ka;
    c_iter        attributes;
    u_participant p;


    attributes = c_iterNew(NULL);
    if (element != NULL) {
        r = u_cfNodeReadClaim(u_cfNode(element), (v_cfNode*)(&ke));
        if (r == U_RESULT_OK) {
            p = u_cfNodeParticipant(u_cfNode(element));
            ka = v_cfElementGetAttributes(ke);
            attr = c_iterTakeFirst(ka);
            while (attr != NULL) {
                c_iterInsert(attributes, u_cfAttributeNew(p, attr));
                attr = c_iterTakeFirst(ka);
            }
            c_iterFree(ka);
            u_cfNodeRelease(u_cfNode(element));
        }
    }
    return attributes;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:29,代码来源:u_cfElement.c

示例15: childsToIterator

static unsigned int
childsToIterator(
    c_object o,
    c_iter *c)
{
    *c = c_iterInsert(*c, o);
    return 1;
}
开发者ID:AmitShah,项目名称:opensplice,代码行数:8,代码来源:cf_element.c


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