view m-toolbox/classes/@plist/copy.m @ 35:4be5f7a5316f database-connection-manager

Suppress output messages on preferences loading and saving
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% COPY makes a (deep) copy of the input plist objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: COPY makes a deep copy of the input plist objects.
%
% CALL:        b = copy(a, flag)
%
% INPUTS:      a    - input plist object
%              flag - true: make a deep copy, false: return copies of handles
%
% OUTPUTS:     b - copy of inputs
%
%
% VERSION:     $Id: copy.m,v 1.18 2011/05/23 20:41:12 mauro Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = copy(old, deepcopy)
  
  if deepcopy
    % Loop over input plist objects
    new = plist.newarray(size(old));
    obj = copy@ltpda_uo(new, old, true);
    
    for kk = 1:numel(old)
      if ~isempty(old(kk).params)
        obj(kk).params  = copy(old(kk).params, true);
      end
    end
  else
    obj = old;
  end
  
  varargout{1} = obj;
end