Skip to content

Commit b6614e1

Browse files
committed
[c++/m] Add Source referringMultiTags method
Adds the referringMultiTags method to the Source entity on c++ and matlab side and introduces a corresponding test.
1 parent d13356a commit b6614e1

File tree

3 files changed

+28
-1
lines changed

3 files changed

+28
-1
lines changed

+nix/Source.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,10 @@
6363
retObj = nix.Utils.fetchObjList('Source::referringTags', ...
6464
obj.nix_handle, @nix.Tag);
6565
end
66+
67+
function retObj = referring_multi_tags(obj)
68+
retObj = nix.Utils.fetchObjList('Source::referringMultiTags', ...
69+
obj.nix_handle, @nix.MultiTag);
70+
end
6671
end;
6772
end

nix_mx.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,8 @@ void mexFunction(int nlhs,
246246
.reg("parentSource", GETTER(nix::Source, nix::Source, parentSource))
247247
.reg("sourceCount", GETTER(nix::ndsize_t, nix::Source, sourceCount))
248248
.reg("referringDataArrays", GETTER(std::vector<nix::DataArray>, nix::Source, referringDataArrays))
249-
.reg("referringTags", GETTER(std::vector<nix::Tag>, nix::Source, referringTags));
249+
.reg("referringTags", GETTER(std::vector<nix::Tag>, nix::Source, referringTags))
250+
.reg("referringMultiTags", GETTER(std::vector<nix::MultiTag>, nix::Source, referringMultiTags));
250251

251252
classdef<nix::Tag>("Tag", methods)
252253
.desc(&nixtag::describe)

tests/TestSource.m

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
funcs{end+1} = @test_open_metadata;
2424
funcs{end+1} = @test_referring_data_arrays;
2525
funcs{end+1} = @test_referring_tags;
26+
funcs{end+1} = @test_referring_multi_tags;
2627
end
2728

2829
%% Test: fetch sources
@@ -246,3 +247,23 @@
246247
t2.add_source(s);
247248
assert(size(s.referring_tags, 1) == 2);
248249
end
250+
251+
%% Test: Referring multi tags
252+
function [] = test_referring_multi_tags( varargin )
253+
fileName = fullfile(pwd, 'tests', 'testRW.h5');
254+
f = nix.File(fileName, nix.FileMode.Overwrite);
255+
b = f.create_block('testBlock', 'nixBlock');
256+
d = b.create_data_array('testDataArray', 'nixDataArray', nix.DataType.Double, [1 2]);
257+
s = b.create_source('testSource', 'nixSource');
258+
259+
assert(isempty(s.referring_multi_tags));
260+
261+
t1 = b.create_multi_tag('testMultiTag1', 'nixMultiTag', d);
262+
t1.add_source(s);
263+
assert(~isempty(s.referring_multi_tags));
264+
assert(strcmp(s.referring_multi_tags{1}.name, t1.name));
265+
266+
t2 = b.create_multi_tag('testMultiTag2', 'nixMultiTag', d);
267+
t2.add_source(s);
268+
assert(size(s.referring_multi_tags, 1) == 2);
269+
end

0 commit comments

Comments
 (0)