gapi_returnCode_t gapi_dataReader_wait_for_historical_data ( gapi_dataReader _this, const gapi_duration_t *max_wait) { gapi_returnCode_t result = GAPI_RETCODE_OK; _DataReader datareader; c_time c_time_max_wait; u_result uResult; datareader = gapi_dataReaderClaim(_this, &result); if (datareader) { if ( !max_wait || !gapi_validDuration(max_wait)) { result = GAPI_RETCODE_BAD_PARAMETER; } else if (!_EntityEnabled(datareader)) { result = GAPI_RETCODE_NOT_ENABLED; } else { kernelCopyInDuration(max_wait, &c_time_max_wait); uResult = u_dataReaderWaitForHistoricalData( U_DATAREADER_GET(datareader), c_time_max_wait); result = kernelResultToApiResult(uResult); } _EntityRelease(datareader); } return result; }
gapi_dataReaderView gapi_dataReader_create_view ( gapi_dataReader _this, const gapi_dataReaderViewQos *qos) { _DataReader datareader = NULL; _DataReaderView view = NULL; gapi_dataReaderViewQos *viewQos; gapi_context context; GAPI_CONTEXT_SET(context, _this, GAPI_METHOD_CREATE_VIEW); datareader = gapi_dataReaderClaim(_this, NULL); if ( datareader && _EntityEnabled(datareader)) { if ( qos == GAPI_DATAVIEW_QOS_DEFAULT ) { viewQos = (gapi_dataReaderViewQos *)&datareader->_defDataReaderViewQos; } else { viewQos = (gapi_dataReaderViewQos *)qos; } if (gapi_dataReaderViewQosIsConsistent(viewQos,&context) == GAPI_RETCODE_OK) { view = _DataReaderViewNew (viewQos, datareader); if ( view ) { _ENTITY_REGISTER_OBJECT(_Entity(datareader), (_Object)view); } } } _EntityRelease(datareader); return (gapi_dataReaderView)_EntityRelease(view); }
/* ReturnCode_t * get_matched_subscription_data( * inout SubscriptionBuiltinTopicData subscription_data, * in InstanceHandle_t subscription_handle); */ gapi_returnCode_t gapi_dataWriter_get_matched_subscription_data ( gapi_dataWriter _this, gapi_subscriptionBuiltinTopicData *subscription_data, const gapi_instanceHandle_t subscription_handle) { gapi_returnCode_t result; _DataWriter datawriter; datawriter = gapi_dataWriterClaim(_this, &result); if (datawriter != NULL) { if (_EntityEnabled(datawriter)) { result = _DataWriter_get_matched_subscription_data ( datawriter, subscription_data, subscription_handle); } else { result=GAPI_RETCODE_NOT_ENABLED; } } _EntityRelease(datawriter); return result; }
gapi_returnCode_t gapi_publisher_set_qos ( gapi_publisher _this, const gapi_publisherQos *qos) { gapi_returnCode_t result = GAPI_RETCODE_OK; u_result uResult; _Publisher publisher; v_publisherQos publisherQos; gapi_context context; gapi_publisherQos *existing_qos; GAPI_CONTEXT_SET(context, _this, GAPI_METHOD_SET_QOS); publisher = gapi_publisherClaim(_this, &result); if ( publisher && qos ) { result = gapi_publisherQosIsConsistent(qos, &context); } else { result = GAPI_RETCODE_BAD_PARAMETER; } if ((result == GAPI_RETCODE_OK ) && (_EntityEnabled(publisher))) { existing_qos = gapi_publisherQos__alloc(); uResult = _PublisherGetQos(publisher, existing_qos); result = kernelResultToApiResult(uResult); if(result == GAPI_RETCODE_OK) { result = gapi_publisherQosCheckMutability( qos, existing_qos, &context); } gapi_free(existing_qos); } if ( result == GAPI_RETCODE_OK ) { publisherQos = u_publisherQosNew(NULL); if (publisherQos) { if ( copyPublisherQosIn(qos, publisherQos) ) { uResult = u_entitySetQoS(_EntityUEntity(publisher), (v_qos)(publisherQos) ); result = kernelResultToApiResult(uResult); u_publisherQosFree(publisherQos); } else { result = GAPI_RETCODE_OUT_OF_RESOURCES; } } else { result = GAPI_RETCODE_OUT_OF_RESOURCES; } } _EntityRelease(publisher); return result; }
gapi_returnCode_t gapi_dataReader_set_qos ( gapi_dataReader _this, const gapi_dataReaderQos *qos) { gapi_returnCode_t result = GAPI_RETCODE_OK; u_result uResult; _DataReader dataReader; v_readerQos dataReaderQos; gapi_context context; GAPI_CONTEXT_SET(context, _this, GAPI_METHOD_SET_QOS); dataReader = gapi_dataReaderClaim(_this, &result); if ( dataReader ) { if ( qos ) { result = gapi_dataReaderQosIsConsistent(qos, &context); } else { result = GAPI_RETCODE_BAD_PARAMETER; } } if (( result == GAPI_RETCODE_OK ) && (_EntityEnabled(dataReader))){ gapi_dataReaderQos * existing_qos = gapi_dataReaderQos__alloc(); result = gapi_dataReaderQosCheckMutability(qos, _DataReaderGetQos(dataReader, existing_qos), &context); gapi_free(existing_qos); } if ( result == GAPI_RETCODE_OK ) { dataReaderQos = u_readerQosNew(NULL); if (dataReaderQos) { if ( gapi_kernelReaderQosCopyIn(qos, dataReaderQos) ) { uResult = u_entitySetQoS(_EntityUEntity(dataReader), (v_qos)(dataReaderQos) ); result = kernelResultToApiResult(uResult); u_readerQosFree(dataReaderQos); } else { result = GAPI_RETCODE_OUT_OF_RESOURCES; } } else { result = GAPI_RETCODE_OUT_OF_RESOURCES; } } _EntityRelease(dataReader); return result; }
/* ReadCondition * create_readcondition( * in SampleStateMask sample_states, * in ViewStateMask view_states, * in InstanceStateMask instance_states); */ gapi_readCondition gapi_dataReaderView_create_readcondition ( gapi_dataReaderView _this, const gapi_sampleStateMask sample_states, const gapi_viewStateMask view_states, const gapi_instanceStateMask instance_states) { _DataReaderView datareaderview; _ReadCondition readCondition = NULL; datareaderview = gapi_dataReaderViewClaim(_this, NULL); if ( datareaderview && _EntityEnabled(datareaderview) && gapi_stateMasksValid(sample_states, view_states, instance_states) ) { _DataReader datareader; datareader = _DataReaderViewDataReader(datareaderview); readCondition = _ReadConditionNew ( sample_states, view_states, instance_states, datareader, datareaderview); _EntityRelease(datareader); if ( readCondition != NULL ) { gapi_deleteEntityAction deleteAction; void *actionArg; if ( _ObjectGetDeleteAction(_Object(readCondition), &deleteAction, &actionArg) ) { _ObjectSetDeleteAction(_Object(readCondition), deleteAction, actionArg); } _ENTITY_REGISTER_OBJECT(_Entity(datareaderview), (_Object)readCondition); } } _EntityRelease(datareaderview); return (gapi_readCondition)_EntityRelease(readCondition); }
gapi_returnCode_t gapi_dataReader_get_sample_lost_status ( gapi_dataReader _this, gapi_sampleLostStatus *status) { gapi_returnCode_t result; _DataReader datareader; datareader = gapi_dataReaderClaim(_this, &result); if (datareader != NULL) { if (_EntityEnabled(datareader)) { result = _DataReader_get_sample_lost_status ( datareader, status); } else { result=GAPI_RETCODE_NOT_ENABLED; } _EntityRelease(datareader); } return result; }
gapi_returnCode_t gapi_publisher_end_coherent_changes ( gapi_publisher _this) { _Publisher publisher; gapi_returnCode_t result = GAPI_RETCODE_BAD_PARAMETER; u_result uResult; publisher = gapi_publisherClaim(_this, &result); if ( publisher != NULL ) { if ( _EntityEnabled(publisher)) { uResult = u_publisherCoherentEnd(U_PUBLISHER_GET(publisher)); result = kernelResultToApiResult(uResult); } else { result = GAPI_RETCODE_NOT_ENABLED; } } _EntityRelease(publisher); return result; }
gapi_returnCode_t gapi_dataReader_get_requested_deadline_missed_status ( gapi_dataReader _this, gapi_requestedDeadlineMissedStatus *status) { gapi_returnCode_t result; _DataReader datareader; datareader = gapi_dataReaderClaim(_this, &result); if (datareader != NULL) { if (_EntityEnabled(datareader)) { result = _DataReader_get_requested_deadline_missed_status( datareader, status); } else { result=GAPI_RETCODE_NOT_ENABLED; } _EntityRelease(datareader); } return result; }
/* QueryCondition * create_querycondition( * in SampleStateMask sample_states, * in ViewStateMask view_states, * in InstanceStateMask instance_states, * in string query_expression, * in StringSeq query_parameters); */ gapi_queryCondition gapi_dataReaderView_create_querycondition ( gapi_dataReaderView _this, const gapi_sampleStateMask sample_states, const gapi_viewStateMask view_states, const gapi_instanceStateMask instance_states, const gapi_char *query_expression, const gapi_stringSeq *query_parameters) { _DataReaderView datareaderview; _QueryCondition queryCondition = NULL; datareaderview = gapi_dataReaderViewClaim(_this, NULL); if ( datareaderview && _EntityEnabled(datareaderview) && query_expression && gapi_sequence_is_valid(query_parameters) && gapi_stateMasksValid(sample_states, view_states, instance_states) ) { _DataReader datareader; datareader = _DataReaderViewDataReader(datareaderview); queryCondition = _QueryConditionNew(sample_states, view_states, instance_states, query_expression, query_parameters, datareader, datareaderview); _EntityRelease(datareader); if ( queryCondition != NULL ) { _ENTITY_REGISTER_OBJECT(_Entity(datareaderview), (_Object)queryCondition); } } _EntityRelease(datareaderview); return (gapi_queryCondition)_EntityRelease(queryCondition); }
/* ReturnCode_t * assert_liveliness(); */ gapi_returnCode_t gapi_dataWriter_assert_liveliness ( gapi_dataWriter _this) { gapi_returnCode_t result; u_result uResult; _DataWriter datawriter; datawriter = gapi_dataWriterClaim(_this, &result); if (datawriter != NULL) { if (_EntityEnabled(datawriter)) { uResult = u_writerAssertLiveliness(U_WRITER_GET(datawriter)); result = kernelResultToApiResult(uResult); } else { result=GAPI_RETCODE_NOT_ENABLED; } } _EntityRelease(datawriter); return result; }
gapi_returnCode_t gapi_dataWriter_get_publication_matched_status ( gapi_dataWriter _this, gapi_publicationMatchedStatus *status) { gapi_returnCode_t result; _DataWriter datawriter; datawriter = gapi_dataWriterClaim(_this, &result); if (datawriter != NULL) { if (_EntityEnabled(datawriter)) { result = _DataWriter_get_publication_matched_status ( datawriter, status); } else { result=GAPI_RETCODE_NOT_ENABLED; } } _EntityRelease(datawriter); return result; }
gapi_returnCode_t gapi_dataWriter_get_offered_incompatible_qos_status ( gapi_dataWriter _this, gapi_offeredIncompatibleQosStatus *status) { gapi_returnCode_t result; _DataWriter datawriter; datawriter = gapi_dataWriterClaim(_this, &result); if (datawriter != NULL) { if (_EntityEnabled(datawriter)) { result = _DataWriter_get_offered_incompatible_qos_status ( datawriter, status); } else { result=GAPI_RETCODE_NOT_ENABLED; } } _EntityRelease(datawriter); return result; }
gapi_returnCode_t gapi_dataReader_get_matched_publications ( gapi_dataReader _this, gapi_instanceHandleSeq *publication_handles) { gapi_returnCode_t result; _DataReader datareader; datareader = gapi_dataReaderClaim(_this, &result); if (datareader != NULL) { if (_EntityEnabled(datareader)) { result = _DataReader_get_matched_publications ( datareader, publication_handles); } else { result=GAPI_RETCODE_NOT_ENABLED; } } _EntityRelease(datareader); return result; }
gapi_queryCondition gapi_dataReader_create_querycondition ( gapi_dataReader _this, const gapi_sampleStateMask sample_states, const gapi_viewStateMask view_states, const gapi_instanceStateMask instance_states, const gapi_char *query_expression, const gapi_stringSeq *query_parameters) { _DataReader datareader; gapi_boolean licensed; _QueryCondition queryCondition = NULL; licensed = _DomainParticipantFactoryIsContentSubscriptionAvailable(); if(licensed == TRUE){ datareader = gapi_dataReaderClaim(_this, NULL); if ( datareader && _EntityEnabled(datareader) && query_expression && gapi_sequence_is_valid(query_parameters) && gapi_stateMasksValid(sample_states, view_states, instance_states) ) { queryCondition = _QueryConditionNew(sample_states, view_states, instance_states, query_expression, query_parameters, datareader, NULL); if ( queryCondition != NULL ) { _ENTITY_REGISTER_OBJECT(_Entity(datareader), (_Object)queryCondition); } } _EntityRelease(datareader); } return (gapi_queryCondition)_EntityRelease(queryCondition); }
gapi_returnCode_t gapi_dataWriter_get_liveliness_lost_status ( gapi_dataWriter _this, gapi_livelinessLostStatus *status) { gapi_returnCode_t result; _DataWriter datawriter; datawriter = gapi_dataWriterClaim(_this, &result); if (datawriter != NULL) { if (_EntityEnabled(datawriter) ) { result = _DataWriter_get_liveliness_lost_status( datawriter, status); } else { result = GAPI_RETCODE_NOT_ENABLED; } } _EntityRelease(datawriter); return result; }
gapi_returnCode_t gapi_dataReader_wait_for_historical_data_w_condition ( gapi_dataReader _this, const gapi_char *filter_expression, const gapi_stringSeq *filter_parameters, const gapi_time_t *min_source_timestamp, const gapi_time_t *max_source_timestamp, const gapi_resourceLimitsQosPolicy *resource_limits, const gapi_duration_t *max_wait) { gapi_returnCode_t result; _DataReader datareader; c_time c_time_max_wait, c_time_min_source_timestamp, c_time_max_source_timestamp; u_result uResult; c_ulong length, i; c_char** params; struct v_resourcePolicy resource; datareader = gapi_dataReaderClaim(_this, &result); if (datareader) { if ( !max_wait || !gapi_validDuration(max_wait)) { result = GAPI_RETCODE_BAD_PARAMETER; } else if (!_EntityEnabled(datareader)) { result = GAPI_RETCODE_NOT_ENABLED; } else if(filter_parameters && !gapi_stringSeqValid(filter_parameters)){ result = GAPI_RETCODE_BAD_PARAMETER; } else { if(filter_parameters){ length = filter_parameters->_length; params = (c_char**)(os_malloc(length*sizeof(c_char*))); for(i=0; i<length; i++){ params[i] = filter_parameters->_buffer[i]; } } else { params = NULL; length = 0; } kernelCopyInDuration(max_wait, &c_time_max_wait); if ( (kernelCopyInTime(min_source_timestamp, &c_time_min_source_timestamp) != GAPI_RETCODE_OK) || (kernelCopyInTime(max_source_timestamp, &c_time_max_source_timestamp) != GAPI_RETCODE_OK) ) { result = GAPI_RETCODE_BAD_PARAMETER; } else { resource.max_samples = resource_limits->max_samples; resource.max_instances = resource_limits->max_instances; resource.max_samples_per_instance = resource_limits->max_samples_per_instance; uResult= u_dataReaderWaitForHistoricalDataWithCondition( U_DATAREADER_GET(datareader), (c_char*)filter_expression, params, length, c_time_min_source_timestamp, c_time_max_source_timestamp, &resource, c_time_max_wait); result = kernelResultToApiResult(uResult); } } _EntityRelease(datareader); } return result; }