www.gusucode.com > mbc 工具箱 matlab 源码程序 > mbc/@mbcmodel/@data/pInitialise.m

    function pInitialise(D, pData, owner)
%PINITIALISE Private function.
%
%  PINITIALISE(OBJ, DATA, OWNER)
%  

%   Copyright 2004-2005 The MathWorks, Inc.

if isa(pData, 'sweepsetfilter')
    D.super(mfilename('fullpath'), xregpointer(pData));
elseif isa(pData, 'xregpointer') && isa(pData.info, 'sweepsetfilter')
    D.super(mfilename('fullpath'), pData);
else
    error(message('mbc:mbcmodel:data:InvalidArgument7'));
end
% Set the internal state behaviour of the data - Owner being empty
% indicates that we own the pointer and will release it when we are
% destroyed.
D.Owner = owner;
% Add Pre and Post SetFunctions to IsBeingEdited
D.addPropertyListeners('IsBeingEdited', @i_postSetIsBeingEdited, 'PropertyPostSet');
D.addPropertyListeners('IsBeingEdited', @i_preSetIsBeingEdited, 'PropertyPreSet');

% ------------------------------------------------------------------------------
%
% ------------------------------------------------------------------------------
function i_postSetIsBeingEdited(D, event)
% Make sure that the internal .Object field is up-to-date if the object is
% being edited - If the pointer is null do nothing
if D.IsBeingEdited && D.isNotNull
    D.Object = info(D.pGetPointerInstance);
end

% ------------------------------------------------------------------------------
%
% ------------------------------------------------------------------------------
function i_preSetIsBeingEdited(D, event)
% Make sure that the internal D.Object field is cleared after an editing
% session - but only if there is a pointer backing the .Object field
if D.IsBeingEdited && D.isNotNull
    D.Object = [];
end