classdef (Hidden = true) CIAdaptor < rtw.connectivity.InterfaceAdaptor
% CIAdaptor - Adaptor class from coder.descriptor.ComponentInterface to
% RTW.ComponentInterface
%
%   This is an undocumented class. Its methods and properties are likely to
%   change without warning from one release to the next.

%   Copyright 2018-2020 The MathWorks, Inc.
      
   methods(Access = public)
       function this = CIAdaptor(aComponentInterface)
           
           assert(isa(aComponentInterface, 'coder.descriptor.ComponentInterface'), ...
               'Unexpected class in CIAdaptor');
           this.CodeDescObj = aComponentInterface;
           this.populateAdaptor;
       end    
   end
   
   methods(Access = protected)
       function populateAdaptor(this)
           % use function interface adapters to make custom Getters
           % available for the function interface properties
           this.populateFunctionsArray('InitializeFunctions', this.CodeDescObj);
           this.populateFunctionsArray('OutputFunctions', this.CodeDescObj);
           this.populateFunctionsArray('TerminateFunctions', this.CodeDescObj);
           this.populateFunctionsArray('UpdateFunctions', this.CodeDescObj);
           this.populateFunctionsArray('EnableFunction', this.CodeDescObj);
           this.populateFunctionsArray('DisableFunction', this.CodeDescObj);
           this.populateFunctionsArray('ServerCallPoints', this.CodeDescObj);
           
           this.AllocationFunction = this.createFunctionInterfaceAdaptor(...
               this.CodeDescObj.AllocationFunction);
           
           this.ConstructorFunction = this.createFunctionInterfaceAdaptor(...
               this.CodeDescObj.ConstructorFunction);
           
           this.SystemResetFunction = this.createFunctionInterfaceAdaptor(...
               this.CodeDescObj.SystemResetFunction);
           
           this.InitConditionsFunction = this.createFunctionInterfaceAdaptor(...
               this.CodeDescObj.InitConditionsFunction);
           
           this.DerivativeFunction = this.createFunctionInterfaceAdaptor(...
               this.CodeDescObj.DerivativeFunction);
           
           this.SystemInitializeFunction = this.createFunctionInterfaceAdaptor(...
               this.CodeDescObj.SystemInitializeFunction);
           
           this.SetupRuntimeResourcesFunction = this.createFunctionInterfaceAdaptor(...
               this.CodeDescObj.SetupRuntimeResourcesFunction);
       
           this.CleanupRuntimeResourcesFunction = this.createFunctionInterfaceAdaptor(...
               this.CodeDescObj.CleanupRuntimeResourcesFunction);
            
           this.SymbolicDimensionDefinitions = rtw.connectivity.SymbolicDimensionInfoAdaptor.empty;
           for i = 1:this.CodeDescObj.SymbolicDimensionDefinitions.Size
               this.SymbolicDimensionDefinitions(end+1) = ...
                   rtw.connectivity.SymbolicDimensionInfoAdaptor(this.CodeDescObj.SymbolicDimensionDefinitions(i));
           end
       end
       
       function prop = getProp(this, propName)
           % access the property on the ComponentInterface
           prop = this.CodeDescObj.(propName);
       end
   end
   
end
