www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@cgtabgradconstraint/private/pWorkingStoreContainer.m

    function fHdls = pWorkingStoreContainer
%PWORKINGSTORECONTAINER Container for the working store
%
%   FHDLS = PWORKINGSTORECONTAINER contains the working store data. This
%   function returns handles to functions that allow working store data to
%   be retrieved and written to.
%
%   See also PGETWORKINGSTORE

%   Copyright 2007 The MathWorks, Inc.

% Create the working store cache
WorkingStore = i_initWorkingStore;

% Functions that access and set the working store
fHdls.getAxisValues = @getAxisValues;
fHdls.getSurfaceGenData = @getSurfaceGenData;
fHdls.getDiffOpAndBound = @getDiffOpAndBound;
fHdls.setWorkingStore = @setWorkingStore;
fHdls.getWorkingStore = @getWorkingStore;
fHdls.resetWorkingStore = @resetWorkingStore;

    function AxisValues = getAxisValues
        AxisValues = WorkingStore.AxisValues;
    end

    function SurfaceGenData = getSurfaceGenData
        SurfaceGenData = WorkingStore.SurfaceGenData;
    end

    function DiffOpAndBound = getDiffOpAndBound
        DiffOpAndBound = WorkingStore.DiffOpAndBound;
    end

    function setWorkingStore(NewWorkingStore)
        WorkingStore = NewWorkingStore;
    end

    function AllWorkingStore = getWorkingStore
        AllWorkingStore = WorkingStore;
    end

    function resetWorkingStore
        WorkingStore = i_initWorkingStore;
    end
end

%--------------------------------------------------------------------------
function InitWorkingStore = i_initWorkingStore
%--------------------------------------------------------------------------

DiffStruct = struct('D', [], 'g', [], 'idxReq', [], 'idxCon', []);
AxisStruct = struct('AxisValues', [], 'ISEDGE', false);
InitWorkingStore = struct('AxisValues', AxisStruct, ...
    'SurfaceGenData', {{}}, ...
    'DiffOpAndBound', DiffStruct);

end