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