


COPY Make copy of plist objects depending of the second input
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
DESCRIPTION: COPY Make copy of plist objects depending of the second input
CALL: objs = copy(objs, [1,0]);
M-FILE INFO: Get information about this methods by calling
>> plist.getInfo('copy')
VERSION: $Id: copy.m,v 1.6 2008/08/10 20:06:47 hewitson Exp $
HISTORY: 11-07-2008 Diepholz
Creation
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


0001 % COPY Make copy of plist objects depending of the second input 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: COPY Make copy of plist objects depending of the second input 0005 % 0006 % CALL: objs = copy(objs, [1,0]); 0007 % 0008 % M-FILE INFO: Get information about this methods by calling 0009 % >> plist.getInfo('copy') 0010 % 0011 % VERSION: $Id: copy.m,v 1.6 2008/08/10 20:06:47 hewitson Exp $ 0012 % 0013 % HISTORY: 11-07-2008 Diepholz 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 function varargout = copy(varargin) 0019 0020 %%% Check if this is a call for parameters 0021 if utils.helper.isinfocall(varargin{:}) 0022 varargout{1} = getInfo(varargin{3}); 0023 return 0024 end 0025 0026 % Collect all plist objects 0027 old = utils.helper.collect_objects(varargin(:), 'plist'); 0028 deepcopy = varargin{end}; 0029 0030 if deepcopy 0031 % Reset these values on copy 0032 prov = provenance; 0033 t0 = time; 0034 s = size(old); 0035 obj(s(1),s(2)) = plist; 0036 for kk=1:numel(old) 0037 utils.helper.msg(utils.const.msg.OPROC2, 'copying %s', old(kk).name); 0038 if ~isempty(old(kk).params) 0039 obj(kk).params = copy(old(kk).params, 1); 0040 end 0041 obj(kk).name = old(kk).name; 0042 obj(kk).created = t0; 0043 obj(kk).creator = prov; 0044 obj(kk).version = plist.VEROUT; 0045 end 0046 else 0047 obj = old; 0048 end 0049 varargout{1} = obj; 0050 end 0051 0052 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0053 % Local Functions % 0054 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0055 0056 function ii = getInfo(varargin) 0057 if nargin == 1 && strcmpi(varargin{1}, 'None') 0058 sets = {}; 0059 pl = []; 0060 else 0061 sets = {'Default'}; 0062 pl = getDefaultPlist; 0063 end 0064 % Build info object 0065 ii = minfo(mfilename, 'plist', '', 'Internal', '$Id: copy.m,v 1.6 2008/08/10 20:06:47 hewitson Exp $', sets, pl); 0066 end 0067 0068 function plo = getDefaultPlist() 0069 plo = plist(); 0070 end 0071