TUM-Logo

libRASCH

 

Home
 

General

About libRASCH/News
Design
Screen shots
Sample programs (with source code)
License
 

Download

libRASCH
Tools
 

Documentation

User
Developer
 

Resources

Mailing list
Supported Formats
Plugins
Status
Links
 
Contact
About this site
 
Last updated
Tue Mar 27 23:03:48 2007

C-Version of handle_eval

Sourcecode

#include <stdio.h>
#include <ra.h>

int main(int argc, char *argv[])
{
    ra_handle ra;
    value_handle vh;
    meas_handle meas;
    eval_handle eval;
    long l, num;

    /* initialize libRASCH */
    ra = ra_lib_init();
    if (ra == NULL)
    {
        printf("error initializing libRASCH\n");
        return -1;
    }

    /* open measurement */
    meas = ra_meas_open(ra, argv[1], 0);
    if (meas == NULL)
    {
        printf("can't open measurement %s\n", argv[1]);
        return -1;
    }

    /* get default evaluation */
    eval = ra_eval_get_def(meas);
    if (eval == NULL)
    {
        printf("no evaluation in measurement %s\n", argv[1]);
        return -1;
    }

    /* get some infos about evaluation */
    vh = ra_value_malloc();
    if (ra_info_get(eval, RA_INFO_EVAL_NAME_C, vh) == 0)
        printf("evaluation %s ", ra_value_get_string(vh));
    if (ra_info_get(eval, RA_INFO_EVAL_ADD_TS_C, vh) == 0)
        printf("was added at %s ", ra_value_get_string(vh));
    if (ra_info_get(eval, RA_INFO_EVAL_PROG_C, vh) == 0)
        printf("using the program %s", ra_value_get_string(vh));
    printf("\n\n");

    /* list event-properties */
    num = 0;
    if (ra_info_get(eval, RA_INFO_EVAL_PROP_NUM_L, vh) == 0)
        num = ra_value_get_long(vh);
    for (l = 0; l < num; l++)
    {
        prop_handle evprop;
        evset_handle evset;

        evprop = ra_prop_get_by_num(eval, l);
        evset = ra_evset_get_by_prop(evprop);

        if ((evprop == NULL) || (evset == NULL))
            continue;

        if (ra_info_get(evprop, RA_INFO_EVPROP_NAME_C, vh) == 0)
            printf("event-property %s ",
                   ra_value_get_string(vh));
        if (ra_info_get(evprop, RA_INFO_EVPROP_NAME_C, vh) == 0)
            printf("(%s) ", ra_value_get_string(vh));
        if (ra_info_get(evset, RA_INFO_EVSET_NAME_C, vh) == 0)
            printf("belongs to event-set %s ",
                   ra_value_get_string(vh));
        if (ra_info_get(evset, RA_INFO_EVSET_EV_NUM_L, vh) == 0)
            printf("and contains %d events",
                   ra_value_get_long(vh));
        printf("\n");
    }

    /* close */
    ra_value_free(vh);
    ra_meas_close(meas);
    ra_lib_close(ra);

    return 0;
}                               /* main() */

Output of the example

evaluation original was added at 27.05.2005  09:28:53 using
the program handle_eval

event-property qrs-pos (qrs-pos) belongs to event-set heartbeat
and contains 74 events
event-property qrs-class (qrs-class) belongs to event-set
heartbeat and contains 74 events
event-property qrs-temporal (qrs-temporal) belongs to event-set
heartbeat and contains 74 events
event-property rri (rri) belongs to event-set heartbeat and
contains 74 events
event-property rri-class (rri-class) belongs to event-set
heartbeat and contains 74 events
event-property rri-refvalue (rri-refvalue) belongs to event-set
heartbeat and contains 74 events
event-property rri-num-refvalue (rri-num-refvalue) belongs to
event-set heartbeat and contains 74 events