www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/mbcloadrecorder.m

    function out = mbcloadrecorder(action)
%MBCLOADRECORDER  Load-time action recorder
%
%  hAct = mbcloadrecorder('new')
%  hAct = mbcloadrecorder('currentaction')
%  hReq = mbcloadrecorder('currentrequest')
%  mbcloadrecorder('clear')
%
%  hAct is an mbcfoundation.actionlist which is kept persistent within this
%  function so that loadobj routines can access it and register post-load
%  operations to be run.
%
%  hReq is an mbcfoundation.requestcounter which is kept persistent within
%  this function so that loadobj routines can access it and register
%  requests for load-actions that are needed at the project level.

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


persistent hRecord hRequests

switch action
    case 'new'
        hRecord = mbcfoundation.actionlist;
        hRequests = mbcfoundation.requestcounter;
        out = hRecord;
    case {'current', 'currentaction'}
        if isempty(hRecord)
            hRecord = mbcfoundation.actionlist;
        end
        out = hRecord;
    case 'currentrequest'
        if isempty(hRequests)
            hRequests = mbcfoundation.requestcounter;
        end
        out = hRequests;
    case 'clear'
        clear hRecord hRequests
        out = [];
end