Skip to content

Commit a28f7d3

Browse files
committed
[Matlab] Basic documentation for utility classes
1 parent 57254c5 commit a28f7d3

File tree

7 files changed

+67
-21
lines changed

7 files changed

+67
-21
lines changed

+nix/DataType.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
% nix.DataTypes provides access to the DataTypes supported by NIX.
2+
%
13
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
24
%
35
% All rights reserved.
@@ -7,7 +9,6 @@
79
% LICENSE file in the root of the Project.
810

911
classdef DataType
10-
% DataTypes supported by nix.
1112

1213
enumeration
1314
Bool;

+nix/Dynamic.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
% Dynamic class implements methods to dynamically assign properties.
2+
%
3+
% Utility class, do not use out of context.
4+
%
5+
%
16
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
27
%
38
% All rights reserved.
@@ -7,8 +12,6 @@
712
% LICENSE file in the root of the Project.
813

914
classdef Dynamic
10-
% Dynamic class (with static methods hehe)
11-
% implements methods to dynamically assigns properties
1215

1316
methods (Static)
1417
function addProperty(obj, prop, mode)

+nix/Entity.m

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
% Entity base class for nix entities.
2+
%
3+
% Class provides access to the info property and handles the lifetime
4+
% of a nix entitiy.
5+
%
6+
% Utility class, do not use out of context.
7+
%
8+
%
19
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
210
%
311
% All rights reserved.
@@ -7,8 +15,6 @@
715
% LICENSE file in the root of the Project.
816

917
classdef Entity < dynamicprops
10-
% Entity base class for nix entities
11-
% handles object lifetime
1218

1319
properties (Hidden)
1420
nixhandle
@@ -32,6 +38,8 @@
3238
end
3339

3440
function r = updatedAt(obj)
41+
% Provides the time the entity was last updated.
42+
3543
r = nix_mx('Entity::updatedAt', obj.nixhandle);
3644
end
3745

+nix/FileMode.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
% nix.FileMode provides access to the Modes a NIX file can be opened.
2+
%
13
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
24
%
35
% All rights reserved.
@@ -7,7 +9,6 @@
79
% LICENSE file in the root of the Project.
810

911
classdef FileMode
10-
% FILEMODE nix file open modes
1112

1213
properties (Constant)
1314
ReadOnly = uint8(0);

+nix/Filter.m

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,29 @@
1+
% nix.Filter provides access to all filters supported by nix filter functions.
2+
%
3+
% 'acceptall' returns an unfiltered result; requires an empty value.
4+
% 'id' returns all entities matching the provided id string.
5+
% 'ids' returns all entities matching the provided ids. id strings
6+
% have to be provided as a cell array.
7+
% 'type' returns all entities where their type matches the provided string.
8+
% 'name' returns all entities where their name matches the provided string.
9+
% 'metadata' returns all entities which link to a Section with the
10+
% provided id string.
11+
% 'source' returns all entities which link to a Source with the
12+
% provided id or name string.
13+
%
14+
% Please note, that not all filter functions support every filter listed
15+
% here. Consult the documentation for every filter function for details.
16+
%
17+
%
18+
% Copyright (c) 2017, German Neuroinformatics Node (G-Node)
19+
%
20+
% All rights reserved.
21+
%
22+
% Redistribution and use in source and binary forms, with or without
23+
% modification, are permitted under the terms of the BSD License. See
24+
% LICENSE file in the root of the Project.
25+
126
classdef Filter < uint8
2-
% FILTER available nix custom filters
327

428
enumeration
529
acceptall (0); % requires an empty value

+nix/MetadataMixIn.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
% to one nix.Section entity and therefore makes it possible to annotate the entities
88
% with additional metadata.
99
%
10-
% Depends on nix.Entity.
10+
% Depends on nix.Entity; Utility class, do not use out of context.
1111
%
1212
% See also nix.Section, nix.Block, nix.Group, nix.DataArray, nix.Tag, nix.MultiTag, nix.Source, nix.Entity.
1313
%

+nix/Utils.m

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
% nix.Utils provides utility functions accessing the nix backend.
2+
%
3+
% Utility functions, do not use out of context!
4+
%
5+
%
16
% Copyright (c) 2016, German Neuroinformatics Node (G-Node)
27
%
38
% All rights reserved.
@@ -52,12 +57,13 @@
5257
r = nix.Utils.createEntityArray(list, objConstructor);
5358
end
5459

55-
% This method calls the nix-mx function specified by 'nixMxFunc', handing
56-
% over 'handle' as the main nix entity handle and 'relatedHandle' as a
57-
% second nix entity handle related to the first one.
58-
% 'objConstructor' requires the Matlab entity constructor of the expected
59-
% returned nix Entities.
6060
function r = fetchObjListByEntity(obj, mxMethodName, relatedHandle, objConstructor)
61+
% This method calls the nix-mx function specified by 'nixMxFunc', handing
62+
% over 'handle' as the main nix entity handle and 'relatedHandle' as a
63+
% second nix entity handle related to the first one.
64+
% 'objConstructor' requires the Matlab entity constructor of the expected
65+
% returned nix Entities.
66+
6167
mxMethod = strcat(obj.alias, '::', mxMethodName);
6268
list = nix_mx(mxMethod, obj.nixhandle, relatedHandle);
6369
r = nix.Utils.createEntityArray(list, objConstructor);
@@ -96,10 +102,11 @@
96102
nix_mx(mxMethod, obj.nixhandle, handleArray);
97103
end
98104

99-
% Function can be used for both nix delete and remove methods.
100-
% The first actually removes the entity, the latter
101-
% removes only the reference to the entity.
102105
function r = deleteEntity(obj, mxMethodName, idNameEntity, nixEntity)
106+
% Function can be used for both nix delete and remove methods.
107+
% The first actually removes the entity, the latter
108+
% removes only the reference to the entity.
109+
103110
mxMethod = strcat(obj.alias, '::', mxMethodName);
104111
id = nix.Utils.parseEntityId(idNameEntity, nixEntity);
105112
r = nix_mx(mxMethod, obj.nixhandle, id);
@@ -165,15 +172,17 @@
165172
% -----------------------------------------------------------
166173

167174
function r = transposeArray(data)
168-
% Data must agree with file & dimensions; see mkarray.cc(42)
175+
% Data must agree with file & dimensions; see mkarray.cc(42)
176+
169177
r = permute(data, length(size(data)):-1:1);
170178
end
171179

172180
function r = handleIndex(idx)
173-
% Matlab uses 1-based indexing opposed to 0 based indexing in C++.
174-
% handleIndex transforms a Matlab style index to a C++ style
175-
% index and raises the appropriate Matlab error in case of an
176-
% invalid subscript.
181+
% Matlab uses 1-based indexing opposed to 0 based indexing in C++.
182+
% handleIndex transforms a Matlab style index to a C++ style
183+
% index and raises the appropriate Matlab error in case of an
184+
% invalid subscript.
185+
177186
if (idx < 1)
178187
err.identifier = 'MATLAB:badsubscript';
179188
err.message = 'Subscript indices must either be real positive integers or logicals.';

0 commit comments

Comments
 (0)