coder.dictionary.Entry - Configure Embedded Coder Dictionary definition - MATLAB (original) (raw)

Namespace: coder.dictionary

Configure Embedded Coder Dictionary definition

Description

An object of the coder.dictionary.Entry class represents one definition of an Embedded Coder® Dictionary. In this API, the object is called an entry. The information that the object represents is a definition. In this documentation, definition refers to the definition of the entry object.

A coder.Dictionary object contains coder.dictionary.Section objects, which represent the categories of an Embedded Coder Dictionary. A coder.dictionary.Section object containscoder.dictionary.Entry objects, which represent the definitions stored in that section of the Embedded Coder Dictionary. The name of the section identifies the type of code definitions that the section contains. To access the sections of an Embedded Coder Dictionary, use a coder.Dictionary object. To access the dictionary entries within the section, use a coder.dictionary.Section object.

Properties

expand all

A coder.dictionary.Entry object has these properties.

Name of the coder dictionary definition that the entry represents. The name must be unique among the definitions in the section of the dictionary.

The location of the code definition. This property is read-only.

To access the properties of the code definition that an entry represents, use the getAvailableProperties, get, andset methods. Each type of code definition has available properties listed.

Storage Classes

Custom text that you can use to describe the purpose and functionality of the storage class.

The location of the code definition. This property is read-only.

Specification to access data associated with the model. Access the data directly (Direct), through customizable get andset functions (Function), or by using a pointer (Pointer). For more information, see Access Data Through Functions by Using Storage Classes in Embedded Coder Dictionary.

Dependencies

In addition, setting this property to Function enables these properties:

Specification that the generated code defines the data (Exported) or import (Imported) the data definition from external code. Built-in storage classes and storage classes in packages such as Simulink can use other scope options, such as File.

Dependencies

Name of the header file that declares the data, specified as a name or naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Name of associated data element
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control

Dependencies

Name of the source file that defines the data, specified as a name or naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Name of associated data element
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control

Dependencies

Setting DataScope to Imported disablesDefinitionFile. To include your external source code file in the build process, use model configuration parameters. For an example, see Configure Data Interface.

Specification for the storage class to allow read and write (ReadWrite), read-only (ReadOnly), or write-only (WriteOnly) access to the data.

Dependencies

This property is enabled only when you set DataAccess toFunction.

Name of the get function that fetches the associated data, specified as a name or naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$N Name of associated data element (required)
$R Name of root model
$M Mangle text that ensures uniqueness
$U User token text. See Identifier Format Control.

Dependencies

This property is enabled only when you set DataAccess toFunction and AllowedAccess toReadWrite or ReadOnly.

Name of the set function that fetches the modified data, specified as a name or naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$N Name of associated data element (required)
$R Name of root model
$M Mangle text that ensures uniqueness
$U User token text. See Identifier Format Control.

Dependencies

This property is enabled only when you set DataAccess toFunction and AllowedAccess toReadWrite or WriteOnly.

Specification for the storage class to use either the storage settings that you specify for single-instance data or the settings that you specify for multi-instance data. When you apply the storage class to a data item, the Embedded Coder Dictionary determines if it is a single-instance storage class or a multi-instance storage class by the type of data and by the context of the model within the model reference hierarchy.

Dependencies

Selecting this property enables the propertiesSingleInstanceStorageType,MultiInstanceStorageType, andMultiInstanceStructureTypeName,MultiInstanceStructureInstanceName.

Specification to aggregate the data that uses the storage class into a structure in the generated code. Each data element appears in the code as a field of the structure. To create a structure, use Structured.

Dependencies

Setting this property to Structured enablesStructureTypeName andStructureInstanceName.

Name of the structure type in the generated code, specified as a name or a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such as step
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted, if necessary, to avoid name collisions

Dependencies

Setting StorageType to Structured enables this property.

Name of the structure variable in the generated code, specified as a name or a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such as step
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted, if necessary, to avoid name collisions

Dependencies

Setting StorageType to Structured enables this property.

Specification to aggregate the single-instance data that uses the storage class into a structure in the generated code. Each data element appears in the code as a field of the structure. To create a structure, use Structured.

Dependencies

Name of the structure type in the generated code, specified as a name or a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such as step
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted, if necessary, to avoid name collisions

Dependencies

Setting SingleInstanceStorageType toStructured enables this property.

Name of the structure variable in the generated code, specified as a name or a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such as step
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted, if necessary, to avoid name collisions

Dependencies

Setting SingleInstanceStorageType toStructured enables this property.

Specification to aggregate the single-instance data that uses the storage class into a structure in the generated code. Each data element appears in the code as a field of the structure. You cannot change the value of this property.

Dependencies

Setting the property UseDifferentPropSettingsForInstanceData to true enables this property.

