classdef (Hidden = true) SILPILBlockInterfaceArtifacts < coder.connectivity.ComponentAndSubComponentArtifactsWithMarker
%SILPILBLOCKINTERFACEARTIFACTS Implements 
% ComponentInterfaceArtifacts for SIL/PIL Block builds
%
%   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 (Access = public) 
        function modelName = getRootModel(this)
            if this.isSubsystemBuild()
                % for subsystem SIL/PIL Block the root model is the temp
                % model created to generated code for the subsystem
                componentPath = this.InfoStruct.SourceSubsystemName; 
                modelName = strtok(componentPath, '/');
            else      
                % use super class method
                modelName = getRootModel@coder.connectivity.ComponentAndSubComponentArtifactsWithMarker(this);
            end
        end
        
        function componentPath = getFullComponentPath(this)
            if this.isSubsystemBuild()
                componentPath = this.getInfoStruct.SourceSubsystemName;
                % handle new lines, which are equivalent to spaces
                % no need to escape /'s; this is already done in ss2mdl / binfo
                componentPath = strrep(componentPath, newline, ' ');
            else
                componentPath = getFullComponentPath@coder.connectivity.ComponentAndSubComponentArtifactsWithMarker(this);
            end
        end
    end
    
    methods (Access = private)
        function isSubsystemBuild = isSubsystemBuild(this)
            % is a subsystem SIL/PIL Block build
            isSubsystemBuild = ~isempty(this.InfoStruct.SourceSubsystemName);
        end
    end
end