Skip to content

Commit 27989d2

Browse files
committed
[Matlab] Add basic nix.Property documentation
1 parent e6832d7 commit 27989d2

File tree

2 files changed

+52
-7
lines changed

2 files changed

+52
-7
lines changed

+nix/Property.m

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,41 @@
1+
% nix.Property class contains the concrete values associated with metadata.
2+
%
3+
% nix.Property dynamic properties:
4+
% id (char): read-only, automatically created id of the entity.
5+
% name (char): read-only, name of the entity.
6+
% definition (char): read-write, additional description of the entity.
7+
% unit (char): read-write, unit of the values associated with a Property.
8+
% The provided unit has to be an SI unit.
9+
% datatype (char): read-only, provides the datatype of the values associated
10+
% with a Property. Attribute is set when the Property is created.
11+
%
12+
% nix.Property dynamic child entity properties:
13+
% values access to all value child entities.
14+
%
15+
% Property values can be set via the dynamic child entity property. When
16+
% values are set, they replace any previously stored values. The new values
17+
% always have to be of a datatype supported by the Property.
18+
%
19+
% Example: currProperty.values = {'last name', 'first name'};
20+
%
21+
% The values themselves have two properties: value and uncertainty which
22+
% can be accessed and updated individually.
23+
%
24+
% Individual values can be accessed and set by their value property. A set
25+
% value has to match the datatype of the Property.
26+
%
27+
% Example: currProperty.values{1}.value %-- get first value of Property.
28+
% currProperty.values{2}.value = 'some value' %-- set second value of Property.
29+
%
30+
% Each value comes with its own uncertainty property which can be accessed
31+
% and set. NOTE: this will probably change in the near future, moving the
32+
% uncertainty from the individual value to the level of the Property.
33+
%
34+
% Example: %-- get uncertainty of first property value.
35+
% currProperty.values{1}.uncertainty
36+
% %-- set uncertainty of second property value.
37+
% currProperty.values{1}.uncertainty = 0.1
38+
%
139
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
240
%
341
% All rights reserved.
@@ -7,12 +45,9 @@
745
% LICENSE file in the root of the Project.
846

947
classdef Property < nix.NamedEntity
10-
% PROPERTY Metadata Property class
11-
% NIX metadata property
1248

1349
properties (Hidden)
14-
% namespace reference for nix-mx functions
15-
alias = 'Property'
50+
alias = 'Property' % nix-mx namespace to access Property specific nix backend functions.
1651
end
1752

1853
properties (Dependent)
@@ -58,10 +93,20 @@
5893
end
5994

6095
function r = valueCount(obj)
96+
% Get the number of the child values of the invoking Property.
97+
%
98+
% Returns: (uint) The number of child values.
99+
%
100+
% Example: vc = currProperty.valueCount();
101+
61102
r = nix.Utils.fetchEntityCount(obj, 'valueCount');
62103
end
63104

64105
function [] = deleteValues(obj)
106+
% Deletes all values from the invoking Property.
107+
%
108+
% Example: check = currProperty.deleteValues();
109+
65110
fname = strcat(obj.alias, '::deleteValues');
66111
nix_mx(fname, obj.nixhandle);
67112
end

tests/TestProperty.m

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
% TestProperty provides tests for all supported nix.Property methods.
2+
%
13
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
24
%
35
% All rights reserved.
@@ -7,8 +9,6 @@
79
% LICENSE file in the root of the Project.
810

911
function funcs = TestProperty
10-
% TESTPROPERTY % Tests for the nix.Property object
11-
1212
funcs = {};
1313
funcs{end+1} = @testAttributes;
1414
funcs{end+1} = @testUpdateValues;
@@ -140,7 +140,7 @@
140140
assert(isempty(f.sections{1}.properties{1}.values));
141141
end
142142

143-
%% Test: Compare properties
143+
%% Test: Compare Properties
144144
function [] = testCompare( varargin )
145145
testFile = fullfile(pwd, 'tests', 'testRW.h5');
146146
f = nix.File(testFile, nix.FileMode.Overwrite);

0 commit comments

Comments
 (0)