# mco_calc_class_reg

> Registers the specified classes.

### Prototype

        void mco_calc_class_reg(	/*IN*/ mco_calc_t * calc,
                      /*IN*/ const char *cname,
                      /*IN*/ uint2 class_code,
                      /*IN*/ int n );

### Arguments

calc | A handle to the initialized calculator object
cname | The class name
class_code | Numeric code for this class
n | Number of objects of this class

### Description

> This function registers a class with the parameter passed for generating runtime statistics with the calculator. (See `mco_calc_class_add()` for an alternative method for registering a class.

### Return Codes

void | No value returned.

### Example

        Application snippet:

        const char * dbname = "calc_db";

        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_class_reg(&calc, "class1", 1, 10000);

                rc = mco_calc_class_reg(&calc, "class2", 2, 20000);

                ...

                /* 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

### Files

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