forked from NeurodataWithoutBorders/matnwb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateCore.m
44 lines (42 loc) · 1.37 KB
/
generateCore.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function generateCore(version)
% GENERATECORE Generate Matlab classes from NWB core schema files
% GENERATECORE() Generate classes (Matlab m-files) from the
% NWB:N core namespace file. By default, generates off of the most recent nwb-schema
% release.
%
% GENERATECORE(version) Generate classes for the
% core namespace of that version
%
% A cache of schema data is generated in the 'namespaces' subdirectory in
% the current working directory. This is for allowing cross-referencing
% classes between multiple namespaces.
%
% Output files are generated placed in a '+types' subdirectory in the
% current working directory.
%
% Example:
% generateCore();
% generateCore('2.2.3');
%
% See also GENERATEEXTENSION
if nargin == 0
version = '2.4.0';
else
validateattributes(version, {'char'}, {'scalartext'});
end
matNwbLocation = misc.getMatnwbDir();
schemaPath = fullfile(matNwbLocation, 'nwb-schema', version);
corePath = fullfile(schemaPath, 'core', 'nwb.namespace.yaml');
commonPath = fullfile(schemaPath,...
'hdmf-common-schema', ...
'common',...
'namespace.yaml');
assert(2 == exist(corePath, 'file'),...
'NWB:GenerateCore:MissingCoreSchema',...
'Cannot find suitable core namespace for schema version `%s`',...
version);
if 2 == exist(commonPath, 'file')
generateExtension(commonPath);
end
generateExtension(corePath);
end