%%============================================================================
%%
%%
%%
%%
%%Abstract:
%%Themapfilecontainsthemappinginformationformonitoringblock
%%outputsandmodifyingblockparameters.
%%
%%Copyright1994-2019TheMathWorks,Inc.
%%
%selectfile NULL_FILE
 
%if EXISTS("_MRTMAP_") == 0
%assign _MRTMAP_ = 1
 
%realformat "CONCISE"
 
%if RTWVerbose
%selectfile STDOUT
### Creating data type transition file %<Name>_reg_dt.h
%selectfile NULL_FILE
%endif
 
%openfile ModelDotDT = "%<Name>_reg_dt.h"
/*
 * %<Name>_reg_dt.h
 *
 */
 
%assign numDataTypes = LibGetNumDataTypesInModel()
%%
%%Dynamicmemoryallocation(run-timeinstance)
%%
{
  DataTypeTransInfo *dtInfo;
 
  %if numDataTypes > 0
    uint_T *DataTypeSizes;
    const char_T **DataTypeNames;
  %endif
   
  %if !SLibBlockIODataTypeTransitionTableIsEmpty()
    DataTypeTransition *BTransitions;
    DataTypeTransitionTable *BTransTable;
    %with ::CompiledModel.GlobalMemoryMap
      %if !ISEMPTY(SLibGetMapStructData("signal"))
        %if ::CompiledModel.HasSimStructVars == 0
          %openfile definition
          %<::tBlockIOType> *%<LibGetBlockIOStruct()> = (%<tBlockIOType> *) /
          %<RTMGet("BlockIO")>;/
          %closefile definition
          %% Not needed for AUTOSAR Compiler Abstraction support
          %<SLibApplyMemSecToDataDefn(definition, ...
            "MemSecDataInternal", "%<LibGetBlockIOStruct()>")>/
        %endif
      %endif
      %if !ISEMPTY(SLibGetMapStructData("dwork"))
        %if ::CompiledModel.HasSimStructVars == 0
          %openfile definition
          %<::tDWorkType> *%<LibGetDWorkStruct()> = (%<tDWorkType> *) %<RTMGet("DWork")>;/
          %closefile definition
          %% Not needed for AUTOSAR Compiler Abstraction support
          %<SLibApplyMemSecToDataDefn(definition, ...
            "MemSecDataInternal", "%<LibGetDWorkStruct()>")>/
        %endif
      %endif
    %endwith
  %endif
 
  %if !SLibParametersDataTypeTransitionTableIsEmpty()
    DataTypeTransition *PTransitions;
    DataTypeTransitionTable *PTransTable;
  %endif
     
  %%
  %% Setup data type info
  %%
  /* structure to hold model's data type transition information */
  dtInfo = (DataTypeTransInfo *) malloc(sizeof(DataTypeTransInfo));
 
  %<RTMChkMemAndReturnIfErr("dtInfo")>;
 
  %if ::GenCPP == 0
    (void) %<LibGenMemFcnCall("memset", "(char_T *) dtInfo", "0", ...
      "sizeof(DataTypeTransInfo)")>;
  %elseif SLibIsRTMZeroInitCppEnabled()
    (void) %<LibGenMemFcnCall("memset", "(void *) dtInfo", "0", ...
      "sizeof(DataTypeTransInfo)")>;
  %endif
 
  dtInfo->numDataTypes = %<numDataTypes>;
 
  %<RTMSet("ModelMappingInfo", "dtInfo")>;
 
  %%
  %% Setup data types
  %%
  %if numDataTypes > 0
    /* data type sizes */
    DataTypeSizes = (uint_T *) malloc(%<numDataTypes> * sizeof(uint_T));
    %<RTMChkMemAndReturnIfErr("DataTypeSizes")>;
   
    dtInfo->dataTypeSizes = DataTypeSizes;
   
    %<SLibDumpDataTypeSizeTable()>/
 
    /* data type names */
    DataTypeNames = (const char_T **) ...
      malloc(%<numDataTypes> * sizeof(char_T *));
    %<RTMChkMemAndReturnIfErr("DataTypeNames")>;
   
    dtInfo->dataTypeNames = DataTypeNames;
   
    %<SLibDumpDataTypeNameTable()>/
  %endif
  %%
  %% Setup BlockIO
  %%
  %if !SLibBlockIODataTypeTransitionTableIsEmpty()
    %assign nTrans = SLibGetBlockIOMapNumDataSections()
   
    /* data type transitions for block I/O structure */
    BTransitions = (DataTypeTransition *)
    malloc(%<nTrans> * sizeof(DataTypeTransition));
 
    %<RTMChkMemAndReturnIfErr("BTransitions")>;
   
    %<SLibDumpBlockIODataTypeTransitionTable()>/
   
    /* data type transition table for block I/O structure */
    BTransTable = (DataTypeTransitionTable *)
    malloc(sizeof(DataTypeTransitionTable));
   
    %<RTMChkMemAndReturnIfErr("BTransTable")>;
   
    %<SLibDumpBlockIOMapInfo()>/
   
    /* attach block I/O transition table */
    dtInfo->BTransTable = BTransTable;
  %endif
  %%
  %% Setup Parameters
  %%
  %if !SLibParametersDataTypeTransitionTableIsEmpty()
    %assign nTrans = SLibGetParameterMapNumDataSections()
     
    /* data type transitions for parameters structure */
    PTransitions = (DataTypeTransition *)
    malloc(%<nTrans> * sizeof(DataTypeTransition));
     
    %<RTMChkMemAndReturnIfErr("PTransitions")>;
     
    %<SLibDumpParametersDataTypeTransitionTable()>/
     
    /* data type transition table for parameters structure */
    PTransTable = (DataTypeTransitionTable *)
    malloc(sizeof(DataTypeTransitionTable));
     
    %<RTMChkMemAndReturnIfErr("PTransTable")>;
     
    %<SLibDumpParametersMapInfo()>/
     
    /* attach parameters transition table */
    dtInfo->PTransTable = PTransTable;
  %endif
}
 
/* [EOF] %<Name>_reg_dt.h */
%closefile ModelDotDT
%<SLibAddGeneratedFileToList(Name + "_reg_dt.h","other","header","")>
%selectfile NULL_FILE
 
%endif %% _MRTMAP_
 
%%[EOF]mrtmap.tlc