view m-toolbox/classes/@plist/copy.m @ 1:2014ba5b353a database-connection-manager

Remove old code
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Sat, 03 Dec 2011 18:13:55 +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