Example #1
0
gapi_returnCode_t
gapi_fooDataWriter_dispose (
    gapi_fooDataWriter _this,
    const gapi_foo *instance_data,
    const gapi_instanceHandle_t handle)
{
    gapi_returnCode_t result = GAPI_RETCODE_BAD_PARAMETER;
    _DataWriter datawriter;
    writerInfo data;
    u_result r;

    if ( instance_data != NULL ) {
        datawriter = gapi_dataWriterReadClaim(_this, &result);
        if ( datawriter != NULL ) {
            data.writer = datawriter;
            data.data = (void *)instance_data;

            r = u_writerDispose (U_WRITER_GET(datawriter),
                                 &data,
                                 C_TIME_INVALID,
                                 handle);
            _EntityReadRelease(datawriter);
            result = kernelResultToApiResult(r);
        }
    }

    return result;
}
Example #2
0
gapi_returnCode_t
gapi_fooDataWriter_dispose_w_timestamp (
    gapi_fooDataWriter _this,
    const gapi_foo *instance_data,
    const gapi_instanceHandle_t handle,
    const gapi_time_t *source_timestamp)
{
    gapi_returnCode_t result = GAPI_RETCODE_BAD_PARAMETER;
    _DataWriter datawriter;
    writerInfo data;
    c_time timestamp;
    u_result r;

    if ( instance_data != NULL ) {
        result = kernelCopyInTime(source_timestamp, &timestamp);
        if ( result == GAPI_RETCODE_OK ) {
            datawriter = gapi_dataWriterReadClaim(_this, &result);
            if ( datawriter != NULL ) {
                data.writer = datawriter;
                data.data = (void *)instance_data;

                r = u_writerDispose (U_WRITER_GET(datawriter),
                                     &data,
                                     timestamp,
                                     handle);
                _EntityRelease(datawriter);
                result = kernelResultToApiResult(r);
            }
        }
    }

    return result;
}
Example #3
0
u_result
nb_topicObjectWrite(
        u_writer writer,
        nb_topicObject _this)
{
    u_result result = U_RESULT_UNSUPPORTED;
    os_timeW timestamp;

    assert(writer);
    nb_objectIsValid(_this);

    timestamp = _this->writeTime;

    if(v_stateTest(_this->state, L_REGISTER)){
        result = u_writerRegisterInstance(
                     writer,
                     nb_topicObjectCopyIn,
                     _this,
                     timestamp,
                     U_INSTANCEHANDLE_NIL);
    } else if(v_stateTest(_this->state, L_WRITE) && v_stateTest(_this->state, L_DISPOSED)){
        result = u_writerWriteDispose(
                     writer,
                     nb_topicObjectCopyIn,
                     _this,
                     timestamp,
                     U_INSTANCEHANDLE_NIL);
    } else if(v_stateTest(_this->state, L_WRITE)) {
        result = u_writerWrite(
                     writer,
                     nb_topicObjectCopyIn,
                     _this,
                     timestamp,
                     U_INSTANCEHANDLE_NIL);
    } else if(v_stateTest(_this->state, L_DISPOSED)) {
        result = u_writerDispose(
                     writer,
                     nb_topicObjectCopyIn,
                     _this,
                     timestamp,
                     U_INSTANCEHANDLE_NIL);
    }

    return result;
}