mco_calc_register_classes

Registers the specified classes.

Prototype

    void mco_calc_register_classes(/*IN*/ mco_calc_t * calc,
                      /*IN*/ mco_cc_t classes);

Arguments

calc
A handle to the initialized calculator object.
classes
An array of class definition structures.

Description

This function registers the classes passed in the classes parameter for generating runtime statistics with the calculator. This method can be used as an alternative to calling mco_calc_reg_schema_classes() which registers the classes from the dictionary's built-in information.

Return Codes

void
No value returned.

Example

    Application snippet:

    const char * dbname = "calc_db";

    static mco_cc_t my_classes[] =
    {
           MCO_CALC_DEFINE_CLASS(class_name1, number_of_objects),
           ...
           MCO_CALC_DEFINE_CLASS(class_nameN, number_of_objects),
           MCO_CALC_CLASSES_END,
     };

    int main(int argc, char* argv[])
    {
        MCO_RET            rc;
        mco_device_t       dev;
        mco_calc_t calc;
        mco_db_params_t    db_params;

        mco_runtime_start();
        ...
        mco_calc_init(&calc, calc_db_get_dictionary());
        ...
        rc = mco_db_open_dev( dbname, simple_get_dictionary(), &dev, 1, &db_params );
        if ( MCO_S_OK != rc )
        {
            rc = mco_db_connect(  dbname, &calc.db );
            ...
            rc = mco_calc_register_classes(&calc, my_classes);

            ...

            /* NOTE: calculator *must* be deinitialized before you disconnect from the database */
            mco_calc_deinit(&calc);

            mco_db_disconnect(calc.db);
        }
    }

For further implementation details see SDK sample "samples/native/core/17-statistics/dbcalc".

Related Topics Link IconRelated Topics

Files

Header file:
mcodbcalc.h
Source file:
mcodbcalc.c
Library:
libmcodbcalc.a