Name of the structure type in the generated code, specified as a name or a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such as step
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted, if necessary, to avoid name collisions

Dependencies

Name of the structure variable in the generated code, specified as a name or a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such as step
$G Name of storage class
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted, if necessary, to avoid name collisions

Dependencies

Specification that the generated codes initialize the data.

For storage classes used for persistent data, you must setDataInit to None.

Dependencies

Specification to apply the const qualifier to the data.

Dependencies

Specification to apply the volatile qualifier to the data.

Specification indicating whether to allow usage of the storage class with model parameters.

Dependencies

Specification indicating whether to allow usage of the storage class with model signals.

Dependencies

Function Customization Templates

Name of the template. The name must be unique among the function templates in the dictionary. Embedded Coder provides the built-in templates listed in this table.

Custom text that you can use to describe the purpose and functionality of the function template.

Names of the functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Base name of associated function, such as step
$U User token text, which you specify for a model as described in Identifier Format Control
$C For shared utility functions, a checksum inserted to avoid name collisions
$M Name-mangling text inserted, if necessary, to avoid name collisions

Memory Sections

Name of the memory section, specified as a character vector or string scalar. The name must be unique among the memory sections in the dictionary. Embedded Coder provides the built-in memory sections listed in this table.

Memory Section Description
MemConst Apply the storage type qualifier const to the data.
MemVolatile Apply the storage type qualifier volatile to the data.
MemConstVolatile Apply the storage type qualifiers const andvolatile to the data.

Custom text that you can use to describe the purpose and functionality of the memory section.

Code comment that the code generator includes with the pragmas or other decorations that you specify with PreStatement andPostStatement.

Code, such as pragmas, to insert before the definitions and declarations of the data or functions that are in the memory section.

You can use the token $R to represent the name of the model that uses the memory section.

When you set StatementsSurround toEachVariable, you can use the token $N to represent the name of each variable or function that uses the memory section.

Code, such as pragmas, to insert after the definitions and declarations of the data or functions that are in the memory section.

You can use the token $R to represent the name of the model that uses the memory section.

When you set StatementsSurround toEachVariable, you can use the token $N to represent the name of each variable or function that uses the memory section.

Specification to insert code statements (PreStatement andPostStatement):

Receiver Service Interfaces

Name of the receiver service, specified as a character vector or string scalar. Embedded Coder provides the example services listed in this table.

Receiver Service Description
ReceiverExample1 Favor memory optimization over data freshness. This service hasDataCommunicationMethod set toOutsideExecution, so the service reads data from another function before the function starts executing.
ReceiverExample2 Favor data freshness over memory optimization. This service hasDataCommunicationMethod set toDuringExecution, so the service reads data from another function immediately during execution.
ReceiverExample3 Use this option to maximize performance of component code or if mutual exclusion is inherent in component model design. This service has DataCommunicationMethod set toDirectAccess, so the service reads data from generated function code directly by using memory that platform services manage for the target execution environment.

How receiver data transmission is handled between the target platform service and the run-time environment, specified as one of these options:

Names of the receiver functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$G Service name
$N Element name
$X Current callable function
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted to avoid name collisions

Dependencies

To specify a function naming rule, you must setDataCommunicationMethod to OutsideExecution orDuringExecution.

Storage class definition, specified as one of the definitions in theStorageClasses section of the dictionary.

Dependencies

To specify a storage class receiver services, you must setDataCommunicationMethod toDirectAccess.

Sender Service Interfaces

Name of the sender service, specified as a character vector or string scalar. Embedded Coder provides the example services listed in this table.

Sender Service Description
SenderExample1 Favor memory optimization over data freshness. This service hasDataCommunicationMethod set toOutsideExecution, so the service sends data to another function after the function executes.
SenderExample2 Favor data freshness over memory optimization. This service hasDataCommunicationMethod set toDuringExecution, so the service reads data from another function immediately during execution.
SenderExample3 Use this option to maximize performance of component code or if mutual exclusion is inherent in component model design. This service has DataCommunicationMethod set toDirectAccess, so the service reads data from generated function code directly by using memory that platform services manage for the target execution environment.

How sender data transmission is handled between the task and the run-time environment, specified as one of these options:

Names of the sender functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$G Service name
$N Element name
$X Current callable function
$U User token text, which you specify for a model as described in Identifier Format Control
$M Name-mangling text inserted to avoid name collisions

Dependencies

To specify a function naming rule, you must setDataCommunicationMethod to OutsideExecution orDuringExecution.

Names of the sender functions that send a value by reference in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$G Service name
$X Current callable function
$U User token text, which you specify for a model as described in Identifier Format Control

Dependencies

To specify a function naming rule, the definition must be a data sender service and you must set DataCommunicationMethod toOutsideExecution or DuringExecution.

Storage class definition, specified as one of the definitions in theStorageClasses section of the dictionary.

