Mercurial > hg > ltpda
comparison m-toolbox/classes/@collection/generateConstructorPlist.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 % GENERATECONSTRUCTORPLIST generates a PLIST from the properties which can rebuild the object. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: GENERATECONSTRUCTORPLIST generates a PLIST from the | |
5 % properties which can rebuild the object. | |
6 % | |
7 % CALL: pl = obj.generateConstructorPlist(); | |
8 % | |
9 % <a href="matlab:utils.helper.displayMethodInfo('ao', 'generateConstructorPlist')">Parameters Description</a> | |
10 % | |
11 % VERSION: $Id: generateConstructorPlist.m,v 1.4 2011/04/08 08:56:22 hewitson Exp $ | |
12 % | |
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
14 | |
15 function pl = generateConstructorPlist(varargin) | |
16 | |
17 % Check if this is a call for parameters | |
18 if utils.helper.isinfocall(varargin{:}) | |
19 pl = getInfo(varargin{3}); | |
20 return | |
21 end | |
22 | |
23 obj = varargin{1}; | |
24 pl = plist(); | |
25 | |
26 % Add procinfo | |
27 appendProperty(pl, obj, 'procinfo'); | |
28 | |
29 % Add plotinfo | |
30 appendProperty(pl, obj, 'plotinfo'); | |
31 | |
32 % Add name | |
33 appendProperty(pl, obj, 'name', false); | |
34 | |
35 % Add description | |
36 appendProperty(pl, obj, 'description'); | |
37 | |
38 % Add objs | |
39 appendProperty(pl, obj, 'objs'); | |
40 | |
41 end | |
42 | |
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
44 % Local Functions % | |
45 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
46 | |
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
48 % | |
49 % FUNCTION: appendProperty | |
50 % | |
51 % CALL: appendProperty(pl, obj, propName) | |
52 % appendProperty(pl, obj, propName, isemptyCheck) | |
53 % | |
54 % DESCRIPTION: Get Info Object | |
55 % | |
56 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
57 | |
58 function appendProperty(pl, obj, propName, isemptyCheck) | |
59 | |
60 if nargin <= 3 | |
61 isemptyCheck = true; | |
62 end | |
63 | |
64 if isemptyCheck | |
65 if ~isempty(obj.(propName)) | |
66 pl.append(propName, obj.(propName)); | |
67 else | |
68 % Don't append the property to the PLIST | |
69 end | |
70 else | |
71 pl.append(propName, obj.(propName)); | |
72 end | |
73 | |
74 end | |
75 | |
76 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
77 % | |
78 % FUNCTION: getInfo | |
79 % | |
80 % DESCRIPTION: Get Info Object | |
81 % | |
82 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
83 | |
84 function ii = getInfo(varargin) | |
85 if nargin == 1 && strcmpi(varargin{1}, 'None') | |
86 sets = {}; | |
87 pl = []; | |
88 else | |
89 sets = {'Default'}; | |
90 pl = getDefaultPlist; | |
91 end | |
92 % Build info object | |
93 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.internal, '$Id: generateConstructorPlist.m,v 1.4 2011/04/08 08:56:22 hewitson Exp $', sets, pl); | |
94 end | |
95 | |
96 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
97 % | |
98 % FUNCTION: getDefaultPlist | |
99 % | |
100 % DESCRIPTION: Get Default Plist | |
101 % | |
102 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
103 | |
104 function plout = getDefaultPlist() | |
105 persistent pl; | |
106 if exist('pl', 'var')==0 || isempty(pl) | |
107 pl = buildplist(); | |
108 end | |
109 plout = pl; | |
110 end | |
111 | |
112 function pl = buildplist() | |
113 pl = plist.EMPTY_PLIST; | |
114 end | |
115 |