Main Content

getDataDefault

Get default storage class or storage class property setting for model data category

    Description

    example

    propertyValue = getDataDefault(myCodeMappingObj,category,property) returns the value from the code mappings of the specified property for the specified data category.

    Examples

    collapse all

    From the model code mappings for model myConfigModel, get the default storage class setting for root-level inports.

    cm = coder.mapping.api.get('myConfigModel');
    defaultStorageClass = getDataDefault(cm,'Inports','StorageClass');
    

    From the model code mappings for model myConfigModel, get the default header file setting for root-level inports.

    cm = coder.mapping.api.get('myConfigModel');
    defaultInputHeaderFile = getDataDefault(cm,'Inports','HeaderFile');
    

    Input Arguments

    collapse all

    Code mapping object (model code mappings) returned by a call to function coder.mapping.api.get.

    Example: myCM

    Category of model data elements that you return a property value for.

    Example: 'Inports'

    Code mapping property that you return a value for. Specify one of these property names or a property name for a storage class defined in the Embedded Coder Dictionary associated with the model.

    Information to ReturnProperty Name
    Name of storage classStorageClass
    Name of variable for data element in the generated codeIdentifier
    Name of source definition file that contains definitions for global data that is read by the data element and external codeDefinitionFile
    Name of get function called by code generated for the data elementGetFunction
    Name of source header file that contains declarations for global data that is read by the model data element and external codeHeaderFile
    Name of model for which the code generator places the definition for data element shared by multiple models in a model hierarchy Owner
    Boolean value indicating whether code generator preserves dimensions of data that is represented as a multidimensional arrayPerserveDimensions
    Name of set function called by code generated for data elementSetFunction
    Name of structure in generated code for data elementStructName

    Example: 'Identifier'

    Output Arguments

    collapse all

    The property value is one of these values depending on the category and property that you specify.

    PropertyValue Returned
    DefinitionFileCharacter vector or string scalar that names a C source file that contains definitions for global data read by data elements and external code. Applies to storage classes Const, ConstVolatile, ExportToFile, and Volatile.
    GetFunctionCharacter vector or string scalar that names a get function that a data element calls in the generated code. Applies to storage class GetSet.
    HeaderFileCharacter vector or string scalar that names a C header file that contains declarations for global data read by data elements and external code. Applies to storage classes Const, ConstVolatile, Define, ExportToFile, GetSet, ImportedDefine, ImportFromFile, and Volatile.
    MemorySectionCharacter vector or string scalar that names a memory section for a model defined in the Embedded Coder Dictionary.
    OwnerCharacter vector or string scalar that names the model that owns global data, which is used by other models in the same model hierarchy. The code generated for the owner model includes the global data definition. Applies to storage classes Const, ConstVolatile, ExportToFile, and Volatile.
    PerserveDimensionsBoolean flag that indicates whether to preserve dimensions of a data element that is represented in generated code as a multidimensional array. Applies to storage classes Const, ConstVolatile, ExportToFile, FileScope, ImportFromFile, Localizable, and Volatile.
    SetFunction

    Character vector or string scalar that names a set function, which a data element calls in the generated code. Applies to storage class GetSet.

    StorageClassOne of these values: Auto, Bitfield, CompileFlag, Const, ConstVolatile, Define, Dictionary default, ExportedGlobal, ExportToFile, FileScope, GetSet, ImportedDefine, ImportedExtern, ImportedExternPointer, ImportFromFile, Localizable, Model default, Struct, Volatile
    StructNameCharacter vector or string scalar that names that names a structure for a data element in the generated code. Applies to storage classes Bitfield and Struct.

    Data Types: char | string

    Introduced in R2020b