comparison m-toolbox/classes/@pzmodel/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:32 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 iunits
39 appendProperty(pl, obj, 'iunits');
40
41 % Add ounits
42 appendProperty(pl, obj, 'ounits');
43
44 % Add poles
45 appendProperty(pl, obj, 'poles');
46
47 % Add zeros
48 appendProperty(pl, obj, 'zeros');
49
50 % Add gain
51 appendProperty(pl, obj, 'gain');
52
53 % Add delay
54 appendProperty(pl, obj, 'delay');
55
56 end
57
58 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
59 % Local Functions %
60 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
61
62 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
63 %
64 % FUNCTION: appendProperty
65 %
66 % CALL: appendProperty(pl, obj, propName)
67 % appendProperty(pl, obj, propName, isemptyCheck)
68 %
69 % DESCRIPTION: Get Info Object
70 %
71 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
72
73 function appendProperty(pl, obj, propName, isemptyCheck)
74
75 if nargin <= 3
76 isemptyCheck = true;
77 end
78
79 if isemptyCheck
80 if ~isempty(obj.(propName))
81 pl.append(propName, obj.(propName));
82 else
83 % Don't append the property to the PLIST
84 end
85 else
86 pl.append(propName, obj.(propName));
87 end
88
89 end
90
91 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
92 %
93 % FUNCTION: getInfo
94 %
95 % DESCRIPTION: Get Info Object
96 %
97 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
98
99 function ii = getInfo(varargin)
100 if nargin == 1 && strcmpi(varargin{1}, 'None')
101 sets = {};
102 pl = [];
103 else
104 sets = {'Default'};
105 pl = getDefaultPlist;
106 end
107 % Build info object
108 ii = minfo(mfilename, 'ao', 'ltpda', utils.const.categories.internal, '$Id: generateConstructorPlist.m,v 1.4 2011/04/08 08:56:32 hewitson Exp $', sets, pl);
109 end
110
111 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
112 %
113 % FUNCTION: getDefaultPlist
114 %
115 % DESCRIPTION: Get Default Plist
116 %
117 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
118
119 function plout = getDefaultPlist()
120 persistent pl;
121 if exist('pl', 'var')==0 || isempty(pl)
122 pl = buildplist();
123 end
124 plout = pl;
125 end
126
127 function pl = buildplist()
128 pl = plist.EMPTY_PLIST;
129 end
130