classdef SimulinkCSFunctionInfo < rtw.pil.CSFunctionInfo
% SIMULINKCSFUNCTIONINFO
%
% Superclass for information used by SIL/PIL infrastructure for
% Simulink Function based operations.
%
% See also rtw.pil.ServerFunctionInfo and rtw.pil.CallerFunctionInfo

% Copyright 2018 The MathWorks, Inc.

properties (GetAccess = private, SetAccess = immutable)
SlFunctionInfo rtw.pil.SlFunctionInfoBase = rtw.pil.SlFunctionInfo.empty
end

properties (Constant)
IsSimulinkFunction = true;
end

properties (Dependent, SetAccess = private, GetAccess = protected)
ChildCallers;
end

properties (Dependent, SetAccess = private, GetAccess = public)
IsScoped;
FullPathToFunction;
RefBlockPaths;
end

methods (Access = public)
function this = SimulinkCSFunctionInfo(codeInfoData, operationName, RTMTypeIdentifier, slFunctionInfo, tid, isAUTOSAR, isLegacyAutosarOperation)

% Superclass constructor
this@rtw.pil.CSFunctionInfo(codeInfoData, operationName, RTMTypeIdentifier, tid, isAUTOSAR, isLegacyAutosarOperation)

this.SlFunctionInfo = slFunctionInfo;
end

function slFunctionName = getSlFunctionName(this)
slFunctionName = this.SlFunctionInfo.SlFunctionName;
end

% Override superclass
function isAUTOSAR = getIsAUTOSAR(this)
% A function caller that's only called in a child model is not
% treated as AUTOSAR, since what is essentially ERT code gets
% generated.
isAUTOSAR = getIsAUTOSAR@rtw.pil.CSFunctionInfo(this) && ...
~this.SlFunctionInfo.IsOnlyCalledInChildModel;
end

end

methods
function lChildCallers = get.ChildCallers(this)
lChildCallers = this.SlFunctionInfo.ChildCallers;
end

function lIsScoped = get.IsScoped(this)
lIsScoped = this.SlFunctionInfo.IsScoped;
end

function lPath = get.FullPathToFunction(this)
lPath = this.SlFunctionInfo.FullPathToSimulinkFunction;
end

function lRefBlockPaths = get.RefBlockPaths(this)
lRefBlockPaths = this.SlFunctionInfo.RefBlockPaths;
end
end
end