Home > . > generateExtension.m

generateExtension

PURPOSE ^

GENERATEEXTENSION Generate Matlab classes from NWB extension schema file

SYNOPSIS ^

function generateExtension(source)

DESCRIPTION ^

 GENERATEEXTENSION Generate Matlab classes from NWB extension schema file
   GENERATECORE(extension_path...)  Generate classes 
   (Matlab m-files) from one or more NWB:N schema extension namespace 
   files.  A registry of already generated core types is used to resolve 
   dependent types.
   
   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('schema\core\nwb.namespace.yaml');
      generateExtension('schema\myext\myextension.namespace.yaml')
 
   See also GENERATECORE

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function generateExtension(source)
0002 % GENERATEEXTENSION Generate Matlab classes from NWB extension schema file
0003 %   GENERATECORE(extension_path...)  Generate classes
0004 %   (Matlab m-files) from one or more NWB:N schema extension namespace
0005 %   files.  A registry of already generated core types is used to resolve
0006 %   dependent types.
0007 %
0008 %   A cache of schema data is generated in the 'namespaces' subdirectory in
0009 %   the current working directory.  This is for allowing cross-referencing
0010 %   classes between multiple namespaces.
0011 %
0012 %   Output files are generated placed in a '+types' subdirectory in the
0013 %   current working directory.
0014 %
0015 %   Example:
0016 %      generateCore('schema\core\nwb.namespace.yaml');
0017 %      generateExtension('schema\myext\myextension.namespace.yaml')
0018 %
0019 %   See also GENERATECORE
0020 validateattributes(source, {'char', 'string'}, {'scalartext'});
0021 
0022 %find jar from source and generate Schema
0023 schema = spec.loadSchema();
0024 
0025 [localpath, ~, ~] = fileparts(source);
0026 assert(2 == exist(source, 'file'),...
0027     'MATNWB:FILE', 'Path to file `%s` could not be found.', source);
0028 fid = fopen(source);
0029 namespace_map = schema.read(fread(fid, '*char') .');
0030 fclose(fid);
0031 
0032 spec.generate(namespace_map, localpath);
0033 end

Generated on Fri 09-Aug-2019 14:27:49 by m2html © 2005