|
10 | 10 |
|
11 | 11 | methods(Static)
|
12 | 12 |
|
13 |
| - function rdata = fetchObjList(nixMxFunc, handle, objConstructor) |
14 |
| - currList = nix_mx(nixMxFunc, handle); |
15 |
| - rdata = cell(length(currList), 1); |
16 |
| - for i = 1:length(currList) |
17 |
| - rdata{i} = objConstructor(currList{i}); |
| 13 | + function r = createEntityArray(list, objConstructor) |
| 14 | + r = cell(length(list), 1); |
| 15 | + for i = 1:length(list) |
| 16 | + r{i} = objConstructor(list{i}); |
18 | 17 | end
|
19 | 18 | end
|
20 | 19 |
|
| 20 | + function r = fetchObjList(nixMxFunc, handle, objConstructor) |
| 21 | + list = nix_mx(nixMxFunc, handle); |
| 22 | + r = nix.Utils.createEntityArray(list, objConstructor); |
| 23 | + end |
| 24 | + |
21 | 25 | % This method calls the nix-mx function specified by 'nixMxFunc', handing
|
22 | 26 | % over 'handle' as the main nix entity handle and 'related_handle' as a
|
23 | 27 | % second nix entity handle related to the first one.
|
24 |
| - % 'objConstrucor' requires the Matlab entity constructor of the expected |
| 28 | + % 'objConstructor' requires the Matlab entity constructor of the expected |
25 | 29 | % returned nix Entities.
|
26 |
| - function rdata = fetchObjListByEntity(nixMxFunc, handle, related_handle, objConstructor) |
27 |
| - currList = nix_mx(nixMxFunc, handle, related_handle); |
28 |
| - rdata = cell(length(currList), 1); |
29 |
| - for i = 1:length(currList) |
30 |
| - rdata{i} = objConstructor(currList{i}); |
31 |
| - end |
| 30 | + function r = fetchObjListByEntity(nixMxFunc, handle, related_handle, objConstructor) |
| 31 | + list = nix_mx(nixMxFunc, handle, related_handle); |
| 32 | + r = nix.Utils.createEntityArray(list, objConstructor); |
32 | 33 | end
|
33 | 34 |
|
34 | 35 | function r = fetchObj(nixMxFunc, handle, objConstructor)
|
|
101 | 102 | end
|
102 | 103 | end
|
103 | 104 |
|
104 |
| - function rdata = filter(obj, filter, val, mxMethod, objConstructor) |
| 105 | + function r = filter(obj, filter, val, mxMethod, objConstructor) |
105 | 106 | valid = nix.Utils.valid_filter(filter, val);
|
106 | 107 | if (~isempty(valid))
|
107 | 108 | error(valid);
|
108 | 109 | end
|
109 | 110 |
|
110 |
| - currList = nix_mx(mxMethod, obj.nix_handle, uint8(filter), val); |
111 |
| - rdata = cell(length(currList), 1); |
112 |
| - for i = 1:length(currList) |
113 |
| - rdata{i} = objConstructor(currList{i}); |
114 |
| - end |
| 111 | + list = nix_mx(mxMethod, obj.nix_handle, uint8(filter), val); |
| 112 | + r = nix.Utils.createEntityArray(list, objConstructor); |
115 | 113 | end
|
116 | 114 |
|
117 | 115 | % -----------------------------------------------------------
|
118 | 116 | % findXXX helper functions
|
119 | 117 | % -----------------------------------------------------------
|
120 | 118 |
|
121 |
| - function rdata = find(obj, max_depth, filter, val, ... |
122 |
| - mxMethod, objConstructor) |
| 119 | + function r = find(obj, max_depth, filter, val, mxMethod, objConstructor) |
123 | 120 | if (~isnumeric(max_depth))
|
124 | 121 | error('Provide a valid search depth');
|
125 | 122 | end
|
|
129 | 126 | error(valid);
|
130 | 127 | end
|
131 | 128 |
|
132 |
| - currList = nix_mx(mxMethod, ... |
133 |
| - obj.nix_handle, max_depth, uint8(filter), val); |
134 |
| - |
135 |
| - rdata = cell(length(currList), 1); |
136 |
| - for i = 1:length(currList) |
137 |
| - rdata{i} = objConstructor(currList{i}); |
138 |
| - end |
| 129 | + list = nix_mx(mxMethod, obj.nix_handle, max_depth, uint8(filter), val); |
| 130 | + r = nix.Utils.createEntityArray(list, objConstructor); |
139 | 131 | end
|
140 | 132 |
|
141 | 133 | % -----------------------------------------------------------
|
|
0 commit comments