Home > classes > @ao > md5.m

md5

PURPOSE ^

MD5 computes an MD5 checksum from an analysis objects.

SYNOPSIS ^

function varargout = md5(varargin)

DESCRIPTION ^

 MD5 computes an MD5 checksum from an analysis objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: MD5 computes an MD5 checksum from an analysis objects.

 CALL:        h = md5(a)

 INPUTS:      a - input analysis object

 OUTPUTS:     h - md5 hash

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

              Get information about a specified set-plist by calling:
              >> ao.getInfo('md5', 'None')

 VERSION:     $Id: md5.m,v 1.12 2008/09/05 11:05:29 ingo Exp $

 HISTORY:     15-09-2007 M Hewitson
                 Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % MD5 computes an MD5 checksum from an analysis objects.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: MD5 computes an MD5 checksum from an analysis objects.
0005 %
0006 % CALL:        h = md5(a)
0007 %
0008 % INPUTS:      a - input analysis object
0009 %
0010 % OUTPUTS:     h - md5 hash
0011 %
0012 % M-FILE INFO: Get information about this methods by calling
0013 %              >> ao.getInfo('md5')
0014 %
0015 %              Get information about a specified set-plist by calling:
0016 %              >> ao.getInfo('md5', 'None')
0017 %
0018 % VERSION:     $Id: md5.m,v 1.12 2008/09/05 11:05:29 ingo Exp $
0019 %
0020 % HISTORY:     15-09-2007 M Hewitson
0021 %                 Creation
0022 %
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 
0025 function varargout = md5(varargin)
0026 
0027   % Check if this is a call for parameters
0028   if utils.helper.isinfocall(varargin{:})
0029     varargout{1} = getInfo(varargin{3});
0030     return
0031   end
0032 
0033   import utils.const.*
0034   utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename);
0035   
0036   % Collect input variable names
0037   in_names = cell(size(varargin));
0038   for ii = 1:nargin,in_names{ii} = inputname(ii);end
0039 
0040   % Collect all AOs and plists
0041   as = utils.helper.collect_objects(varargin(:), 'ao', in_names);
0042 
0043   h = {};
0044   for ii = 1:numel(as)
0045 
0046     %%%%%%%%%%% Convert object to XML
0047     % make pointer to xml document
0048     xml = com.mathworks.xml.XMLUtils.createDocument('ltpda_object');
0049     % extract parent node
0050     parent = xml.getDocumentElement;
0051     % write obj into xml
0052     utils.helper.xmlwrite(as(ii), xml, parent, '');    % Save the XML document.
0053 
0054     h = [h cellstr(utils.prog.hash(xmlwrite(xml), 'MD5'))];
0055 
0056   end
0057 
0058   % Set outputs
0059   h = reshape(h, size(as));
0060   if numel(h) == 1
0061     varargout{1} = cell2mat(h);
0062   else
0063     varargout{1} = h;
0064   end
0065 end
0066 
0067 %--------------------------------------------------------------------------
0068 % Get Info Object
0069 %--------------------------------------------------------------------------
0070 function ii = getInfo(varargin)
0071   if nargin == 1 && strcmpi(varargin{1}, 'None')
0072     sets = {};
0073     pl   = [];
0074   else
0075     sets = {'Default'};
0076     pl   = getDefaultPlist;
0077   end
0078   % Build info object
0079   ii = minfo(mfilename, 'ao', '', utils.const.categories.helper, '$Id: md5.m,v 1.12 2008/09/05 11:05:29 ingo Exp $', sets, pl);
0080 end
0081 
0082 %--------------------------------------------------------------------------
0083 % Get Default Plist
0084 %--------------------------------------------------------------------------
0085 function pl = getDefaultPlist()
0086   pl = plist();
0087 end
0088

Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003