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