1
- classdef Tag < nix .Entity
1
+ classdef Tag < nix .NamedEntity & nix . MetadataMixIn & nix . SourcesMixIn
2
2
% Tag nix Tag object
3
3
4
- properties (Hidden )
5
- info
6
- referencesCache
7
- featuresCache
8
- sourcesCache
9
- metadataCache
10
- end ;
4
+ properties (Access = protected )
5
+ % namespace reference for nix-mx functions
6
+ alias = ' Tag'
7
+ end
11
8
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
-
29
9
methods
30
10
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 ;
11
+ [email protected] (
h );
% this should be first
12
+
13
+
14
+
15
+ % assign dynamic properties
16
+ obj .add_dyn_attr(' position' , ' rw' );
17
+ obj .add_dyn_attr(' extent' , ' rw' );
18
+ obj .add_dyn_attr(' units' , ' rw' );
19
+
20
+ % assign relations
21
+ obj .add_dyn_relation(' references' , @nix .DataArray );
22
+ obj .add_dyn_relation(' features' , @nix .Feature );
82
23
end ;
83
24
84
25
% ------------------
100
41
' Tag::openReferenceDataArray' , id_or_name , @nix .DataArray );
101
42
end ;
102
43
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
44
function data = retrieve_data(obj , index )
109
45
% convert Matlab-like to C-like index
110
46
assert(index > 0 , ' Subscript indices must be positive' );
123
59
retObj = nix .Utils .open_entity(obj , ...
124
60
' Tag::openFeature' , id_or_name , @nix .Feature );
125
61
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
62
132
63
function data = retrieve_feature_data(obj , index )
133
64
% convert Matlab-like to C-like index
138
69
% see mkarray.cc(42)
139
70
data = permute(tmp , length(size(tmp )): -1 : 1 );
140
71
end ;
141
-
142
- % ------------------
143
- % Sources methods
144
- % ------------------
145
-
146
- function [] = add_source(obj , add_this )
147
- obj.sourcesCache = nix .Utils .add_entity(obj , ...
148
- add_this , ' nix.Source' , ' Tag::addSource' , obj .sourcesCache );
149
- end ;
150
-
151
- function delCheck = remove_source(obj , del )
152
- [delCheck , obj .sourcesCache ] = nix .Utils .delete_entity(obj , ...
153
- del , ' nix.Source' , ' Tag::removeSource' , obj .sourcesCache );
154
- end ;
155
-
156
- function retObj = open_source(obj , id_or_name )
157
- retObj = nix .Utils .open_entity(obj , ...
158
- ' Tag::openSource' , id_or_name , @nix .Source );
159
- end ;
160
-
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
- % ------------------
167
- % Metadata methods
168
- % ------------------
169
-
170
- function metadata = open_metadata(obj )
171
- [obj .metadataCache , metadata ] = nix .Utils .fetchObj(obj .updatedAt , ...
172
- ' Tag::openMetadataSection' , obj .nix_handle , obj .metadataCache , @nix .Section );
173
- end ;
174
72
175
73
end ;
176
74
end
0 commit comments