Skip to content

Commit f2f0a74

Browse files
committed
added MetadataMixIn, included in Tag
1 parent 523e09a commit f2f0a74

File tree

2 files changed

+23
-16
lines changed

2 files changed

+23
-16
lines changed

+nix/MetadataMixIn.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
classdef MetadataMixIn < handle
2+
%MetadataMixIn
3+
% mixin class for nix entities with metadata
4+
5+
properties(Hidden)
6+
metadataCache
7+
end;
8+
9+
methods
10+
function obj = MetadataMixIn()
11+
obj.metadataCache = nix.CacheStruct();
12+
end
13+
14+
function metadata = open_metadata(obj)
15+
[obj.metadataCache, metadata] = nix.Utils.fetchObj(obj.updatedAt, ...
16+
'Tag::openMetadataSection', obj.nix_handle, obj.metadataCache, @nix.Section);
17+
end;
18+
end
19+
20+
end
21+

+nix/Tag.m

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
classdef Tag < nix.NamedEntity
1+
classdef Tag < nix.NamedEntity & nix.MetadataMixIn
22
%Tag nix Tag object
33

44
properties (Access = protected)
55
% namespace reference for nix-mx functions
66
alias = 'Tag'
77
end
88

9-
properties(Hidden)
10-
metadataCache
11-
end;
12-
139
methods
1410
function obj = Tag(h)
1511
12+
1613

1714
% assign dynamic properties
1815
obj.add_dyn_attr('position', 'rw');
@@ -23,8 +20,6 @@
2320
obj.add_dyn_relation('references', @nix.DataArray);
2421
obj.add_dyn_relation('features', @nix.Feature);
2522
obj.add_dyn_relation('sources', @nix.Source);
26-
27-
obj.metadataCache = nix.CacheStruct();
2823
end;
2924

3025
% ------------------
@@ -94,14 +89,5 @@
9489
'Tag::openSource', id_or_name, @nix.Source);
9590
end;
9691

97-
% ------------------
98-
% Metadata methods
99-
% ------------------
100-
101-
function metadata = open_metadata(obj)
102-
[obj.metadataCache, metadata] = nix.Utils.fetchObj(obj.updatedAt, ...
103-
'Tag::openMetadataSection', obj.nix_handle, obj.metadataCache, @nix.Section);
104-
end;
105-
10692
end;
10793
end

0 commit comments

Comments
 (0)