Home > classes > @ao > tag.m

tag

PURPOSE ^

TAG each input AO with a proper ID number.

SYNOPSIS ^

function bs = tag(as, mymid)

DESCRIPTION ^

 TAG each input AO with a proper ID number.

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

 DESCRIPTION: TAG each input AO with a proper ID number.
              For each input AO, a new ID Tag is retrieved from the
              MySQL database and set in the AO. This is necessary before an AO
              can be submitted to the database.

 CALL:        aout = tag(ain, mysqlid)

 VERSION:     $Id: tag.html,v 1.2 2007/07/10 05:37:08 hewitson Exp $

              The following call returns a parameter list object that
              contains the default parameter values:

              >> pl = tag(ao, 'Params')

 HISTORY: 09-05-07 M Hewitson
             Creation

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

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function bs = tag(as, mymid)
0002 % TAG each input AO with a proper ID number.
0003 %
0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0005 %
0006 % DESCRIPTION: TAG each input AO with a proper ID number.
0007 %              For each input AO, a new ID Tag is retrieved from the
0008 %              MySQL database and set in the AO. This is necessary before an AO
0009 %              can be submitted to the database.
0010 %
0011 % CALL:        aout = tag(ain, mysqlid)
0012 %
0013 % VERSION:     $Id: tag.html,v 1.2 2007/07/10 05:37:08 hewitson Exp $
0014 %
0015 %              The following call returns a parameter list object that
0016 %              contains the default parameter values:
0017 %
0018 %              >> pl = tag(ao, 'Params')
0019 %
0020 % HISTORY: 09-05-07 M Hewitson
0021 %             Creation
0022 %
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 
0025 % Check if this is a call for parameters
0026 if nargin == 2
0027   if isa(as, 'ao') && ischar(mymid)
0028     in = char(mymid);
0029     if strcmp(in, 'Params')
0030       bs = getDefaultPL();
0031       return
0032     end
0033   end
0034 end
0035 
0036 %--------------------------------------------------------------------------
0037 % collect all AOs from input
0038 % as = [];
0039 % varargin
0040 % length(varargin)
0041 % for j=1:length(varargin)
0042 %   a = varargin{j};
0043 %   if isa(a, 'ao')
0044 %     as = [as a];
0045 %   end
0046 % end
0047 % if na < 1
0048 %   error('### Incorrect inputs: please supply at least one AO to submit.');
0049 % end
0050 
0051 na = length(as);
0052 
0053 %--------------------------------------------------------------------------
0054 % Now process each AO
0055 bs = [];
0056 for j=1:na
0057 
0058   a = as(j);
0059   disp(sprintf('** Taggin AO: %s', a.name));
0060 
0061   %----- complete all information in this AO
0062 
0063   % get current max AO Id from server
0064   aoid = 1+mysql_getMaxId(mymid);
0065   disp(sprintf('** Got AO Id: %06d', aoid));
0066 
0067   % set id
0068   a = set(a, 'tag', aoid);
0069   bs = [bs a];
0070 end
0071 
0072 
0073 %--------------------------------------------------------------------------
0074 % Get default params
0075 function plo = getDefaultPL()
0076 
0077 disp('* creating default plist...');
0078 plo = plist();
0079 disp('* done.');
0080 
0081 
0082 % END

Generated on Wed 04-Jul-2007 19:03:10 by m2html © 2003