Mercurial > hg > ltpda
diff m-toolbox/test/template_test_models/ao_model_b.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/test/template_test_models/ao_model_b.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,144 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: Builtin model for B +% +% This model builds an AO with a number in it. +% +% +% CALL: +% p = ao(plist('built-in','b')) +% +% INPUTS: +% +% +% +% OUTPUTS: +% - p: an AO object representing a +% +% +% VERSIONS: +% 'alpha' = Reason: this version returns an AO with value 1 +% Who: Martin +% When: 06-09-10 +% 'beta' = Reason: this version returns an AO with value 2 +% Who: Martin +% When: 06-09-10 +% +% +% REFERENCES: +% +% +% VERSION: $Id: ao_model_b.m,v 1.3 2010/09/15 10:30:04 hewitson Exp $ +% +% HISTORY: +% +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function varargout = ao_model_b(varargin) + + % Process inputs + [info, pl, constructorInfo, fcn] = utils.models.processModelInputs(varargin(:), mfilename, @getModelDescription, @getModelDocumentation, @getVersion, @versionTable); + if ~isempty(info) + varargout{1} = info; + return; + end + + % Build the object + out = fcn(); + + % Set the method version string in the minfo object + if ~isempty(constructorInfo) + % If this is a user-call via a constructor, then we add history + out = addHistoryStep(out, constructorInfo, pl); + end + + if nargout > 0 + varargout{1} = out; + varargout{2} = pl; + else + error('!!! Invalid number of output') + end +end + +%-------------------------------------------------------------------------- +% AUTHORS EDIT THIS PART +%-------------------------------------------------------------------------- + +function desc = getModelDescription + desc = 'A model which builds a single value AO.'; +end + +function doc = getModelDocumentation + doc = ''; +end + +function vt = versionTable() + + vt = {'alpha', @versionAlpha, ... + 'beta', @versionBeta}; + +end + +% This version uses: +% model b, version 'alpha' +% model c, version 'initial' +% +function varargout = versionAlpha(varargin) + + if nargin == 1 && ischar(varargin{1}) + switch varargin{1} + case 'plist' + varargout{1} = plist('a', 1, 'b', 2, 'c', 3); + case 'description' + varargout{1} = 'returns an AO with value 1'; + case 'info' + varargout{1} = []; + otherwise + error('unknown inputs'); + end + return; + end + + % build model + varargout{1} = ao(1); + +end + +% This version uses: +% model b, version 'alpha' +% model c, version 'second' +% +function varargout = versionBeta(varargin) + + if nargin == 1 && ischar(varargin{1}) + switch varargin{1} + case 'plist' + varargout{1} = plist('a', 1); + case 'description' + varargout{1} = 'returns an AO with value 2'; + case 'info' + varargout{1} = []; + otherwise + error('unknown inputs'); + end + return; + end + + % build model + varargout{1} = ao(2); +end + +%-------------------------------------------------------------------------- +% AUTHORS SHOULD NOT NEED TO EDIT BELOW HERE +%-------------------------------------------------------------------------- + + +%-------------------------------------------------------------------------- +% Get Version +%-------------------------------------------------------------------------- +function v = getVersion + + v = '$Id: ao_model_b.m,v 1.3 2010/09/15 10:30:04 hewitson Exp $'; + +end +