Example #1
0
static void
userDataQosPolicyCopyin (
    c_base base,
    const gapi_userDataQosPolicy *src,
    struct v_userDataPolicy      *dst)
{
    static c_type gapi_userData_type = NULL;

    if ( src->value._length > 0 ) {
        if (gapi_userData_type == NULL) {
            c_type type = c_octet_t(base);
            if (type) {
                gapi_userData_type =
                        c_metaArrayTypeNew(c_metaObject(base),
                                           "C_ARRAY<c_octet>",
                                           type,0);
                c_free(type);
            }
        }

        if ( gapi_userData_type ) {
            dst->value = c_newArray(c_collectionType(gapi_userData_type),
                                    src->value._length);
            if ( dst->value ) {
                memcpy(dst->value, src->value._buffer, src->value._length);
            }
        }
    } else {
        dst->value = NULL;
    }
}
Example #2
0
c_collectionType
c_fieldRefs_t (
    c_base _this)
{
    if (_this->baseCache.fieldCache.c_fieldRefs_t == NULL) {
        _this->baseCache.fieldCache.c_fieldRefs_t = c_collectionType(
                             c_metaArrayTypeNew(c_metaObject(_this),
                                                "C_ARRAY<c_address>",
                                                c_address_t(_this),
                                                0));
    }
    return _this->baseCache.fieldCache.c_fieldRefs_t;
}
Example #3
0
c_collectionType
c_fieldPath_t (
    c_base _this)
{
    if (_this->baseCache.fieldCache.c_fieldPath_t == NULL) {
        _this->baseCache.fieldCache.c_fieldPath_t = c_collectionType(
                             c_metaArrayTypeNew(c_metaObject(_this),
                                                "C_ARRAY<c_base>",
                                                c_getMetaType(_this,M_BASE),
                                                0));
    }
    return _this->baseCache.fieldCache.c_fieldPath_t;
}
Example #4
0
v_messageQos
in_messageQos_new(
    in_connectivityPeerWriter writer, c_base base)
{

    in_ddsiDiscoveredWriterData i =
        in_connectivityPeerWriterGetInfo(writer);

    /* inefficient, should be permenanent */
    c_type type;
    v_messageQos _this ;
    c_long transportQosValue = 0; /* TODO */
#ifdef _FAST_ACCESS_
    c_long offset            = 10, /* byte0 + byte1 + transport_priority + 4*time_offsets */
#else
    c_long offset            = 6, /* byte0 + byte1 + transport_priority */
#endif
           strength_offset   = 0,
           latency_offset    = 0,
           deadline_offset   = 0,
           liveliness_offset = 0,
           lifespan_offset   = 0;

    c_octet byte0 = 0,
            byte1 = 0;

    c_octet *dst, *src;

    type = c_metaArrayTypeNew(c_metaObject(base),
                              "C_ARRAY<c_octet>",
                              c_octet_t(base),
                              0);

    _this = c_newArray((c_collectionType)type,offset);
    c_free(type); /* remove if "type" becomes permenanent */

    if (_this) {
        byte0 |= _LSHIFT_(i->topicData.info.reliability.kind,
                          MQ_BYTE0_RELIABILITY_OFFSET);
        byte0 |= _LSHIFT_(i->topicData.info.ownership.kind,
                          MQ_BYTE0_OWNERSHIP_OFFSET);
        byte0 |= _LSHIFT_(i->topicData.info.destination_order.kind,
                          MQ_BYTE0_ORDERBY_OFFSET);
        byte0 |= _LSHIFT_(i->topicData.info.lifecycle.autodispose_unregistered_instances,
                          MQ_BYTE0_AUTODISPOSE_OFFSET);
        byte1 |= _LSHIFT_(i->topicData.info.durability.kind,
                          MQ_BYTE1_DURABILITY_OFFSET);
        byte1 |= _LSHIFT_(i->topicData.info.liveliness.kind,
                          MQ_BYTE1_LIVELINESS_OFFSET);
        byte1 |= _LSHIFT_(i->topicData.info.presentation.access_scope,
                          MQ_BYTE1_PRESENTATION_OFFSET);
        byte1 |= _LSHIFT_(i->topicData.info.presentation.coherent_access,
                          MQ_BYTE1_ORDERED_ACCESS_OFFSET);
        byte1 |= _LSHIFT_(i->topicData.info.presentation.ordered_access,
                          MQ_BYTE1_COHERENT_ACCESS_OFFSET);

        if (i->topicData.info.ownership.kind == V_OWNERSHIP_EXCLUSIVE) {
            strength_offset = offset;
            offset += sizeof(i->topicData.info.ownership_strength.value);
        }

        if (c_timeIsZero(i->topicData.info.latency_budget.duration)) {
            byte0 |= _LSHIFT_(1,MQ_BYTE0_LATENCY_OFFSET);
        } else {
            latency_offset = offset;
            offset += sizeof(i->topicData.info.latency_budget.duration);
        }
        if (c_timeIsInfinite(i->topicData.info.deadline.period)) {
            byte0 |= _LSHIFT_(1,MQ_BYTE0_DEADLINE_OFFSET);
        } else {
            deadline_offset = offset;
            offset += sizeof(i->topicData.info.deadline.period);
        }
        if (c_timeIsInfinite(i->topicData.info.liveliness.lease_duration)) {
            byte0 |= _LSHIFT_(1,MQ_BYTE0_LIVELINESS_OFFSET);
        } else {
            liveliness_offset = offset;
            offset += sizeof(i->topicData.info.liveliness.lease_duration);
        }
        if (c_timeIsInfinite(i->topicData.info.lifespan.duration)) {
            byte0 |= _LSHIFT_(1,MQ_BYTE0_LIFESPAN_OFFSET);
        } else {
            lifespan_offset = offset;
            offset += sizeof(i->topicData.info.lifespan.duration);
        }

        ((c_octet *)_this)[0] = byte0;
        ((c_octet *)_this)[1] = byte1;

        src = (c_octet *)&(transportQosValue); /* TODO fix*/
        dst = (c_octet *)&((c_octet *)_this)[2];
        _COPY4_(dst,src);

        if (strength_offset) {
            src = (c_octet *)&(i->topicData.info.ownership_strength.value);
            dst = (c_octet *)&((c_octet *)_this)[strength_offset];
            _COPY4_(dst,src);
        }
        if (latency_offset) {
            src = (c_octet *)&(i->topicData.info.latency_budget.duration);
            dst = (c_octet *)&((c_octet *)_this)[latency_offset];
            _COPY8_(dst,src);
        }
        if (deadline_offset) {
            src = (c_octet *)&(i->topicData.info.deadline.period);
            dst = (c_octet *)&((c_octet *)_this)[deadline_offset];
            _COPY8_(dst,src);
        }
        if (liveliness_offset) {
            src = (c_octet *)&(i->topicData.info.liveliness.lease_duration);
            dst = (c_octet *)&((c_octet *)_this)[liveliness_offset];
            _COPY8_(dst,src);
        }
        if (lifespan_offset) {
            src = (c_octet *)&(i->topicData.info.lifespan.duration);
            dst = (c_octet *)&((c_octet *)_this)[lifespan_offset];
            _COPY8_(dst,src);
        }
    } else {
        assert(FALSE);
    }

    return _this;
}
Example #5
0
v_messageQos
v_messageQos_from_wqos_new(
    v_writerQos wqos,
    c_type msgQosType,
    v_presentationKind access_scope,
    c_bool coherent_access,
    c_bool ordered_access)
{
    v_messageQos _this;
    c_base base;
    v_duration tdur;
    c_ulong offset    = 6, /* byte0 + byte1 + transport_priority */
    strength_offset   = 0,
    latency_offset    = 0,
    deadline_offset   = 0,
    liveliness_offset = 0,
    lifespan_offset   = 0;

    c_octet byte0, byte1;

    c_octet *dst, *src;

    assert(C_TYPECHECK(wqos,v_writerQos));

    base = c_getBase(wqos);

    if (msgQosType == NULL) {
        msgQosType = c_metaArrayTypeNew(c_metaObject(base),
                                  "C_ARRAY<c_octet>",
                                  c_octet_t(base),
                                  0);
    }
    byte0 = (c_octet) (_LSHIFT_(wqos->reliability.v.kind, MQ_BYTE0_RELIABILITY_OFFSET) |
                       _LSHIFT_(wqos->ownership.v.kind, MQ_BYTE0_OWNERSHIP_OFFSET) |
                       _LSHIFT_(wqos->orderby.v.kind, MQ_BYTE0_ORDERBY_OFFSET) |
                       _LSHIFT_(wqos->lifecycle.v.autodispose_unregistered_instances, MQ_BYTE0_AUTODISPOSE_OFFSET));
    byte1 = (c_octet) (_LSHIFT_(wqos->durability.v.kind, MQ_BYTE1_DURABILITY_OFFSET) |
                       _LSHIFT_(wqos->liveliness.v.kind, MQ_BYTE1_LIVELINESS_OFFSET) |
                       /* writer->resend._d contains the access_scope of the publisher-QoS */
                       _LSHIFT_(access_scope, MQ_BYTE1_PRESENTATION_OFFSET) |
                       _LSHIFT_(coherent_access, MQ_BYTE1_COHERENT_ACCESS_OFFSET) |
                       _LSHIFT_(ordered_access, MQ_BYTE1_ORDERED_ACCESS_OFFSET));

    if (wqos->ownership.v.kind == V_OWNERSHIP_EXCLUSIVE) {
        strength_offset = offset;
        offset += (c_ulong) sizeof(wqos->strength.v.value);
    }
    if (OS_DURATION_ISZERO(wqos->latency.v.duration)) {
        byte0 = (c_octet) (byte0 | _LSHIFT_(1,MQ_BYTE0_LATENCY_OFFSET));
    } else {
        latency_offset = offset;
        offset += (c_ulong) sizeof(wqos->latency.v.duration);
    }
    if (OS_DURATION_ISINFINITE(wqos->deadline.v.period)) {
        byte0 = (c_octet) (byte0 | _LSHIFT_(1,MQ_BYTE0_DEADLINE_OFFSET));
    } else {
        deadline_offset = offset;
        offset += (c_ulong) sizeof(wqos->deadline.v.period);
    }
    if (OS_DURATION_ISINFINITE(wqos->liveliness.v.lease_duration)) {
        byte0 = (c_octet) (byte0 | _LSHIFT_(1,MQ_BYTE0_LIVELINESS_OFFSET));
    } else {
        liveliness_offset = offset;
        offset += (c_ulong) sizeof(wqos->liveliness.v.lease_duration);
    }
    if (OS_DURATION_ISINFINITE(wqos->lifespan.v.duration)) {
        byte0 = (c_octet) (byte0 | _LSHIFT_(1,MQ_BYTE0_LIFESPAN_OFFSET));
    } else {
        lifespan_offset = offset;
        offset += (c_ulong) sizeof(wqos->lifespan.v.duration);
    }

    _this = c_newArray((c_collectionType)msgQosType,offset);

    if (_this) {
        ((c_octet *)_this)[0] = byte0;
        ((c_octet *)_this)[1] = byte1;
        src = (c_octet *)&wqos->transport.v.value;
        dst = (c_octet *)&((c_octet *)_this)[2];
        _COPY4_(dst,src);

        if (strength_offset) {
            src = (c_octet *)&wqos->strength.v.value;
            dst = (c_octet *)&((c_octet *)_this)[strength_offset];
            _COPY4_(dst,src);
        }
        if (latency_offset) {
            tdur = v_durationFromOsDuration(wqos->latency.v.duration);
            src = (c_octet *)&tdur;
            dst = (c_octet *)&((c_octet *)_this)[latency_offset];
            _COPY8_(dst,src);
        }
        if (deadline_offset) {
            tdur = v_durationFromOsDuration(wqos->deadline.v.period);
            src = (c_octet *)&tdur;
            dst = (c_octet *)&((c_octet *)_this)[deadline_offset];
            _COPY8_(dst,src);
        }
        if (liveliness_offset) {
            tdur = v_durationFromOsDuration(wqos->liveliness.v.lease_duration);
            src = (c_octet *)&tdur;
            dst = (c_octet *)&((c_octet *)_this)[liveliness_offset];
            _COPY8_(dst,src);
        }
        if (lifespan_offset) {
            tdur = v_durationFromOsDuration(wqos->lifespan.v.duration);
            src = (c_octet *)&tdur;
            dst = (c_octet *)&((c_octet *)_this)[lifespan_offset];
            _COPY8_(dst,src);
        }
    } else {
        OS_REPORT(OS_CRITICAL,
                  "v_messageQos_new",V_RESULT_INTERNAL_ERROR,
                  "Failed to allocate messageQos.");
        assert(FALSE);
    }
    return _this;
}