% SETMDLFILE sets the 'mdlfile' property of a ltpda_uoh object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: SETMDLFILE sets the 'mdlfile' property of a ltpda_uoh object.
%
% CALL:        objs.setMdlfile(val);
%              objs.setMdlfile(val1, val2);
%              objs.setMdlfile(plist('mdlfile', val));
%              objs = objs.setMdlfile(val);
%
% INPUTS:      objs: Can be a vector, matrix, list, or a mix of them.
%              val:
%                 1. Single string e.g. 'Some text'
%                      Each AO in objs get this value.
%                 2. Single string in a cell-array e.g. {'Some text'}
%                      Each AO in objs get this value.
%                 3. cell-array with the same number of strings as in objs
%                    e.g. {'a text', 'a different text', 'another text'}
%                    and 3 AOs in objs. Each AO in objs get its
%                    corresponding value from the cell-array
%
% <a href="matlab:utils.helper.displayMethodInfo('ao', 'setMdlfile')">Parameters Description</a>
%
% VERSION:     $Id: setMdlfile.m,v 1.8 2011/09/16 05:00:38 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = setMdlfile(varargin)
  
  % Check if this is a call from a class method
  callerIsMethod = utils.helper.callerIsMethod;
  
  if callerIsMethod
    in_names = {};
  else    
    % Collect input variable names
    in_names = cell(size(varargin));
    for ii = 1:nargin,in_names{ii} = inputname(ii);end
  end
  
  objects = setPropertyValue(...
    varargin{:}, ...
    in_names, ...
    callerIsMethod, ...
    'mdlfile', ...
    [], ...
    nargout, ...
    @getInfo);
  
  % set outputs
  varargout = utils.helper.setoutputs(nargout, objects);
  
end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                               Local Functions                               %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%--------------------------------------------------------------------------
% Get Info Object
%--------------------------------------------------------------------------
function ii = getInfo(varargin)
  
  if nargin == 1 && strcmpi(varargin{1}, 'None')
    sets = {};
    pl   = [];
  else
    sets = {'Default'};
    pl   = getDefaultPlist;
  end
  % Build info object
  ii = minfo(mfilename, mfilename('class'), 'ltpda', utils.const.categories.helper, '$Id: setMdlfile.m,v 1.8 2011/09/16 05:00:38 hewitson Exp $', sets, pl);
end

%--------------------------------------------------------------------------
% Get Default Plist
%--------------------------------------------------------------------------
function plout = getDefaultPlist()
  persistent pl;
  if exist('pl', 'var')==0 || isempty(pl)
    pl = buildplist();
  end
  plout = pl;
end

function pl = buildplist()
  pl = plist({'mdlfile', 'The contents of a pipeline to attach.'}, paramValue.EMPTY_STRING);
end
