view m-toolbox/classes/@ltpda_uo/copy.m @ 40:977eb37f31cb database-connection-manager

User friendlier errors from utils.mysql.connect
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 18:04:03 +0100
parents f0afece42f48
children
line wrap: on
line source

% COPY copies all fields of the ltpda_uo class to the new object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: COPY copies all fields of the ltpda_uo class to the new
%              object.
%
% CALL:        b = copy(new, old, flag)
%
% INPUTS:      new  - new object which should be created in the sub class.
%              old  - old object
%              flag - 1: make a deep copy, 0: return copies of handles
%
% OUTPUTS:     b - copy of inputs
%
% VERSION:     $Id: copy.m,v 1.7 2011/03/24 19:48:39 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = copy(new, old, deepcopy)
  
  if deepcopy
%     new = copy@ltpda_obj(new, old, 1);
    
    for kk = 1:numel(new)
      %%% copy all fields of the ltpda_uo class
      new(kk).name        = old(kk).name;
      new(kk).description = old(kk).description;
      new(kk).mdlfile     = old(kk).mdlfile;
      if ~isempty(old(kk).UUID)
        new(kk).UUID        = old(kk).UUID;
      end
    end
    
  else
    new = old;
  end
  
  varargout{1} = new;
end