classdef (Hidden = true) AtomicSubsystemCodeInterfaceFactory < rtw.pil.CodeInterfaceFactory
    %ATOMICSUBSYSTEMCODEINTERFACEFACTORY Factory for SIL/PIL atomic 
    % subsystem interface objects
    %
    %   This is an undocumented class. Its methods and properties are likely to
    %   change without warning from one release to the next.
    
    %   Copyright 2020-2021 The MathWorks, Inc.
    
    methods
        
        function this = AtomicSubsystemCodeInterfaceFactory(isAutosar)
            this.IsAutosar = isAutosar;
        end
        
        function codeInfoUtils = createCodeInfoUtils(this, ...
                codeInfoPath, clientInterface, configInterface, componentName, runValidation)
            
            if this.IsAutosar
                strategy = coder.internal.connectivity.AutosarSubsystemCodeDescriptorStrategy();
            else
                strategy = coder.internal.connectivity.CodeDescriptorStrategy();
            end
            codeInfoUtils = coder.connectivity.AtomicSubsystemCodeDescriptorUtils(...
                codeInfoPath, clientInterface, configInterface, componentName, ...
                runValidation, 'CodeDescriptorStrategy', strategy);
        end
        
        function silPILWrapperUtils = createSILPILWrapperUtils(~, ...
                                                        silPILInterface, ...
                                                        infoStruct, ...
                                                        clientInterface,...
                                                        topModelOriginalParams, ...
                                                        lXilCompInfo)
            silPILWrapperUtils = rtw.pil.AtomicSubsystemSILPILWrapperUtils(...
                                                             silPILInterface, ...
                                                             infoStruct, ...
                                                             clientInterface, ...
                                                             topModelOriginalParams, ...
                                                             lXilCompInfo);
        end
        
        function hostSfun = createHostSfunction(~, ...
                                                silPILWrapperUtils, ...
                                                sfunSourcePath, ...
                                                sfunBinDir)             
            hostSfun = rtw.pil.SubsystemSfunction(silPILWrapperUtils, ....
                                                 sfunSourcePath, ...
                                                 sfunBinDir);              
        end
        
        function targetInterface = createTargetInterface(this, ...
                                                         silPILWrapperUtils, ...
                                                         pilInterfaceTarget)
            if this.IsAutosar
                strategy = coder.internal.connectivity.AutosarInterfaceStrategy(silPILWrapperUtils);
            else
                strategy = coder.internal.connectivity.TargetInterfaceStrategy(silPILWrapperUtils);
            end
            targetInterface = rtw.pil.AtomicSubsystemTargetInterface(...
                silPILWrapperUtils, pilInterfaceTarget, 'InterfaceStrategy', strategy);
        end
    end
end
