static c_bool
    copyInstanceHandle(
        v_dataReaderInstance instance,
        c_voidp arg)
    {
        c_bool result = TRUE;
        struct copyInstanceHandle *a = (struct copyInstanceHandle *)arg;
        DDS::InstanceHandle_t ghandle;
        os_uint32 length;
        if (a->index ==0) {
            length = c_count(v_dataReaderInstanceGetNotEmptyInstanceSet(instance));
            if (length > a->seq->maximum()) {
                a->seq->length(length); /* potentially reallocate */
            }
        }

        ghandle = u_instanceHandleNew((v_public)instance);
        if (a->index < a->seq->maximum()) {
            (*a->seq)[a->index++] = ghandle;

        } else {
            /* error index out of bounds */
        }

        return result;
    }
Beispiel #2
0
DDS::ReturnCode_t
DDS::OpenSplice::Utils::copyStatusOut(
    const v_deadlineMissedInfo &from,
    DDS::OfferedDeadlineMissedStatus &to)
{
    DDS::ReturnCode_t result;
    v_object instance;

    result = DDS::RETCODE_ERROR;

    to.total_count = from.totalCount;
    to.total_count_change = from.totalChanged;
    if (!v_handleIsNil(from.instanceHandle)) {
        if (v_handleClaim(from.instanceHandle, &instance) == V_HANDLE_OK) {
            to.last_instance_handle = u_instanceHandleNew(v_public(instance));
            if (v_handleRelease(from.instanceHandle) == V_HANDLE_OK) {
                result = DDS::RETCODE_OK;
            }
        }
    } else {
        result = DDS::RETCODE_OK;
    }

    return result;
}
static void
copySampleInfoView (
    v_readerSample sample,
    v_message message,
    gapi_sampleInfo *to
    )
{
    v_state              state;
    v_dataReaderSample   master;
    v_dataViewInstance   viewInstance;
    v_dataReaderInstance masterInstance;

    viewInstance = (v_dataViewInstance)sample->instance;

    master = v_dataReaderSample(v_dataViewSampleTemplate(sample)->sample);
    masterInstance = (v_dataReaderInstance)v_readerSampleInstance(master);

    state = v_readerSample(sample)->sampleState;
    if (v_stateTest (state, L_READ)) {
        to->sample_state = GAPI_READ_SAMPLE_STATE;
    } else {
        to->sample_state = GAPI_NOT_READ_SAMPLE_STATE;
    }

    if (v_stateTest (state, L_NEW)) {
        to->view_state = GAPI_NEW_VIEW_STATE;
    } else {
        to->view_state = GAPI_NOT_NEW_VIEW_STATE;
    }

    state = masterInstance->instanceState;
    to->instance_state = GAPI_ALIVE_INSTANCE_STATE;
    if (v_stateTest (state, L_NOWRITERS)) {
        to->instance_state = GAPI_NOT_ALIVE_NO_WRITERS_INSTANCE_STATE;
    }
    if (v_stateTest (state, L_DISPOSED)) {
        to->instance_state = GAPI_NOT_ALIVE_DISPOSED_INSTANCE_STATE;
    }

    /* Data is always valid for views */
    to->valid_data = TRUE;
    to->source_timestamp.sec        = (gapi_long)(message->writeTime.seconds);
    to->source_timestamp.nanosec    = (gapi_unsigned_long)(message->writeTime.nanoseconds);

    to->disposed_generation_count   = master->disposeCount;
    to->no_writers_generation_count = master->noWritersCount;
    to->sample_rank                 = 0;
    to->generation_rank             = 0;
    to->absolute_generation_rank    = 0;
    to->instance_handle             = u_instanceHandleNew(v_public(viewInstance));

    to->publication_handle          = u_instanceHandleFromGID(master->publicationHandle);

    to->reception_timestamp.sec       = (gapi_long)(master->insertTime.seconds);
    to->reception_timestamp.nanosec   = (gapi_unsigned_long)(master->insertTime.nanoseconds);
}
Beispiel #4
0
static v_result
copy_deadline_missed_status(
    c_voidp info,
    c_voidp arg)
{
    struct v_deadlineMissedInfo *from;
    gapi_offeredDeadlineMissedStatus *to;
    v_handleResult result;
    v_public instance;

    from = (struct v_deadlineMissedInfo *)info;
    to = (gapi_offeredDeadlineMissedStatus *)arg;

    to->total_count = from->totalCount;
    to->total_count_change = from->totalChanged;

    result = v_handleClaim(from->instanceHandle, (v_object *) &instance);
    if (result == V_HANDLE_OK) {
        to->last_instance_handle = u_instanceHandleNew(v_public(instance));
        result = v_handleRelease(from->instanceHandle);
    }
    return V_RESULT_OK;
}
Beispiel #5
0
u_instanceHandle
u_instanceHandleFix(
    u_instanceHandle _this,
    v_collection reader)
{
    u_instanceHandleTranslator translator;
    struct v_publicationInfo *data;
    v_topic topic;
    v_message message;
    v_public instance;

    translator.handle = _this;
    if (translator.lid.lifecycleId & HANDLE_GLOBAL_MASK) {
        /* Is a GID therefore fix handle by lookup. */
        while (v_objectKind(v_entity(reader)) == K_QUERY ||
               v_objectKind(v_entity(reader)) == K_DATAREADERQUERY ||
               v_objectKind(v_entity(reader)) == K_DATAVIEWQUERY) {
            /* If the entity derives from a query entity it can be cast to a v_query */
            reader = v_querySource(v_query(reader));
        }
        while (v_objectKind(v_entity(reader)) == K_DATAVIEW) {
            reader = v_collection(v_dataViewGetReader(v_dataView(reader)));
        }
        topic = v_dataReaderGetTopic(v_dataReader(reader));
        message = v_topicMessageNew(topic);
        data = (c_voidp)C_DISPLACE(message, v_topicDataOffset(topic));
        data->key = u_instanceHandleToGID(_this);
        instance = (v_public)v_dataReaderLookupInstance(v_dataReader(reader),
                                                        message);
        translator.handle = u_instanceHandleNew(instance);
        c_free(instance);
        c_free(topic);
        c_free(message);
    }
    return translator.handle;
}