c_char* cmx_publisherNew( const c_char* participant, const c_char* name, const c_char* qos) { u_participant par; u_publisher pub; c_char* result; cmx_entityArg arg; u_result ur; v_publisherQos pqos; cmx_entityKernelArg kernelArg; result = NULL; par = u_participant(cmx_entityUserEntity(participant)); if(par != NULL){ kernelArg = cmx_entityKernelArg(os_malloc(C_SIZEOF(cmx_entityKernelArg))); u_entityAction(u_entity(par), cmx_entityKernelAction, (c_voidp)kernelArg); if(qos != NULL){ pqos = v_publisherQos(cmx_qosKernelQosFromKind(qos, K_PUBLISHER, c_getBase(c_object(kernelArg->kernel)))); if(pqos == NULL){ pqos = v_publisherQosNew(kernelArg->kernel, NULL); } } else { pqos = v_publisherQosNew(kernelArg->kernel, NULL); } pub = u_publisherNew(par, name, pqos, TRUE); os_free(kernelArg); c_free(pqos); if(pub != NULL){ cmx_registerEntity(u_entity(pub)); arg = cmx_entityArg(os_malloc(C_SIZEOF(cmx_entityArg))); arg->entity = u_entity(pub); arg->create = FALSE; arg->participant = NULL; arg->result = NULL; ur = u_entityAction(u_entity(pub), cmx_entityNewFromAction, (c_voidp)(arg)); if(ur == U_RESULT_OK){ result = arg->result; os_free(arg); } } } return result; }
void v_qosFree( v_qos qos) { if(qos != NULL){ switch(qos->kind){ case V_PARTICIPANT_QOS: v_participantQosFree(v_participantQos(qos)); break; case V_TOPIC_QOS: v_topicQosFree(v_topicQos(qos)); break; case V_WRITER_QOS: v_writerQosFree(v_writerQos(qos)); break; case V_READER_QOS: v_readerQosFree(v_readerQos(qos)); break; case V_PUBLISHER_QOS: v_publisherQosFree(v_publisherQos(qos)); break; case V_SUBSCRIBER_QOS: v_subscriberQosFree(v_subscriberQos(qos)); break; case V_PARTITION_QOS: case V_INDEX_QOS: case V_WRITERHISTORY_QOS: case V_GROUPHISTORY_QOS: case V_VIEW_QOS: case V_DATAVIEW_QOS: case V_KERNEL_QOS: case V_COUNT_QOS: break; default: break; } } }