comparison m-toolbox/classes/@ao/fromProcinfo.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % FROMPROCINFO returns for a given key-name the value of the procinfo-plist
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: FROMPROCINFO returns for a given key-name the value of the
5 % procinfo - parameter list
6 %
7 % CALL: val = fromProcinfo(obj, 'key');
8 % val = obj.fromProcinfo('key');
9 % val = obj.fromProcinfo(plist('key', 'key_name'));
10 %
11 % PARAMETERS: 'key': key-name which should be found in the porcinfo-plist
12 %
13 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'fromProcinfo')">Parameters Description</a>
14 %
15 % VERSION: $Id: fromProcinfo.m,v 1.7 2011/04/08 08:56:11 hewitson Exp $
16 %
17 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
18
19 function val = fromProcinfo(varargin)
20
21 % Check if this is a call for parameters
22 if utils.helper.isinfocall(varargin{:})
23 val = getInfo(varargin{3});
24 return
25 end
26
27 % Collect all AOs
28 as = utils.helper.collect_objects(varargin(:), 'ao');
29 pl = utils.helper.collect_objects(varargin(:), 'plist');
30 key = utils.helper.collect_objects(varargin(:), 'char');
31
32 if isempty(key) && ~isempty(pl) && pl.nparams == 1 && pl.isparam('key')
33 key = pl.find('key');
34 end
35
36 if ~ischar(key)
37 error('### Please specify only one key as a string.');
38 end
39
40 if numel(as) ~= 1
41 error('### This method works only for one input AO.');
42 end
43
44 val = as.procinfo.find(key);
45
46 end
47
48 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
49 % Local Functions %
50 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
51
52 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
53 %
54 % FUNCTION: getInfo
55 %
56 % DESCRIPTION: Get Info Object
57 %
58 % HISTORY: 11-07-07 M Hewitson
59 % Creation.
60 %
61 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
62
63 function ii = getInfo(varargin)
64 if nargin == 1 && strcmpi(varargin{1}, 'None')
65 sets = {};
66 pl = [];
67 else
68 sets = {'Default'};
69 pl = getDefaultPlist;
70 end
71 % Build info object
72 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.helper, '$Id: fromProcinfo.m,v 1.7 2011/04/08 08:56:11 hewitson Exp $', sets, pl);
73 end
74
75 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76 %
77 % FUNCTION: getDefaultPlist
78 %
79 % DESCRIPTION: Get Default Plist
80 %
81 % HISTORY: 11-07-07 M Hewitson
82 % Creation.
83 %
84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
85
86 function plout = getDefaultPlist()
87 persistent pl;
88 if exist('pl', 'var')==0 || isempty(pl)
89 pl = buildplist();
90 end
91 plout = pl;
92 end
93
94 function plo = buildplist()
95 plo = plist('key', '');
96 end
97
98