www.gusucode.com > mbcdata 工具箱 matlab 源码程序 > mbcdata/@calibrationdata/@singletonmanager/singletonmanager.m

    function obj = singletonmanager
%SINGLETONMANAGER  Class to manage singleton classes.
%
%  SM = SINGLETONMANAGER

%  Copyright 2004-2005 The MathWorks, Inc.


% Persistent object to hold the one and only copy of the manager
persistent this;

% Make sure that it is correctly initialized
if isempty(this)
    this = calibrationdata.singletonmanager;
    % Register this class as managed; this has the additional benefit of
    % ensuring that SingletonInstancesByClass is never empty so there
    % aren't problems with .find
    this.SingletonInstancesByClass = this;
    this.Version = 1;
end

% Return the one instance
obj = this;