• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ c_iterTakeFirst函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: s_configurationValueULong

static void
s_configurationValueULong(
    s_configuration configuration,
    u_cfElement     element,
    const char      *tag,
    void            (* const setAction)(s_configuration config, c_ulong longValue))
{
    c_iter   iter;
    u_cfData data;
    c_long   longValue;
    c_ulong  ulongValue;
    c_bool   found;

    iter = u_cfElementXPath(element, tag);
    data = u_cfData(c_iterTakeFirst(iter));
    while (data != NULL) {
        found = u_cfDataLongValue(data, &longValue);
        /* QAC EXPECT 2100; */
        if (found == TRUE) {
            if (longValue < 0) {
                longValue = -longValue;
                if (longValue < 0) {
                    longValue++;
                    longValue = -longValue;
                }
            }
            ulongValue = (c_ulong)longValue;
            setAction(configuration, ulongValue);
        }
        u_cfDataFree(data);
        data = u_cfData(c_iterTakeFirst(iter));
    }
    c_iterFree(iter);
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:34,代码来源:s_configuration.c


示例2: cfgGetArguments

static c_bool
cfgGetArguments(
    sr_serviceInfo si,
    u_cfElement info)
{
    c_iter iter;
    int    iterLength;
    c_bool r;
    u_cfData d;

    r = TRUE;
    iter = u_cfElementXPath(info, "Arguments/#text");
    iterLength = c_iterLength(iter);
    d = u_cfData(c_iterTakeFirst(iter));
    if (iterLength == 1) {
        r = u_cfDataStringValue(d, &si->args);
        u_cfDataFree(d);
    } else if (iterLength == 0) {
        OS_REPORT_1(OS_INFO, OSRPT_CNTXT_SPLICED, 
            0, "Taking default for <Arguments> parameter service %s", si->name);
        si->args = os_strdup("");
    } else {
        OS_REPORT_1(OS_ERROR, OSRPT_CNTXT_SPLICED, 
            0, "One <Arguments> parameter expected for service %s", si->name);
        si->args = os_strdup("");
        while (d != NULL) {
            u_cfDataFree(d);
            d = u_cfData(c_iterTakeFirst(iter));
        }
        r = FALSE;
    }
    c_iterFree(iter);

    return r;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:35,代码来源:sr_serviceInfo.c


示例3: 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:xrl,项目名称:opensplice,代码行数:29,代码来源:u_cfElement.c


示例4: cfgGetCommand

/**************************************************************
 * Private functions
 **************************************************************/
static c_bool
cfgGetCommand(
    sr_serviceInfo si,
    u_cfElement info)
{
    c_iter iter;
    int      iterLength;
    c_bool r;
    u_cfData d;

    r = TRUE;

    iter = u_cfElementXPath(info, "Command/#text");
    iterLength = c_iterLength(iter);
    d = u_cfData(c_iterTakeFirst(iter));
    if (iterLength == 1) {
        r = u_cfDataStringValue(d, &si->command);
        u_cfDataFree(d);
    } else {
        OS_REPORT_1(OS_ERROR, OSRPT_CNTXT_SPLICED, 
            0, "One <Command> parameter expected for service %s", si->name);
        while (d != NULL) {
            u_cfDataFree(d);
            d = u_cfData(c_iterTakeFirst(iter));
        }
        r = FALSE;
    }
    c_iterFree(iter);

    return r;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:34,代码来源:sr_serviceInfo.c


示例5: s_configurationAttrValueBoolean

static void
s_configurationAttrValueBoolean(
    s_configuration configuration,
    u_cfElement     element,
    const char      *tag,
    const char      *attr,
    void            (* const setAction)(s_configuration config, c_bool boolValue))
{
    c_iter   iter;
    u_cfElement e;
    u_cfAttribute a;
    c_bool   boolValue, found;

    iter = u_cfElementXPath(element, tag);
    e = u_cfElement(c_iterTakeFirst(iter));

    while (e != NULL) {
        a = u_cfElementAttribute(e, attr);

        if (a) {
            found = u_cfAttributeBoolValue(a, &boolValue);
            /* QAC EXPECT 2100; */
            if (found == TRUE) {
                setAction(configuration, boolValue);
            }
            u_cfAttributeFree(a);
        }
        u_cfElementFree(e);
        e = u_cfElement(c_iterTakeFirst(iter));
    }
    c_iterFree(iter);
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:32,代码来源:s_configuration.c


示例6: cmx_readerSnapshotFreeAll

void
cmx_readerSnapshotFreeAll()
{
    cmx_readerSnapshot s;
    c_char* sample;
    os_mutex m;

    m = cmx_getReaderSnapshotMutex();
    os_mutexLock(&m);
    s = cmx_readerSnapshot(c_iterTakeFirst(readerSnapshots));

    while(s != NULL){
        if(s->samples != NULL){
            sample = (c_char*)(c_iterTakeFirst(s->samples));

            while(sample != NULL){
                os_free(sample);
                sample = (c_char*)(c_iterTakeFirst(s->samples));
            }
            c_iterFree(s->samples);
        }
        os_free(s);
        s = cmx_readerSnapshot(c_iterTakeFirst(readerSnapshots));
    }
    os_mutexUnlock(&m);
}
开发者ID:osrf,项目名称:opensplice,代码行数:26,代码来源:cmx_readerSnapshot.c


示例7: v_subscriberUnSubscribe

void
v_subscriberUnSubscribe(
    v_subscriber s,
    const c_char *partitionExpr)
{
    v_partition d;
    v_dataReaderConnectionChanges arg;
    v_partitionPolicy old;

    assert(s != NULL);
    assert(C_TYPECHECK(s,v_subscriber));

    arg.addedPartitions = NULL;

    c_lockWrite(&s->lock);

    arg.removedPartitions = v_partitionAdminRemove(s->partitions, partitionExpr);
    old = s->qos->partition;
    s->qos->partition = v_partitionPolicyRemove(old, partitionExpr,
                                                c_getBase(c_object(s)));
    c_free(old);
    c_setWalk(s->readers, qosChangedAction, &arg);

    d = v_partition(c_iterTakeFirst(arg.removedPartitions));
    while (d != NULL) {
        c_free(d);
        d = v_partition(c_iterTakeFirst(arg.removedPartitions));
    }
    c_iterFree(arg.removedPartitions);

    c_lockUnlock(&s->lock);
}
开发者ID:S73417H,项目名称:opensplice,代码行数:32,代码来源:v_subscriber.c


示例8: s_configurationValueString

static void
s_configurationValueString(
    s_configuration configuration,
    u_cfElement     element,
    const char      *tag,
    void            (* const setAction)(s_configuration config, const c_char * str) )
{
    c_iter   iter;
    u_cfData data;
    c_bool   found;
    c_char *   str;

    iter = u_cfElementXPath(element, tag);
    data = u_cfData(c_iterTakeFirst(iter));

    while (data) {
        found = u_cfDataStringValue(data, &str);
        /* QAC EXPECT 2100; */
        if (found == TRUE) {
            setAction(configuration, str);
            os_free(str);
        }
        u_cfDataFree(data);
        data = u_cfData(c_iterTakeFirst(iter));
    }
    c_iterFree(iter);
}
开发者ID:xrl,项目名称:opensplice,代码行数:27,代码来源:s_configuration.c


示例9: s_configurationValueSize

static void
s_configurationValueSize(
    s_configuration configuration,
    u_cfElement     element,
    const char      *tag,
    void            (* const setAction)(s_configuration config, c_ulong ulongValue))
{
    c_iter   iter;
    u_cfData data;
    c_ulong  ulongValue;
    c_bool   found;

    iter = u_cfElementXPath(element, tag);
    data = u_cfData(c_iterTakeFirst(iter));
    while (data != NULL) {
        found = u_cfDataSizeValue(data, &ulongValue);
        /* QAC EXPECT 2100; */
        if (found == TRUE) {
            setAction(configuration, ulongValue);
        }
        u_cfDataFree(data);
        data = u_cfData(c_iterTakeFirst(iter));
    }
    c_iterFree(iter);
}
开发者ID:xrl,项目名称:opensplice,代码行数:25,代码来源:s_configuration.c


示例10: s_configurationValueFloat

static void
s_configurationValueFloat(
    s_configuration configuration,
    u_cfElement     element,
    const c_char    *tag,
    void            (* const setAction)(s_configuration config, c_float floatValue))
{
    c_iter   iter;
    u_cfData data;
    c_bool   found;
    c_float  floatValue;

    iter = u_cfElementXPath(element, tag);
    data = u_cfData(c_iterTakeFirst(iter));

    while (data != NULL) {
        found = u_cfDataFloatValue(data, &floatValue);

        if (found == TRUE) {
            setAction(configuration, floatValue);
        }
        u_cfDataFree(data);
        data = u_cfData(c_iterTakeFirst(iter));
    }
    c_iterFree(iter);
}
开发者ID:xrl,项目名称:opensplice,代码行数:26,代码来源:s_configuration.c


示例11: jni_lookupTopic

jni_topic
jni_lookupTopic(
    jni_participant p,
    const char* name)
{
    c_iter topics;
    jni_topic topic, temp;
    int found;
    
    topic = NULL;
    
    if((name != NULL) && (p != NULL)){
        topics = c_iterCopy(p->topics);
        found = 0;
        temp = jni_topic(c_iterTakeFirst(topics));
        
        while( (temp != NULL) && (!found)){
            
            if(strcmp(jni_topicDescription(temp)->name, name) == 0){
                topic = temp;
                found = 1;
            }
            temp = jni_topic(c_iterTakeFirst(topics));
        }
        c_iterFree(topics);
    }
    return topic;
}
开发者ID:S73417H,项目名称:opensplice,代码行数:28,代码来源:jni_participant.c


示例12: cmx_readerSnapshotFree

void
cmx_readerSnapshotFree(
    c_char* snapshot)
{
    cmx_readerSnapshot s;
    c_char* sample;
    os_mutex m;

    s = cmx_readerSnapshotLookup(snapshot);

    if(s != NULL){
        m = cmx_getReaderSnapshotMutex();
        os_mutexLock(&m);
        c_iterTake(readerSnapshots, s);
        os_mutexUnlock(&m);

        if(s->samples != NULL){
            sample = (c_char*)(c_iterTakeFirst(s->samples));

            while(sample != NULL){
                os_free(sample);
                sample = (c_char*)(c_iterTakeFirst(s->samples));
            }
            c_iterFree(s->samples);
        }
        os_free(s);
        os_free(snapshot);
    }
}
开发者ID:osrf,项目名称:opensplice,代码行数:29,代码来源:cmx_readerSnapshot.c


示例13: u_subscriberDeleteContainedEntities

u_result
u_subscriberDeleteContainedEntities (
    u_subscriber _this)
{
    u_result result;
    u_reader reader;
    c_iter list;

    if (_this != NULL) {
        result = u_entityLock(u_entity(_this));
        if (result == U_RESULT_OK) {
            list = _this->readers;
            _this->readers = NULL;
            /* Unlock here because following code will take this lock. */
            u_entityUnlock(u_entity(_this));
            reader = c_iterTakeFirst(list);
            while (reader) {
                switch (u_entityKind(u_entity(reader))) {
                case U_READER:
                    result = u_dataReaderDeleteContainedEntities(u_dataReader(reader));
                    result = u_dataReaderFree(u_dataReader(reader));
                break;
                case U_GROUPQUEUE:
                    result = u_groupQueueFree(u_groupQueue(reader));
                break;
                case U_DATAVIEW:
                    result = u_dataViewFree(u_dataView(reader));
                break;
                case U_NETWORKREADER:
                    result = u_networkReaderFree(u_networkReader(reader));
                break;
                default:
                    OS_REPORT_2(OS_WARNING,
                                "u_subscriberDeleteContainedEntities",0,
                                "invalid object type: "
                                "For Subscriber = 0x%x, found Reader type = %s.",
                                _this, u_kindImage(u_entityKind(u_entity(reader))));
                    assert(0);
                break;
                }
                u_entityDereference(u_entity(_this));
                reader = c_iterTakeFirst(list);
            }
            c_iterFree(list);
        } else {
            OS_REPORT_2(OS_WARNING,
                        "u_subscriberDeleteContainedEntities",0,
                        "Operation u_entityLock failed: "
                        "Subscriber = 0x%x, result = %s.",
                        _this, u_resultImage(result));
        }
    } else {
        OS_REPORT(OS_WARNING,
                  "u_subscriberDeleteContainedEntities",0,
                  "Invalid Subscriber <NULL>.");
        result = U_RESULT_ILL_PARAM;
    }
    return result;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:59,代码来源:u_subscriber.c


示例14: cfgGetSchedule

static c_bool
cfgGetSchedule(
    sr_serviceInfo si,
    u_cfElement info)
{
    c_iter iter;
    int      iterLength;
    c_bool r;
    u_cfData d;
    c_char *str;

    r = TRUE;
    iter = u_cfElementXPath(info, "Scheduling/Class/#text");
    iterLength = c_iterLength(iter);
    d = u_cfData(c_iterTakeFirst(iter));
    if (iterLength == 1) {
        r = u_cfDataStringValue(d, &str);

        if (r == TRUE) {
            if (strncmp(str, SCHED_RT, strlen(SCHED_RT)) == 0) {
                si->procAttr.schedClass = OS_SCHED_REALTIME;
            } else {
                if (strncmp(str, SCHED_TS, strlen(SCHED_TS)) == 0) {
                    si->procAttr.schedClass = OS_SCHED_TIMESHARE;
                } else {
                    if (strcmp(str, SCHED_DEF)==0) {
                        si->procAttr.schedClass = OS_SCHED_DEFAULT;
                    } else {
                        si->procAttr.schedClass = OS_SCHED_DEFAULT;
                        OS_REPORT_1(OS_WARNING, OSRPT_CNTXT_SPLICED, 
                             0, "Incorrect <Scheduling/Class> parameter for service %s -> default",
                             si->name);
                         r = TRUE;
                    }
                }
            }
            os_free(str);
        }
        u_cfDataFree(d);
    } else {
        si->procAttr.schedClass = OS_SCHED_DEFAULT;
        if (iterLength == 0) {
            OS_REPORT_1(OS_INFO, OSRPT_CNTXT_SPLICED, 
                0, "Taking default for <Scheduling/Class> parameter service %s", si->name);
        } else {
            OS_REPORT_1(OS_ERROR, OSRPT_CNTXT_SPLICED, 
                0, "One <Scheduling/Class> parameter expected for service %s", si->name);
            r = FALSE;
        }
        while (d != NULL) {
            u_cfDataFree(d);
            d = u_cfData(c_iterTakeFirst(iter));
        }
    }
    c_iterFree(iter);

    return r;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:58,代码来源:sr_serviceInfo.c


示例15: jni_participantFree

jni_result
jni_participantFree(
    jni_participant p)
{
    jni_result r;
    jni_partition partition;
    
    r = JNI_RESULT_OK;
    
    if(p != NULL){
        if((p->publishers != NULL) && (c_iterLength(p->publishers) != 0)){
            r = JNI_RESULT_PRECONDITION_NOT_MET;
        }
        else if((p->subscribers != NULL) && (c_iterLength(p->subscribers) != 0)){
            r = JNI_RESULT_PRECONDITION_NOT_MET;
        }
        else if((p->topics != NULL) && (c_iterLength(p->topics) != 0)){
            r = JNI_RESULT_PRECONDITION_NOT_MET;
        }
        else if((p->partitions != NULL) && (c_iterLength(p->partitions) != 0)){
            partition = jni_partition(c_iterTakeFirst(p->partitions));
            
            while((partition != NULL) && (r == JNI_RESULT_OK)){
                r = jni_partitionFree(partition);
                partition = jni_partition(c_iterTakeFirst(p->partitions));
            }
        }
        else{
          /*DO NOTHING.*/
        }
        
        if(r == JNI_RESULT_OK){
            if(p->publishers != NULL){
                c_iterFree(p->publishers);
            }
            if(p->subscribers != NULL){
                c_iterFree(p->subscribers);
            }
            if(p->topics != NULL){
                c_iterFree(p->topics);
            }
            if(p->partitions != NULL){
                c_iterFree(p->partitions);
            }
            if(p->uparticipant != NULL){
                r = jni_convertResult(u_participantFree(p->uparticipant));
            }
            else{
                r = JNI_RESULT_OK;
            }
            os_free(p);
        }        
    }
    else{
        r = JNI_RESULT_BAD_PARAMETER;
    }
    return r;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:58,代码来源:jni_participant.c


示例16: d_waitsetDeinit

void
d_waitsetDeinit(
    d_object object)
{
    d_waitset waitset;
    d_waitsetEntity we;
    d_waitsetHelper helper;

    assert(d_objectIsValid(object, D_WAITSET) == TRUE);

    if(object){
        waitset = d_waitset(object);
        waitset->terminate = TRUE;

        if(waitset->runToCompletion == TRUE){
            if(os_threadIdToInteger(waitset->thread)) {
                u_waitsetNotify(waitset->uwaitset, NULL);
                os_threadWaitExit(waitset->thread, NULL);
            }
        } else {
            if(waitset->threads){
                helper = d_waitsetHelper(c_iterTakeFirst(waitset->threads));

                while(helper){
                    helper->terminate = TRUE;
                    u_waitsetNotify(helper->userWaitset, NULL);
                    os_threadWaitExit(helper->tid, NULL);
                    u_waitsetDetach(helper->userWaitset, u_entity(helper->entity->dispatcher));
                    u_waitsetFree(helper->userWaitset);
                    os_free(helper);
                    helper = d_waitsetHelper(c_iterTakeFirst(waitset->threads));
                }
                c_iterFree(waitset->threads);
                waitset->threads = NULL;
            }
        }
        d_lockLock(d_lock(waitset));

        if(waitset->entities) {
            we = d_waitsetEntity(c_iterTakeFirst(waitset->entities));

            while(we) {
                if(waitset->runToCompletion == TRUE){
                    u_waitsetDetach(waitset->uwaitset, u_entity(we->dispatcher));
                }
                d_waitsetEntityFree(we);
                we = d_waitsetEntity(c_iterTakeFirst(waitset->entities));
            }
            c_iterFree(waitset->entities);
        }
        if(waitset->runToCompletion == TRUE){
            if(waitset->uwaitset) {
                u_waitsetFree(waitset->uwaitset);
            }
        }
        d_lockUnlock(d_lock(waitset));
    }
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:58,代码来源:d_waitset.c


示例17: cms_clientFree

void
cms_clientFree(
    cms_client client)
{
    struct soap* soap;
    cms_soapThread soapThread;

    cms_thread(client)->terminate = TRUE;

    os_mutexLock(&client->conditionMutex);
    os_condSignal(&client->condition);
    os_mutexUnlock(&client->conditionMutex);

    cms_threadDeinit(cms_thread(client));

    if(client->soapEnvs){
        os_mutexLock(&client->soapMutex);
        soap = (struct soap*)(c_iterTakeFirst(client->soapEnvs));

        while(soap){
            soap->error = soap_receiver_fault(soap, "Service is terminating.", NULL);
            soap_send_fault(soap);
            soap_destroy(soap);
            soap_end(soap);
            soap_done(soap);
            os_free(soap);
            soap = (struct soap*)(c_iterTakeFirst(client->soapEnvs));
        }
        c_iterFree(client->soapEnvs);
        client->soapEnvs = NULL;
        os_mutexUnlock(&client->soapMutex);
    }

    if(client->threads){
        soapThread = cms_soapThread(c_iterTakeFirst(client->threads));

        while(soapThread){
            cms_soapThreadFree(soapThread);
            (void)u_observableAction(u_observable(client->service->uservice), cms_clientStatisticsThreadRemove, client->service);
            soapThread = cms_soapThread(c_iterTakeFirst(client->threads));
        }
        c_iterFree(client->threads);
        client->threads = NULL;
    }
    os_mutexDestroy(&client->soapMutex);
    os_mutexDestroy(&client->threadMutex);
    os_mutexDestroy(&client->conditionMutex);
    os_condDestroy(&client->condition);
    client->initCount = 0;

    if(client->service->configuration->verbosity >= 5){
        OS_REPORT(OS_INFO, CMS_CONTEXT, 0,
                        "Client thread stopped for IP: %d.%d.%d.%d",
                        (int)(client->ip>>24)&0xFF,
                        (int)(client->ip>>16)&0xFF,
                        (int)(client->ip>>8)&0xFF,
                        (int)(client->ip&0xFF));
    }
开发者ID:osrf,项目名称:opensplice,代码行数:58,代码来源:cms_client.c


示例18: d_waitsetEventHandler

static void*
d_waitsetEventHandler(
    void* userData)
{
    d_subscriber subscriber;
    d_durability durability;
    d_admin admin;
    c_iter events;
    d_waitsetEntity we;
    c_time time;
    d_waitsetHelper helper;
    u_waitset userWaitset;
    u_waitsetEvent event;
    u_result ur;

    helper           = d_waitsetHelper(userData);
    we               = helper->entity;
    subscriber       = d_waitsetGetSubscriber(helper->waitset);
    admin            = d_subscriberGetAdmin(subscriber);
    durability       = d_adminGetDurability(admin);
    time.seconds     = 1;
    time.nanoseconds = 0;
    userWaitset      = helper->userWaitset;
    ur               = U_RESULT_OK;

    while((helper->terminate == FALSE) && (ur == U_RESULT_OK)) {
        events = NULL;
        if(helper->waitset->timedWait == TRUE){
            ur = u_waitsetTimedWaitEvents(userWaitset, time,&events);
        } else {
            ur = u_waitsetWaitEvents(userWaitset,&events);
        }
        if(events  && (ur == U_RESULT_OK)){/* events may be null if waitset was deleted*/
            event = u_waitsetEvent(c_iterTakeFirst(events));

            while(event){
                /* Only dispatch event when durability is not terminating */
                if (d_durabilityGetState(durability) != D_STATE_TERMINATING){
                    we->action(we->dispatcher, event, we->usrData);
                }
                u_waitsetEventFree(event);
                event = u_waitsetEvent(c_iterTakeFirst(events));
            }
            c_iterFree(events);
        }
    }
    if(ur != U_RESULT_OK){
        d_printTimedEvent(durability, D_LEVEL_SEVERE,
            we->name,
            "Waitset no longer available (result: %d). Fatal error, terminating now...\n",
            ur);
        OS_REPORT_1(OS_ERROR, D_CONTEXT_DURABILITY, 0,
            "Waitset no longer available (result: %d). Fatal error, terminating now...\n",
            ur);
        d_durabilityTerminate(durability);
    }
    return NULL;
}
开发者ID:xrl,项目名称:opensplice_dds,代码行数:58,代码来源:d_waitset.c


示例19: v_partitionPolicyAdd

v_partitionPolicyI
v_partitionPolicyAdd(
    v_partitionPolicyI p,
    const c_char* expr,
    c_base base)
{
    c_iter list;
    c_char *str, *partition;
    os_size_t size;
    c_bool isIn;
    v_partitionPolicyI newPolicy;

    newPolicy.v = NULL;

    assert(expr);

    if(p.v){
        isIn = FALSE;

        list = v_partitionPolicySplit(p);
        partition = c_iterTakeFirst(list);

        while(partition){
            if(strcmp(partition, expr) == 0){
               isIn = TRUE;
           }
           os_free(partition);
           partition = c_iterTakeFirst(list);
        }
        c_iterFree(list);

        if(isIn){
            /* It's already in there, so return the current value */
            newPolicy.v = c_stringNew(base, p.v);
        } else {
            /* It's not in there, so add it to the existing one */
            size = strlen(p.v) + 1 + strlen(expr) + 1;
            str = os_malloc(size);

            if (str) {
                os_strncpy(str, p.v, size);
                str = os_strcat(str, ",");
                str = os_strcat(str, expr);
                newPolicy.v = c_stringNew(base, str);
                os_free(str);
            } else {
                /* failed to allocate, so report error and return NULL */
                OS_REPORT(OS_FATAL, "v_partitionPolicyAdd", V_RESULT_OUT_OF_MEMORY, "Failed to allocate partitionPolicy");
            }
        }
    } else {
        /* No policy exists yet, so make the expr the new policy */
        newPolicy.v = c_stringNew(base, expr);
    }
    return newPolicy;
}
开发者ID:osrf,项目名称:opensplice,代码行数:56,代码来源:v_policy.c


示例20: gapi_dataReaderView_delete_contained_entities

/*     ReturnCode_t
 *     delete_contained_entities();
 */
gapi_returnCode_t
gapi_dataReaderView_delete_contained_entities (
    gapi_dataReaderView _this)
{
    gapi_returnCode_t result = GAPI_RETCODE_OK;
    _DataReaderView datareaderview;
    gapi_context context;
    _Condition condition = NULL;
    c_iter entities;
    u_entity e;
    u_result ur;

    GAPI_CONTEXT_SET(context, _this, GAPI_METHOD_DELETE_CONTAINED_ENTITIES);

    if ( _this != NULL ) {
        datareaderview = gapi_dataReaderViewClaim(_this, &result);
        if ( datareaderview != NULL ) {
            if (!gapi_loanRegistry_is_empty(datareaderview->loanRegistry)) {
                result = GAPI_RETCODE_PRECONDITION_NOT_MET;
            } else {
                entities = u_readerLookupQueries(U_READER_GET(datareaderview));
                e = c_iterTakeFirst(entities);
                while (e) {
                    condition = u_entityGetUserData(e);
                    if (condition) {
                        _ObjectReadClaimNotBusy(_Object(condition));
                        _ConditionFree(condition);
                    } else {
                        if (e == u_entity(datareaderview->uQuery)) {
                            datareaderview->uQuery = NULL;
                            ur = u_queryFree(u_query(e));
                            if (ur == U_RESULT_OK) {
                                result = GAPI_RETCODE_OK;
                            } else {
                                result = GAPI_RETCODE_BAD_PARAMETER;
                            }
                        } else {
                            assert(condition);
                            result = GAPI_RETCODE_BAD_PARAMETER;
                        }
                    }
                    e = c_iterTakeFirst(entities);
                }
                c_iterFree(entities);
            }
            _EntityRelease(datareaderview);
        } else {
            result = GAPI_RETCODE_ALREADY_DELETED;
        }
    } else {
        result = GAPI_RETCODE_BAD_PARAMETER;
    }

    return result;
}
开发者ID:diorahman,项目名称:opensplice,代码行数:58,代码来源:gapi_dataReaderView.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ c_keep函数代码示例发布时间:2022-05-30
下一篇:
C++ c_iterInsert函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap