Skip to content

Commit 523e09a

Browse files
committed
Tag methods dynamic refactoring
1 parent aca6d3d commit 523e09a

File tree

1 file changed

+19
-88
lines changed

1 file changed

+19
-88
lines changed

+nix/Tag.m

Lines changed: 19 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,30 @@
1-
classdef Tag < nix.Entity
1+
classdef Tag < nix.NamedEntity
22
%Tag nix Tag object
33

4+
properties (Access = protected)
5+
% namespace reference for nix-mx functions
6+
alias = 'Tag'
7+
end
8+
49
properties(Hidden)
5-
info
6-
referencesCache
7-
featuresCache
8-
sourcesCache
910
metadataCache
1011
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;
2812

2913
methods
3014
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();
8228
end;
8329

8430
% ------------------
@@ -100,11 +46,6 @@
10046
'Tag::openReferenceDataArray', id_or_name, @nix.DataArray);
10147
end;
10248

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-
10849
function data = retrieve_data(obj, index)
10950
% convert Matlab-like to C-like index
11051
assert(index > 0, 'Subscript indices must be positive');
@@ -123,11 +64,6 @@
12364
retObj = nix.Utils.open_entity(obj, ...
12465
'Tag::openFeature', id_or_name, @nix.Feature);
12566
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;
13167

13268
function data = retrieve_feature_data(obj, index)
13369
% convert Matlab-like to C-like index
@@ -158,11 +94,6 @@
15894
'Tag::openSource', id_or_name, @nix.Source);
15995
end;
16096

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-
16697
% ------------------
16798
% Metadata methods
16899
% ------------------

0 commit comments

Comments
 (0)