mco_uda_db_open

Open the database for UDA.

Prototype

    MCO_RET mco_uda_db_open(    /*IN*/const mco_metadict_header_t * metadict,
                  /*IN*/ unsigned short dict_no,
                  /*IN*/ mco_device_t * devs,
                  /*IN*/ mco_size_t n_devs,
                  /*IN*/ mco_db_params_t * params);

Arguments

metadict
The address of an initialized mco_metadict_header_t structure.
dict_no
The number of the dictionary (must be between 0 and mco_metadict_count() - 1).
devs
An array containing at least one initialized memory device structure.
n_devs
The number of memory device structures.
params
Initialized database parameters structure.

Description

This function can be used to replace mco_db_open_dev().

Return Codes

MCO_S_OK
The database was successfully opened.
MCO_E_UDA_DICT_NOTFOUND
The dictionary is not registered.
MCO_E_UDA_DICT_NOT_DIRECT
The dictionary has not been registered explicitly.

Example


    Application snippet:

    const char * dbname = "SimpleDb";

    int main(int argc, char* argv[])
    {
        MCO_RET rc;
        mco_runtime_info_t info;
        unsigned int dict_no = 0;
        unsigned int count;
        mco_metadict_header_t *header;
        mco_device_t       dev;
        unsigned int n_dev;
        mco_db_params_t db_params;
        mco_uda_class_storage patches[2];

        ...
        mco_runtime_start();
        mco_get_runtime_info(&info);
        ...

        header = (mco_metadict_header_t *) malloc(size);
        mco_metadict_init(header, size); /* initialize the metadict */
        ...

        /* open database */
    rc = mco_uda_db_open(header,     /* meta-dictionary header - must be initialized */
                      0,             /* dictionary number */
                     &dev,           /* memory devices */
                    n_dev,          /* num of memory devices */
                    &db_params); /* db parameters */
        ...
    }

Files

Header file:
mco.h
Source file:
mcouda.c
Library:
libmcouda.a