Beispiel #1
0
/**************************************************************
 * Protected functions
 **************************************************************/
v_qos
u_qosNew(
    v_qos tmpl)
{
    v_qos q;
    
    q = NULL;
    if (tmpl != NULL) {
        switch (tmpl->kind) {
        case V_PARTITION_QOS:
            q = (v_qos)u_partitionQosNew((v_partitionQos)tmpl);
        break;
        case V_PARTICIPANT_QOS:
            q = (v_qos)u_participantQosNew((v_participantQos)tmpl);
        break;
        case V_TOPIC_QOS:
            q = (v_qos)u_topicQosNew((v_topicQos)tmpl);
        break;
        case V_WRITER_QOS:
            q = (v_qos)u_writerQosNew((v_writerQos)tmpl);
        break;
        case V_READER_QOS:
            q = (v_qos)u_readerQosNew((v_readerQos)tmpl);
        break;
        case V_PUBLISHER_QOS:
            q = (v_qos)u_publisherQosNew((v_publisherQos)tmpl);
        break;
        case V_SUBSCRIBER_QOS:
            q = (v_qos)u_subscriberQosNew((v_subscriberQos)tmpl);
        break;
        case V_DATAVIEW_QOS:
            q = (v_qos)u_dataViewQosNew((v_dataViewQos)tmpl);
        break;
        default:
            OS_REPORT_1(OS_ERROR, "u_qosNew", 0, "unsupported qos %d", tmpl->kind);
        break;
        }
    }

    return q;
}
Beispiel #2
0
d_storeResult
d_groupInfoInject(
    d_groupInfo _this,
    const d_store store,
    u_participant participant,
    d_group* group)
{
    d_storeResult result;
    u_group ugroup;
    u_partition upartition;
    v_partitionQos partitionQos;
    v_duration timeout;
    c_string name;

    if(_this && store && participant){
        result = d_topicInfoInject(_this->topic, store, participant);

        if(result == D_STORE_RESULT_OK){
           partitionQos = u_partitionQosNew(NULL);

           if(partitionQos) {
               d_storeReport(store, D_LEVEL_FINE, "PartitionQoS created.\n");

               upartition = u_partitionNew(participant, _this->partition,
                       partitionQos);

               if(upartition) {
                   name = d_topicInfoGetName(_this->topic);
                   d_storeReport(store, D_LEVEL_FINE,
                           "Partition %s created.\n", _this->partition);

                   timeout.seconds = 0;
                   timeout.nanoseconds = 0;
                   ugroup = u_groupNew(participant, _this->partition, name,
                           timeout);

                   if(ugroup) {
                       d_storeReport(store,
                               D_LEVEL_INFO, "Group %s.%s created.\n",
                               _this->partition, name);

                       *group = d_groupNew(_this->partition, name,
                               D_DURABILITY_PERSISTENT, _this->completeness,
                               _this->quality);

                       u_entityAction(u_entity(ugroup), setKernelGroup, *group);
                       u_entityFree(u_entity(ugroup));
                       result = D_STORE_RESULT_OK;
                   } else {
                       result = D_STORE_RESULT_OUT_OF_RESOURCES;
                       d_storeReport(store, D_LEVEL_SEVERE,
                               "Group %s.%s could NOT be created.\n",
                               _this->partition, name);
                       OS_REPORT_2(OS_ERROR, "d_groupInfoInject",
                               (os_int32)result,
                               "Group %s.%s could NOT be created.\n",
                               _this->partition, name);
                   }
                   c_free(name);
                   u_partitionFree(upartition);
               } else {
                   result = D_STORE_RESULT_OUT_OF_RESOURCES;
                   d_storeReport(store, D_LEVEL_SEVERE,
                           "Partition %s could NOT be created.\n",
                           _this->partition);
                   OS_REPORT_1(OS_ERROR, "d_groupInfoInject", (os_int32)result,
                           "Partition %s could NOT be created.\n",
                           _this->partition);
               }
               u_partitionQosFree(partitionQos);
           } else {
               result = D_STORE_RESULT_OUT_OF_RESOURCES;
               d_storeReport(store, D_LEVEL_SEVERE,
                       "PartitionQos could NOT be created.\n");
               OS_REPORT(OS_ERROR, "d_groupInfoInject", (os_int32)result,
                       "PartitionQos could NOT be created.\n");
           }
        }
    } else {
        result = D_STORE_RESULT_ILL_PARAM;
    }
    return result;
}