view m-toolbox/classes/@ltpda_uoh/setProcinfo.m @ 38:3aef676a1b20 database-connection-manager

Keep backtrace on error
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Mon, 05 Dec 2011 16:20:06 +0100
parents f0afece42f48
children
line wrap: on
line source

% SETPROCINFO sets the 'procinfo' property of a ltpda_uoh object.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DESCRIPTION: SETPROCINFO sets the 'procinfo' property of a ltpda_uoh object.
%
% CALL:        objs.setProcinfo(val);
%              objs.setProcinfo(val1, val2);
%              objs.setProcinfo(plist('procinfo', val));
%              objs = objs.setProcinfo(val);
%
% INPUTS:      objs: Any shape of ltpda_uoh objects
%              val:
%                 1. Single PLIST e.g.
%                      Each object in objs get this value.
%                 2. Single PLIST in a cell-array
%                      Each objects in objs get this value.
%                 3. cell-array with the same number of PLISTSs as in objs
%                    e.g. {pl1, pl2, pl3} and 3 objects in objs
%                      Each object in objs get its corresponding value from the
%                      cell-array
%
% <a href="matlab:utils.helper.displayMethodInfo('ltpda_uoh', 'setProcinfo')">Parameters Description</a>
%
% VERSION:     $Id: setProcinfo.m,v 1.13 2011/09/17 03:25:37 hewitson Exp $
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function varargout = setProcinfo(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, ...
    'procinfo', ...
    @setterFcn, ...
    nargout, ...
    @getInfo);
  
  % set outputs
  varargout = utils.helper.setoutputs(nargout, objects);
  
end

% Setter function to set the plotinfo
function value = setterFcn(varargin)
  
  obj = varargin{1};
  pls = varargin{2};
  if nargin == 2
    value = copy(pls,1);
    pls.remove(1:pls.nparams);
  end
  if nargin == 3
    value = varargin{3};
  end
  
  obj.procinfo = value;
  
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: setProcinfo.m,v 1.13 2011/09/17 03:25:37 hewitson Exp $', sets, pl);
end

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

function pl = buildplist()
  pl = plist({'procinfo', 'A plist with additional information of an object.'}, {1, {plist}, paramValue.OPTIONAL});
end