|
1 |
| -classdef Tag < nix.Entity |
| 1 | +classdef Tag < nix.NamedEntity |
2 | 2 | %Tag nix Tag object
|
3 | 3 |
|
| 4 | + properties (Access = protected) |
| 5 | + % namespace reference for nix-mx functions |
| 6 | + alias = 'Tag' |
| 7 | + end |
| 8 | + |
4 | 9 | properties(Hidden)
|
5 |
| - info |
6 |
| - referencesCache |
7 |
| - featuresCache |
8 |
| - sourcesCache |
9 | 10 | metadataCache
|
10 | 11 | end;
|
11 |
| - |
12 |
| - properties(Dependent) |
13 |
| - id |
14 |
| - type |
15 |
| - name |
16 |
| - definition |
17 |
| - position |
18 |
| - extent |
19 |
| - units |
20 |
| - featureCount |
21 |
| - sourceCount |
22 |
| - referenceCount |
23 |
| - |
24 |
| - references |
25 |
| - features |
26 |
| - sources |
27 |
| - end; |
28 | 12 |
|
29 | 13 | methods
|
30 | 14 | function obj = Tag(h)
|
31 |
| - |
32 |
| - obj.info = nix_mx('Tag::describe', obj.nix_handle); |
33 |
| - |
34 |
| - obj.referencesCache.lastUpdate = 0; |
35 |
| - obj.referencesCache.data = {}; |
36 |
| - obj.featuresCache.lastUpdate = 0; |
37 |
| - obj.featuresCache.data = {}; |
38 |
| - obj.sourcesCache.lastUpdate = 0; |
39 |
| - obj.sourcesCache.data = {}; |
40 |
| - obj.metadataCache.lastUpdate = 0; |
41 |
| - obj.metadataCache.data = {}; |
42 |
| - end; |
43 |
| - |
44 |
| - function id = get.id(tag) |
45 |
| - id = tag.info.id; |
46 |
| - end; |
47 |
| - |
48 |
| - function name = get.name(tag) |
49 |
| - name = tag.info.name; |
50 |
| - end; |
51 |
| - |
52 |
| - function type = get.type(tag) |
53 |
| - type = tag.info.type; |
54 |
| - end; |
55 |
| - |
56 |
| - function definition = get.definition(tag) |
57 |
| - definition = tag.info.definition; |
58 |
| - end; |
59 |
| - |
60 |
| - function position = get.position(tag) |
61 |
| - position = tag.info.position; |
62 |
| - end; |
63 |
| - |
64 |
| - function extent = get.extent(tag) |
65 |
| - extent = tag.info.extent; |
66 |
| - end; |
67 |
| - |
68 |
| - function units = get.units(tag) |
69 |
| - units = tag.info.units; |
70 |
| - end; |
71 |
| - |
72 |
| - function featureCount = get.featureCount(tag) |
73 |
| - featureCount = tag.info.featureCount; |
74 |
| - end; |
75 |
| - |
76 |
| - function sourceCount = get.sourceCount(tag) |
77 |
| - sourceCount = tag.info.sourceCount; |
78 |
| - end; |
79 |
| - |
80 |
| - function referenceCount = get.referenceCount(tag) |
81 |
| - referenceCount = tag.info.referenceCount; |
| 15 | + |
| 16 | + |
| 17 | + % assign dynamic properties |
| 18 | + obj.add_dyn_attr('position', 'rw'); |
| 19 | + obj.add_dyn_attr('extent', 'rw'); |
| 20 | + obj.add_dyn_attr('units', 'rw'); |
| 21 | + |
| 22 | + % assign relations |
| 23 | + obj.add_dyn_relation('references', @nix.DataArray); |
| 24 | + obj.add_dyn_relation('features', @nix.Feature); |
| 25 | + obj.add_dyn_relation('sources', @nix.Source); |
| 26 | + |
| 27 | + obj.metadataCache = nix.CacheStruct(); |
82 | 28 | end;
|
83 | 29 |
|
84 | 30 | % ------------------
|
|
100 | 46 | 'Tag::openReferenceDataArray', id_or_name, @nix.DataArray);
|
101 | 47 | end;
|
102 | 48 |
|
103 |
| - function da = get.references(obj) |
104 |
| - [obj.referencesCache, da] = nix.Utils.fetchObjList(obj.updatedAt, ... |
105 |
| - 'Tag::references', obj.nix_handle, obj.referencesCache, @nix.DataArray); |
106 |
| - end; |
107 |
| - |
108 | 49 | function data = retrieve_data(obj, index)
|
109 | 50 | % convert Matlab-like to C-like index
|
110 | 51 | assert(index > 0, 'Subscript indices must be positive');
|
|
123 | 64 | retObj = nix.Utils.open_entity(obj, ...
|
124 | 65 | 'Tag::openFeature', id_or_name, @nix.Feature);
|
125 | 66 | end;
|
126 |
| - |
127 |
| - function feat = get.features(obj) |
128 |
| - [obj.featuresCache, feat] = nix.Utils.fetchObjList(obj.updatedAt, ... |
129 |
| - 'Tag::features', obj.nix_handle, obj.featuresCache, @nix.Feature); |
130 |
| - end; |
131 | 67 |
|
132 | 68 | function data = retrieve_feature_data(obj, index)
|
133 | 69 | % convert Matlab-like to C-like index
|
|
158 | 94 | 'Tag::openSource', id_or_name, @nix.Source);
|
159 | 95 | end;
|
160 | 96 |
|
161 |
| - function sources = get.sources(obj) |
162 |
| - [obj.sourcesCache, sources] = nix.Utils.fetchObjList(obj.updatedAt, ... |
163 |
| - 'Tag::sources', obj.nix_handle, obj.sourcesCache, @nix.Source); |
164 |
| - end; |
165 |
| - |
166 | 97 | % ------------------
|
167 | 98 | % Metadata methods
|
168 | 99 | % ------------------
|
|
0 commit comments