classdef MATLABPILDataHandler < coder.connectivity.PILDataHandler
% MATLABPILDataHandler provides access to get/set the SILPILInterface for 
% the MATLABCoder workflow
%
%   This is an undocumented class. Its methods and properties are
%   likely to change without warning from one release to the next.

%   Copyright 2019-2021 The MathWorks, Inc.

    properties(Access = private)
        SILPILInterfaceStore; % Do not default initialize, default 
                              % properties are initialized only once when
                              % the class is loaded in memory for the first
                              % time.
    end
    
    methods(Access = public)
        function this = MATLABPILDataHandler()
            % get an instance of the store
            this.SILPILInterfaceStore = ...
                coder.connectivity.MATLABSILPILInterfaceStore.getInstance();
        end
        
        function removeCachedPILData(this, fcnName)
            % removed cached data from the store
            this.SILPILInterfaceStore.removeSILPILInterface(fcnName);
        end
    end

    methods(Access = protected)
        function pilData = getPILDataImplementation(this, fcnName)
            pilData = this.SILPILInterfaceStore.getSILPILInterface(fcnName);
        end
        
        function setPILDataImplementation(this, fcnName, data)
            this.SILPILInterfaceStore.StoreSILPILInterface(fcnName, data);
        end
    end
end
