coder.Dictionary.getDictionaryDefault - Return default service for service interface section or default property value for
data interface category - MATLAB ([original](https://www.mathworks.com/help/ecoder/ref/coder.dictionary.getdictionarydefault.html)) ([raw](?raw))
Class: coder.Dictionary
Namespace: coder
Return default service for service interface section or default property value for data interface category
Since R2023b
Syntax
Description
[defaultEntry](#mw%5F4f75ad04-a9be-4f8a-9bba-0abf49069f10) = getDictionaryDefault([serviceDict](#mw%5F59a7d07b-efc1-45be-bc2b-b0618dae0599),[sectionName](#mw%5Fef33e67e-738c-4143-9201-2c2ede9c5e88))
returns the default entry of the service interface sectionsectionName
in the service interfaces coder dictionaryserviceDict
.
[defaultPropVal](#mw%5F0b997acd-3c05-4734-bb8a-f7870c81aafa) = getDictionaryDefault([dataDict](#mw%5F9fb071b2-8056-43ca-9210-0a5f17cfdd38),[categoryName](#mw%5F52e58cc3-9f4e-41bb-b9b8-d3a555e6b700),[propName](#mw%5F4ae071d0-2070-412a-ade3-96677e65e8f7))
returns the default value of the property propName
of the categorycategoryName
in the data interfaces coder dictionarydataDict
.
Input Arguments
Embedded CoderĀ® Dictionary that contains a service interface configuration, specified as acoder.Dictionary object.
Service interface section name, specified as a string scalar or character vector that corresponds to a section of the service interface definitions in the dictionary. Sections include:
"DataReceiverInterfaces"
"DataSenderInterfaces"
"DataTransferInterfaces"
"InitTermFunctions"
"MeasurementInterfaces"
"ParameterArgumentTuningInterfaces"
"ParameterTuningInterfaces"
"PeriodicAperiodicFunctions"
"SharedUtilityFunctions"
"SubcomponentInitTermFunctions"
"SubcomponentPeriodicAperiodicFunctions"
"TimerInterfaces"
Embedded Coder Dictionary that contains a data interface configuration, specified as acoder.Dictionary object.
Data interface category name, specified as a string scalar or character vector that corresponds to a category in one of the category groups in the dictionary,Function Defaults
and Data Defaults
.
Function Defaults
categories are:
"InitializeTerminate"
"Execution"
"SharedUtility"
Data Defaults
categories are:
"Inports"
"Outports"
"ModelParameters"
"ModelParameterArguments"
"ExternalParameters"
"SharedLocalDataStores"
"GlobalDataStores"
"InternalData"
"Constants"
Name of category property for which to retrieve the dictionary default value, specified as a string scalar or character vector. The list of available properties to use with this method depends on the category type and its specific configuration.
For categories within Function Defaults
, theFunctionCustomizationTemplate
property is available for use with this method. When the FunctionCustomizationTemplate
is set toDefault
, an additional property, MemorySection
, becomes available for use with this method for these categories.
Data Defaults
categories have the StorageClass
property available for use with this method. The set of available properties is dynamic and varies based on the assigned value of the StorageClass
property. For example, when the StorageClass
property is assigned the valueExportToFile
, which is allowed for certain categories, these additional properties become available for use with this method:
"HeaderFile"
"DefinitionFile"
"Owner"
"PreserveDimensions"
To learn more about storage classes and their properties, see Choose Storage Class for Controlling Data Representation in Generated Code.
Output Arguments
Default entry for the specified service interface section, returned as acoder.dictionary.Entry
object.
Default property value, returned as a character vector.
Examples
Create a Simulink data dictionary that contains an Embedded Coder Dictionary. Create the Embedded Coder Dictionary so that it represents a service interface configuration.
dictionaryFile = Simulink.data.dictionary.create("codeDefinitions.sldd"); codeDictionary = coder.dictionary.create("codeDefinitions.sldd","ServiceInterface");
Get the default measurement interface entry.
meas = getDictionaryDefault(codeDictionary,"MeasurementInterfaces")
meas =
Entry with properties:
Name: 'MeasurementExample1'
DataSource: 'C:\work\serviceDefinitions.sldd'
StorageClass: 'MeasurementStruct'
For this example, the default measurement interface isMeasurementExample1
.
Create a SimulinkĀ® data dictionary, then create the Embedded Coder Dictionary to represent a data interface configuration.
dictFileName = "dataDict.sldd"; dataDict = Simulink.data.dictionary.create(dictFileName); coderDataDict = coder.dictionary.create(dataDict,"DataInterface");
Use the getDictionaryDefault
method to see the default StorageClass
of the Outports
category.
getDictionaryDefault(coderDataDict,"Outports","StorageClass")
Set the default StorageClass
of the Outports
category to GetSet
. Then specify GetFunction
(the naming rule of the get function) as get_outports_$N
and specify SetFunction
(the naming rule of the set function) as set_outports_$N
.
setDictionaryDefault(coderDataDict,"Outports","StorageClass","GetSet") setDictionaryDefault(coderDataDict,"Outports","GetFunction","get_outports_$N") setDictionaryDefault(coderDataDict,"Outports","SetFunction","set_outports_$N")
Discard and close the dictionary, then delete the dictionary file. This allows you to run this example more than once without getting an error while attempting to create the dictionary.
discardChanges(dataDict) Simulink.data.dictionary.closeAll("-save") delete(dictFileName)
Version History
Introduced in R2023b
The dictionary sections SubcomponentInitTermFunctions
andSubcomponentPeriodicAperiodicFunctions
replace the sectionSubcomponentEntryFunctions
.