Main Content

coder.mapping.api.CoderDictionary

Query and set the code settings of dictionary defaults in an Embedded Coder dictionary within a Simulink data dictionary

    Description

    A coder dictionary code mappings object and its related functions enable you to configure C code generation settings for dictionary defaults in an Embedded Coder® dictionary within a Simulink® data dictionary. For model data categories, code mappings associate data categories with configurations that consist of a storage class and storage class properties. For functions, code mappings associate function categories with configurations that consist of a function customization template. Reduce the effort of preparing a model for code generation by specifying default configurations for categories of data elements and functions across a model.

    Creation

    Description

    myCoderDictionaryObj = coder.mapping.api.get(dictionary) returns the active code mappings for the specified dictionary as object myCoderDictionaryObj. Code mappings associate data elements and functions in the data dictionary with configurations for code generation.

    If code mappings do not exist, Simulink returns an error. You can create a code mappings object with a call to coder.mapping.utils.create.

    myCoderDictionaryObj = coder.mapping.utils.create(dictionary) creates a code mappings environment for the specified data dictionary and returns the mappings as object myCoderDictionaryObj. Code mappings associate data elements and functions with configurations for C or C++ code generation. If code mappings exist for the specified data dictionary, the function returns those code mappings.

    Input Arguments

    expand all

    Data dictionary for which to return code mappings object, specified as a character vector or string scalar representing the dictionary name.

    Example: 'exCodeDefs.sldd'

    Data Types: char | string

    Object Functions

    setDataDefaultSet default code settings for data category
    getDataDefaultGet default code settings for data category
    setFunctionDefaultSet default function customization template and memory section for model functions category
    getFunctionDefaultGet default function customization template or memory section for model functions category

    Examples

    collapse all

    For the data dictionary exCodeDefs.sldd, create the environment for configuring the data and functions for code generation. After calling this function, use calls to other functions listed under Object Functions to configure aspects of code generation for the interface elements.

    coder.mapping.utils.create('exCodeDefs.sldd');
    
    Introduced in R2021a