view m-toolbox/classes/@ltpda_uoh/copy.m @ 51:9d5c88356247 database-connection-manager

Make unit tests database connection parameters configurable
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 07 Dec 2011 17:24:37 +0100
parents f0afece42f48
children
line wrap: on
line source

% COPY copies all fields of the ltpda_uoh class to the new object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: COPY copies all fields of the ltpda_uoh 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.4 2010/06/24 14:17:32 ingo Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = copy(new, old, deepcopy)
  
  if deepcopy
    obj = copy@ltpda_uo(new, old, 1);
    
    for kk = 1:numel(obj)
      %%% copy all fields of the ltpda_uoh class
      obj(kk).hist        = old(kk).hist;
      if ~isempty(old(kk).procinfo)
        obj(kk).procinfo = copy(old(kk).procinfo,1);
      end
      if ~isempty(old(kk).plotinfo)
        obj(kk).plotinfo = copy(old(kk).plotinfo,1);
      end
    end
    
  else
    obj = old;
  end
  
  varargout{1} = obj;
end