Dependencies

To specify a storage class receiver services, you must setDataCommunicationMethod toDirectAccess.

Data Transfer Service Interfaces

Name of the data transfer service, specified as a character vector or string scalar. Embedded Coder provides the example services listed in this table.

Data Transfer Service Description
DataTransferExample1 Favor memory optimization over data freshness. This service hasDataCommunicationMethod set toOutsideExecution, so the service receives and sends data from another function outside of function execution.
DataTransferExample2 Favor data freshness over memory optimization. This service hasDataCommunicationMethod set toDuringExecution, so the service reads data from another function immediately during execution.

How data transmission is handled between the task and the run-time environment, specified as one of these options:

Names of the receiver functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Element name
$X Current callable function
$M Name-mangling text inserted to avoid name collisions

Names of the sender functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$R Name of root model
$N Element name
$X Current callable function
$M Name-mangling text inserted to avoid name collisions

Timer Services

Name of the timer service, specified as a character vector or string scalar. Embedded Coder provides the example service listed in this table.

Timer Service Description
TimerServiceExample1 The timer service executes outside of function execution.

How data transmission is handled between the task and the run-time environment, specified as one of these options:

Names of the clock tick functions in the generated code, specified as a naming rule. A naming rule includes a combination of text and tokens. Valid tokens are listed in this table.

Token Description
$G Service name
$X Current callable function
$U User token text, which you specify for a model as described in Identifier Format Control

Dependencies

Parameter Tuning Interfaces

The name of the parameter tuning service to use with parameters, specified as a character vector or string scalar. If the parameters do not need to be tuned, this property has the default value, "Not tunable".

Storage class definition, specified as one of the definitions in theStorageClasses section of the dictionary.

Parameter Argument Tuning Interfaces

The name of the parameter argument tuning service to use with parameter arguments, specified as a character vector or string scalar. If the parameter arguments do not need to be tuned, this property has the default value, "Not tunable".

Storage class definition, specified as one of the definitions in theStorageClasses section of the dictionary.

Measurement Service Interfaces

The name of the measurement service to use with signals, states, and internal data elements, specified as a character vector or string scalar. If the signals, states, and internal data elements do not need to be measured, this property has the default value,"Not measured".

Since R2025a

Option to store internal states and data store data in nonvolatile memory in the target environment. Specified as a logical false ortrue.

When IsPersistent is true, only storage classes with DataInit set to None are supported.

Storage class definition, specified as one of the definitions in theStorageClasses section of the dictionary.

Only storage classes with DataInit set toNone are available for service interfaces that specify persistent data.

Methods

expand all

get Get value of code definition property
set Set value of code definition property
getAvailableProperties Return properties for code definition
isDictionaryDefault Determine if entry is default code definition for a category
deleteEntry Delete Embedded Coder Dictionary entry
valid Determine if coder.dictionary.Entry object represents a valid code definition

Examples

collapse all

Open the model RollAxisAutopilot and represent the Embedded Coder Dictionary by using the coder.Dictionary objectcoderDictionary. Use this object to access the Storage Classes section of the dictionary, which contains the storage class definitions.

openExample("RollAxisAutopilot") coderDictionary = coder.dictionary.open("RollAxisAutopilot");

Create a coder.dictionary.Section object that represents the Storage Classes section of the Embedded Coder Dictionary.

storageClassesSect = getSection(coderDictionary, "StorageClasses");

Add a definition named MyStorageClass to the Storage Classes section. The storage class definition uses the default property settings. You can change these settings by using the set function.

newEntry = addEntry(storageClassesSect,"MyStorageClass")

newEntry =

Entry with properties:

      Name: 'MyStorageClass'
DataSource: 'RollAxisAutopilot'

Version History

Introduced in R2019b

expand all

Specify a measurement service interface for persistent data to support state and data store data that is stored in nonvolatile memory in the target environment.

To specify persistent data, use the service interface PermanentRAM in the MeasurementInterfaces section of the coder dictionary. Alternatively, you can define a new service interface in the MeasurementInterfaces section, where you set property IsPersistent to true for the service and you specify a storage class that has DataInit set to None. A new storage class called PersistentMemory is provided in the StorageClasses section of the coder dictionary.

You can now specify "Not measured" as the default value of theMeasurementInterfaces section in the coder dictionary, and you can specify "Not tunable" as the default value of theParameterTuningInterfaces andParameterArgumentTuningInterfaces sections in the dictionary. The"Not measured" and "Not tunable" entries are included in the dictionary, and are preselected as default values in newly created dictionaries. You can select other entries as dictionary default for these sections, but you cannot delete these entries from the dictionary.

Access the coder.dictionary.Entry objects for Embedded Coder Dictionaries that use the service interface configuration. You can still access the entry objects for Embedded Coder Dictionaries that use the data interface configuration.