Access C API Model Maps
Two C API maps serve as the gateway to using the generated C API code. These are structure containers through which you access C API elements.
The main map serves as a gateway for obtaining real-time information about model elements.
The static model map serves a gateway for obtaining metadata about model elements.
Obtain Access to C API Maps Example
This is an example C language function that accesses the model information maps. The example shows how to use the direct data structures access, and how to use the predefined get-functions and macros.
The example code is also provided as standalone code (see Standalone C Code for Accessing C API Maps Example) so that you can copy it more easily.
C Code for Accessing C API Maps Example
Description | Sample C Code with Direct Data Structure Access | Sample C Code with Macros and Get-Functions |
---|---|---|
Include the generated model header so you can access the real-time model object and the get-functions used to access the maps. |
|
|
Declare the variables to use for storing the map objects. |
|
|
Obtain pointers to the main and static C API maps. |
|
|
Print a notification announcing you obtained the maps. |
|
|
Here is a schematic illustration of the map structure that is accessed by the code in the example: