Home > classes > @mfir > copy.m

copy

PURPOSE ^

COPY Make copy of mfir objects depending of the second input

SYNOPSIS ^

function varargout = copy(varargin)

DESCRIPTION ^

 COPY Make copy of mfir objects depending of the second input
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: COPY Make copy of mfir objects depending of the second input

 CALL:        objs = copy(objs, [1,0]);

 M-FILE INFO: Get information about this methods by calling
              >> mfir.getInfo('copy')

 VERSION:     $Id: copy.m,v 1.6 2008/08/10 20:06:46 hewitson Exp $

 HISTORY:     11-07-2008 Diepholz
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % COPY Make copy of mfir objects depending of the second input
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: COPY Make copy of mfir 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 %              >> mfir.getInfo('copy')
0010 %
0011 % VERSION:     $Id: copy.m,v 1.6 2008/08/10 20:06:46 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 mfir objects
0027   old = utils.helper.collect_objects(varargin(:), 'mfir');
0028   deepcopy = varargin{end};
0029 
0030   if deepcopy
0031     t0   = time;
0032     prov = provenance;
0033     s    = size(old);
0034     obj(s(1),s(2)) = mfir;
0035     for kk=1:numel(old)
0036       utils.helper.msg(utils.const.msg.OPROC2, 'copying %s', old(kk).name);
0037       obj(kk).gd      = old(kk).gd;
0038       obj(kk).fs      = old(kk).fs;
0039       obj(kk).infile  = old(kk).infile;
0040       obj(kk).a       = old(kk).a;
0041       obj(kk).histout = old(kk).histout;
0042       obj(kk).hist    = old(kk).hist;
0043       obj(kk).name    = old(kk).name;
0044       % reset on copy
0045       obj(kk).created = t0;
0046       obj(kk).creator = prov;
0047       obj(kk).version = mfir.VEROUT;
0048     end
0049   else
0050     obj = old;
0051   end
0052   varargout{1} = obj;
0053 end
0054 
0055 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0056 %                               Local Functions                               %
0057 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0058 
0059 function ii = getInfo(varargin)
0060   if nargin == 1 && strcmpi(varargin{1}, 'None')
0061     sets = {};
0062     pl   = [];
0063   else
0064     sets = {'Default'};
0065     pl   = getDefaultPlist;
0066   end
0067   % Build info object
0068   ii = minfo(mfilename, 'mfir', '', 'Internal', '$Id: copy.m,v 1.6 2008/08/10 20:06:46 hewitson Exp $', sets, pl);
0069 end
0070 
0071 function plo = getDefaultPlist()
0072   plo = plist();
0073 end
0074

Generated on Mon 25-Aug-2008 22:39:29 by m2html © 2003